Uh oh!
There was an error while loading. Please reload this page.
gh-140746: Fix Thread.start() that can hang indefinitely (alternative to GH-140799) - #144750
gh-140746: Fix Thread.start() that can hang indefinitely (alternative to GH-140799)#144750YvesDup wants to merge 19 commits into
Conversation
brijkapadia
left a comment
There was a problem hiding this comment.
Left a couple of small comments on semantics.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
ryv-odoo
left a comment
There was a problem hiding this comment.
Hello @YvesDup ,
Now I understand what you meant in your comment 😄. Sorry I certainly misunderstood your comment at the time.
This version changes the behavior slightly from mine: The serving thread (aka the one who call start() on the new Thread) will crash (raise an exception) because of an error raised from the new Thread.
I am not a huge fan of this change because it means that the serving thread might not recover from it (and I feel that errors from sub thread shouldn't impact the parent Thread). But I don't have a strong opinion about it 🤔
I will apply the comments of @bkap123 in my branch since they mainly target my code.
Have a nice day.
Uh oh!
There was an error while loading. Please reload this page.
YvesDup
commented
Feb 25, 2026
Hi @ryv-odoo , In this PR, it is possible to wait in C and just cleans up the two dicts in the I proposed raising an exception because I would notify the devs that the new thread starts fine but fails before calling the |
rename bootstrapped => running remove "is_failed" method of ThreadHandle
Uh oh!
There was an error while loading. Please reload this page.
Fix threading.Thread.start to prevent indefinite hangs due to heap memory exhaustion and add a new FAILED state.
This PR is based on the @ryv-odooPR. I would have preferred to start from @ryv-odoo's PR branch rather than duplicating his code, but I don't know if that's possible.
Following the @colesburycomment,
I submit this PR that includes the waiting in C the module and raise a runtime exception when the thread handle state is set to failed. This exception is treated in the
Thread.start.