mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-11-24 22:38:02 -05:00
join_non_daemon_threads() runs the threading exit hooks on a daemon thread and gives up on it at the deadline. A later call started a new hook thread and returned 0 without waiting for the old one, so shutdown() could run Py_Finalize while the old thread was still running the hooks. Python then stops that daemon thread when it reaches for the GIL; it unwinds through the hook lambda and releases a Python list without the GIL while finalization's garbage collection walks it, which crashes the process. A call now first waits, within its deadline, for a hook thread an earlier call left running, and counts it as still running if it does not end, so shutdown() leaves the interpreter unfinalized instead. This was the intermittent segfault at exit of the "ends idle concurrent.futures workers" test, which calls the function more than once. The app calls it once, from shutdown().
OrcaSlicer tests
Building, running and writing tests is documented on the wiki, under How to Test.
Two files here rather than there, because coding agents only read what is in the repository: