runtime: gc does not work with wasmexport
and "void" functions
#69584
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Go version
go version devel go1.24-c208b91 Fri Sep 20 13:54:44 2024 +0000 linux/amd64
Output of
go env
in your module/workspace:What did you do?
I attempted to use the new functionality introduced in #65199 which allows for greatly reducing the cost to call a go function compiled to webassembly. At first it worked great, but then I noticed it failing whenever it needed to grow the stack. I also notice that if you just call
runtime.GC
, similar bad stuff happens.Consider the following program:
You can compile this program like:
GOOS=wasip1 GOARCH=wasm gotip build -buildmode=c-shared -o test.wasm ./test_wasm.go
Then you can have a runner program like:
which can be run with
go run ./main.go
go run ./main.go
What did you see happen?
I saw the runtime crash inside wasm, see output. I'll note that in my initial issue, I was not calling
runtime.GC
, I just happened to see similar failures inside things likegrowstack
and background gc assist. I also noticed that if I add a return value to the entrypoint function, the problems seem to go away.What did you expect to see?
I expected to not see it crash.
The text was updated successfully, but these errors were encountered: