diff options
author | Petr Viktorin <encukou@gmail.com> | 2024-11-13 09:25:10 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-13 09:25:10 (GMT) |
commit | ba088c8f9cf7163b0f28c507cb1343befe21997e (patch) | |
tree | d22735706db59196f6cbf45d1566815279dc2801 /Misc/NEWS.d | |
parent | 1e40c5ba47780ddd91868abb3aa064f5ba3015e4 (diff) | |
download | cpython-ba088c8f9cf7163b0f28c507cb1343befe21997e.zip cpython-ba088c8f9cf7163b0f28c507cb1343befe21997e.tar.gz cpython-ba088c8f9cf7163b0f28c507cb1343befe21997e.tar.bz2 |
gh-71936: Fix race condition in multiprocessing.Pool (GH-124973)
* gh-71936: Fix race condition in multiprocessing.Pool
Proxes of shared objects register a Finalizer in BaseProxy._incref(), and it
will call BaseProxy._decref() when it is GCed. This may cause a race condition
with Pool(maxtasksperchild=None) on Windows.
A connection would be closed and raised TypeError when a GC occurs between
_ConnectionBase._check_writable() and _ConnectionBase._send_bytes() in
_ConnectionBase.send() in the second or later task, and a new object
is allocated that shares the id() of a previously deleted one.
Instead of using the id() of the token (or the proxy), use a unique,
non-reusable number.
Co-Authored-By: Akinori Hattori <hattya@gmail.com>
Diffstat (limited to 'Misc/NEWS.d')
-rw-r--r-- | Misc/NEWS.d/next/Library/2022-10-15-10-18-20.gh-issue-71936.MzJjc_.rst | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2022-10-15-10-18-20.gh-issue-71936.MzJjc_.rst b/Misc/NEWS.d/next/Library/2022-10-15-10-18-20.gh-issue-71936.MzJjc_.rst new file mode 100644 index 0000000..a0959cc --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-10-15-10-18-20.gh-issue-71936.MzJjc_.rst @@ -0,0 +1 @@ +Fix a race condition in :class:`multiprocessing.pool.Pool`. |