-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add missing "is_alive" checks before acquiring the GIL in destructors. #894
base: master
Are you sure you want to change the base?
Conversation
Could you add a changelog as well? |
Done. We'll see whether that is sufficient … |
After some more thought, I don't think that this really fixes the issue. While |
That is true in general. But what happens when the Python program throws an uncaught exception or otherwise ends abnormally, or simply is signalled to end? I'm not concerned with preventing a 0.1% chance of a hard coredump and whatnot due to a race condition in this case. I'm concerned with preventing a 100% chance of getting one. |
By having a condition variable, mutex, or similar synchronization mechanism, you can guarantee that the right order is enforced during shutdown. If the application is killed, then the kernel will shut things down and none of this code will run at all. A crash that happens in 0.1% of runs is super annoying because it is so hard to reproduce. I would rather have software fail spectacularly than accumulate lots of issues in the long tail. |
On the other hand, in a program that does have mutexes and whatnot, this issue raises its ugly head only when an abnormal situation happens. In that case it transforms a reasonably-clean stacktrace and debug dump into an inconsistent ugly mess. Been there done that; with this patch applied I can at least get out of my debugging session without crashing or having to resort to "kill -9". |
cf. #891