Hacker News new | ask | show | jobs
by elnatro 664 days ago
Thanks, I’m not an embedded developer and was losing the train of thought of the author.
1 comments

These threading issues may also be present when not using embedding. Embedding the interpreter frequently shows general threading bugs much quicker.

In other words, when "torturing" the interpreter with embedding a threading bug might show up after 30 min. The same threading bug might show up once every 6 months in a web server (which is a nasty security risk, since it is hard to detect and to reproduce).

Ouch. So we (app developers) are doomed with this feature?
I did open an issue on GitHub with the CPython implementation and it's being looked into. The crash happens for sure in the debug version of Python. However we're seeing valgrind and address sanitizer fire off for the upcoming 3.13 release in release mode when using the C API as I showed in my example. However, this behavior only appears to occur when embedding python directly, not via extending it, into an application. Because of how the (hidden because it is experimental) `_xxsubinterpreters` module works internally, it's extra internal bookkeeping seems to give enough time for the race condition to disappear.