bpo-36479: Exit threads when interpreter is finalizing rather than runtime#12679
bpo-36479: Exit threads when interpreter is finalizing rather than runtime#12679nanjekyejoannah wants to merge 2 commits into
Conversation
Sorry, something went wrong.
a132f03 to
68bc067
Compare
April 25, 2019 17:19
607a345 to
b8a1690
Compare
April 25, 2019 22:25
5f145b3 to
a19bbd4
Compare
May 5, 2019 16:16
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Sorry, something went wrong.
ncoghlan
left a comment
There was a problem hiding this comment.
Blocking merge as per https://bugs.python.org/issue36479#msg341882 (we need to actively constrain the cleanup to daemon threads created by the interpreter being cleaned up, and simply report an error to other threads)
Sorry, something went wrong.
I don't understand what is "runtime" here. _PyRuntimeState doesn't contain threads: PyInterpreterState does. IMHO the field should be moved from _PyRuntimeState to PyInterpreterState. Right now, Py_EndInterpreter() doesn't call Py_FinalizeEx(): but that's wrong. To really have isolated interpreter, each interpreter should clear everything it owns. For example, each interpreter should join all threads that it spawned. |
Sorry, something went wrong.
|
@vstinner However, I also agree that for this PR to work there needs to be a new field in the individual interpreter state that tracks which thread is cleaning up that particular interpreter. And then once we have that per-interpreter field and are using it consistently, then we can ask if we still need a separate runtime level "finalizing" marker, or if the finalizing marker for the main interpreter will be sufficient (which will mean addressing the fact that |
Sorry, something went wrong.
|
Closing this for now. I may revisit in the future in a new PR. Anyone else can look at this. |
Sorry, something went wrong.
I have added changes to exit threads when the interpreter is finalizing.
I have halted to update this until PR until GH-12667 is merged.
https://bugs.python.org/issue36479