Skip to content
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

Error upon calling _start after upgrading to tinygo version 0.35.0 #4721

Open
GLMONTER opened this issue Jan 29, 2025 · 2 comments
Open

Error upon calling _start after upgrading to tinygo version 0.35.0 #4721

GLMONTER opened this issue Jan 29, 2025 · 2 comments
Labels
next-release Will be part of next release wasm WebAssembly

Comments

@GLMONTER
Copy link

I am using wasmtime and wasmtime-go version 29. I have a wasm module compiled with tinygo. Whenever I get the exported _start function and call it, I am getting an error. This was not an issue with tinygo version 0.34.0. The error should most likely be nil because the exit status is 0?

Code calling _start

mainFunc := module.Instance.GetExport(module.Store, "_start").Func()
_, err = mainFunc.Call(module.Store)
//error is non nil

Error received that should probably be nil

error while executing at wasm backtrace:\n    0: 0x7a4e - <unknown>!<wasm function 116>\n\nCaused by:\n    Exited with i32 exit status 0
@deadprogram deadprogram added the wasm WebAssembly label Feb 4, 2025
@mjmar01
Copy link

mjmar01 commented Feb 8, 2025

I'm experiencing a similar issue. When building a program for the WASI target, the _start function immediately exits with code 0.

This causes wazero to close the module, making it impossible to call exported functions after that. Version 0.34.0 doesn't behave like this.

Is there a compilation option to avoid this? Or can I do something in the main function to make it not exit without blocking?

@deadprogram
Copy link
Member

Please see PR #4734 for one possible solution to this.

@deadprogram deadprogram added the next-release Will be part of next release label Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next-release Will be part of next release wasm WebAssembly
Projects
None yet
Development

No branches or pull requests

3 participants