-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiled Module not loaded properly in v1.8.2 but works in v1.6.0 #2358
Comments
Note this also fails using v1.7.0 This occurs when using a compiled module with a cache directory. |
David, I'm not hitting this, which is kind of interesting to me. I don't know if it will be helpful, bug have a look at this: Maybe helpful? |
@faddat ? Did you try the example repo? The steps to reproduce on your own:
|
I have played around with the code, and noticed that this panic was from calling This is because in wazero 1.7+ instantiating returns this error:
Somehow it is not using or finding the compilation cache? |
It seems to be the case that when we create the wazevo Engine, it only looks up the CompiledModule from Memory and does not use the cache: wazero/internal/engine/wazevo/engine.go Lines 566 to 575 in 610c202
Naively trying to lookup using cache works ~almost. compiled, ok := e.getCompiledModuleFromMemory(m)
if !ok {
var err error
compiled, ok, err = e.getCompiledModuleFromCache(m)
if err != nil {
return nil, fmt.Errorf("could not lookup module in cache: %w", err)
}
if !ok {
return nil, errors.New("source module must be compiled before instantiation")
}
} It does managed to find the compiled module by ID but results in a panic resolving imported functions:
My debugging abilities are ok, but my understanding of the wazero/wazevo internals are a little bit put the test. @mathetake @evacchi ??? |
Describe the bug
Instantiating compiled module results in nil pointer dereference in v1.8.2 but not v1.6.0
To Reproduce
Clone the example repository, checkout the
set-exitcode-deref-panic
branch and run the tests:git clone https://github.com/davidmdm/wzbug.git cd wzbug git checkout set-exitcode-deref-panic ./test.sh
Expected behavior
The module should instantiate and run properly as it did with v1.6.0 without panic.
Screenshots
Environment (please complete the relevant information):
The text was updated successfully, but these errors were encountered: