Skip to content

SetMaxWasmStack fails with async_stack_size error #182

@guregu

Description

@guregu

As mentioned in bytecodealliance/wasmtime#6762. I figure it's better to discuss wasmtime-go stuff here.

Currently doing this:

cfg := wasmtime.NewConfig()
cfg.SetMaxWasmStack(8388608)
engine := wasmtime.NewEngineWithConfig(cfg) // panics

Fails with this message:

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: max_wasm_stack size cannot exceed the async_stack_size', crates/c-api/src/engine.rs:33:38
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5
SIGABRT: abort
PC=0x198cf4724 m=0 sigcode=0
signal arrived during cgo execution

goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x104609b88, 0x14000133c38)
	/opt/homebrew/Cellar/go/1.20.5/libexec/src/runtime/cgocall.go:157 +0x54 fp=0x14000133c00 sp=0x14000133bc0 pc=0x10438be14
github.com/bytecodealliance/wasmtime-go/v11._Cfunc_wasm_engine_new_with_config(0x153804340)
	_cgo_gotypes.go:1016 +0x38 fp=0x14000133c30 sp=0x14000133c00 pc=0x1044c0b78
github.com/bytecodealliance/wasmtime-go/v11.NewEngineWithConfig.func1(0x153804340?)
	/Users/guregu/go/pkg/mod/github.com/bytecodealliance/wasmtime-go/[email protected]/engine.go:33 +0x54 fp=0x14000133c70 sp=0x14000133c30 pc=0x1044c2ee4
github.com/bytecodealliance/wasmtime-go/v11.NewEngineWithConfig(0x140000161f0)
	/Users/guregu/go/pkg/mod/github.com/bytecodealliance/wasmtime-go/[email protected]/engine.go:33 +0x28 fp=0x14000133cb0 sp=0x14000133c70 pc=0x1044c2df8
github.com/trealla-prolog/go/trealla.init.0()
	/Users/guregu/code/trealla/go/trealla/wasm.go:31 +0x84 fp=0x14000133cf0 sp=0x14000133cb0 pc=0x1045fb704
runtime.doInit(0x105737ca0)
       ...

This led to me trying to set the async_stack_size, noticing it was missing from C API, and the wasmtime PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions