wasilibs/nottinygc

Getting integer divide by zero error

Closed this issue · 2 comments

Hello,
I was trying out this library with a WASM module written in Go and compiled with the -scheduler=asyncify TinyGo build option.

When running the WASM module with wasmtime the module exits with:

Caused by:
    0: failed to invoke command default
    1: error while executing at wasm backtrace:
           0: 0xa142 - <unknown>!GC_expand_hp_inner
           1: 0x10db3 - <unknown>!GC_init
           2: 0x1220b - <unknown>!GC_generic_malloc_inner
           3: 0x127b4 - <unknown>!GC_generic_malloc
           4: 0x12924 - <unknown>!GC_malloc
           5: 0x31050 - runtime.alloc
                           at ~/go/pkg/mod/github.com/wasilibs/nottinygc@v0.4.0/gc.go:53:6
           6: 0x53096 - <unknown>!runtime.run$1
           7: 0x52c5a - <goroutine wrapper>
                           at /usr/local/Cellar/tinygo/0.29.0/src/runtime/scheduler_any.go:23:2
           8: 0x12b84 - <unknown>!tinygo_launch
           9: 0x52b10 - (*internal/task.Task).Resume
                           at /usr/local/Cellar/tinygo/0.29.0/src/internal/task/task_asyncify.go:109:17              - runtime.scheduler
                           at /usr/local/Cellar/tinygo/0.29.0/src/runtime/scheduler.go:236:11              - runtime.run
                           at /usr/local/Cellar/tinygo/0.29.0/src/runtime/scheduler_any.go:28:11              - _start
                           at /usr/local/Cellar/tinygo/0.29.0/src/runtime/runtime_wasm_wasi.go:21:5
    2: wasm trap: integer divide by zero

TinyGo Version: 0.29.0 darwin/amd64 (using go version go1.20.1 and LLVM version 15.0.0)
nottinygc Version: v0.4.0

Any advice is much appreciated.

Hi @stoader - sorry but as the readme states, currently

Note that this library currently only works when the scheduler is disabled.

I think technically there shouldn't be an issue but I haven't been able to figure out what causes the issue when using a scheduler...

@anuraaga thx for the quick reply. I missed the note in the readme