Open guregu opened 1 year ago
Hmm, looks like there's a 1MB (maybe 2MB?) stack size limit by default: https://github.com/bytecodealliance/wasmtime/issues/900 This would explain a lot... the Trealla wasm build uses a 8MB stack. There's no way to set this size yet for wasmtime-go so I will add it then fix this. Pretty surprising it doesn't read the stack size from the binary.
This should take care of it: https://github.com/bytecodealliance/wasmtime-go/pull/180
Hmm... it looks like it's more complex than I thought. wasmtime divides the stack space every time a guest -> host -> guest (reentrant?) call happens Even with the larger stack, if there's more than 2 or so reentrant queries happening the stack just becomes too small. This can be worked around by calling Clone() on the instance passed to the native predicate, but incurs an overhead. It might be possible to avoid this with a more complex locking system but probably not worth it.
Works ok on macOS+arm64 so probably something weird going on. This is running in a VM though.