You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow multiprocessing finalizers to run on a separate thread #109978
The multiprocessing library allows finalizers to be attached to specific objects, so as to release system resources. These finalizers may have non-trivial code that rely on and alter global state.
Unfortunately, since mainline code can be interrupted at any time by the GC, there can be rare reentrancy issues with such non-trivial finalizers, such as in gh-109593.
Ideally, we would run such finalizers in a separate thread rather than from inside the GC.
Ok, I gave it a try... but, of course, the problem is that fork wreaks havoc with threads, and of course it's difficult to test multiprocessing (or concurrent.futures) without making a lot of calls to fork.
Activity
pitrou commentedon Sep 27, 2023
@vstinner FYI
pitrou commentedon Sep 27, 2023
@iritkatriel @pablogsal IIRC you tried to work on PEP 556 before.
pitrou commentedon Oct 7, 2023
Ok, I gave it a try... but, of course, the problem is that
forkwreaks havoc with threads, and of course it's difficult to testmultiprocessing(orconcurrent.futures) without making a lot of calls tofork.:-D
pythonGH-109978: Allow multiprocessing finalizers to run on a separat…
pythonGH-109978: Allow multiprocessing finalizers to run on a separat…