-
-
Notifications
You must be signed in to change notification settings - Fork 34.7k
Regression on multiprocessing’s resource tracker in 3.13 #140485
Copy link
Copy link
Closed
Labels
3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixes3.15pre-release feature fixes, bugs and security fixespre-release feature fixes, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-multiprocessingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Metadata
Metadata
Assignees
Labels
3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixes3.15pre-release feature fixes, bugs and security fixespre-release feature fixes, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-multiprocessingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
Done
Bug report
Bug description:
The resource tracker cleanup has a regression in 3.12.10 (was working 3.12.9, @colesbury found; it's possibly related to this PR).
This is a simple script to expose the problem. It creates a portion of shared memory, then forks. The child writes in that shared memory. The parent waits for the child to finish, reads the shared memory, do the proper cleanup, and then shows the result.
It works just fine in 3.12:
But after the regression:
Note that the script still ends “successfully”, but there is that
ChildProcessErrorin the middle. The weird thing is that the error happens when closing the resource tracker, when it doeswaitpid(self._pid), being that_pidthe process id of the tracker itself… it looks it finished before, so it’s gone at that moment.This is 100% reproducible in my machine (Ubuntu 24.04, kernel 6.8.0-79-generic, x86_64 architecture).
A workaround is to call SharedMemory with track=False, but in some cases that is not possible (e.g. when using ShareableList).
Probably the best to do there is just wrap it with a
try/except ChildProcessError: passlike the same code does in other corner.CPython versions tested on:
3.13, 3.14, 3.15, CPython main branch
Operating systems tested on:
Linux
Linked PRs