Closed flaki closed 1 year ago
Thanks for reporting this.
So, I tried testing with the interpreter from libpython (via Py_BytesMain). Still seeing the same weird memory allocation or deallocation behavior - failures are consistent, but different depending on which modules you try to import.
I am debugging ...
So, this turns out to be a stack overflow. What got me off the proper trail is that we were getting these errors in python memory operations. The fix is to simply build the wasm module with a bigger stack. E.g. 512K, as they do in Python.wasm. Just passing this to the linker will suffice
-Wl,-z,stack-size=524288
Describe the bug
The following affects the experimental runtime wrapper of the
bindings
branch.Whenever
py-plugin/plugin.py
imports any built-ins (tested withre
,string
,enum
), the code will fail during runtime with a "memory access out of bounds" style error.Reproduction steps
import "string"
at the top of "py-plugin/plugin.py"/run-e2e.sh
)Expected behavior
The wrapper script should be able to import built-in modules. In fact the mainline Wasm-ified Python interpreter imports modules just fine.
Additional context
Example of the runtime error with the displayed backtrace:
When discussed with @assambar he reports that this reproduces, albeit only seems to happen for toplevel imports.