Python bindings crashing
Python bindings are sometimes crashing in a strange manner. For the record, here are two failing tests. Both tests are designed for the platform small_platform_fatpipe.xml.
async-wait.py async-wait_d.xml
corrupt-stack.py corrupt-stack_d.xml
For the first one (async-wait.py), a heavy operation is added after e.run() (here, it's "import gc"). Note that the failure only occurs when the actor "sender" starts first, and the scheduling is interlaced: sender starts, receiver starts, sender terminates, receiver terminates.
For the second test (corrupt-stack.py), an intricate recursion is used to make the crash happen.
I failed to understand the cause of the bug, but I suspect that the Python interpreter is not advised of the context switches, and that it mess up its call stacks.
Maybe we need to use pybind11::gil_scoped_acquire
and/or pybind11::gil_scoped_release
. In pybind11.h, a link to NanoGUI (http://github.com/wjakob/nanogui) is given for an example of thread migration.