cpython/Lib/multiprocessing
Petr Viktorin ba088c8f9c
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>
2024-11-13 10:25:10 +01:00
..
dummy bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-13700) 2019-06-01 11:00:15 +03:00
__init__.py
connection.py gh-121313: multiprocessing: simplify by increasing the connection buffer size to 64KiB (GH-123559) 2024-09-02 20:32:38 -07:00
context.py gh-84559: Change the multiprocessing start method default to forkserver (GH-101556) 2024-09-26 16:57:19 -07:00
forkserver.py gh-117378: Fix multiprocessing forkserver preload sys.path inheritance. (GH-126538) 2024-11-09 23:01:32 +00:00
heap.py
managers.py gh-71936: Fix race condition in multiprocessing.Pool (GH-124973) 2024-11-13 10:25:10 +01:00
pool.py gh-109649: Use os.process_cpu_count() (#110165) 2023-10-01 03:14:57 +02:00
popen_fork.py gh-83856: Honor atexit for all multiprocessing start methods (GH-114279) 2024-05-03 11:45:46 -07:00
popen_forkserver.py bpo-36888: Add multiprocessing.parent_process() (GH-13247) 2019-05-20 21:37:05 +02:00
popen_spawn_posix.py bpo-36888: Add multiprocessing.parent_process() (GH-13247) 2019-05-20 21:37:05 +02:00
popen_spawn_win32.py gh-118293: Suppress mouse cursor feedback when launching Windows processes with multiprocessing (GH-118315) 2024-04-28 21:10:44 +00:00
process.py gh-83856: Honor atexit for all multiprocessing start methods (GH-114279) 2024-05-03 11:45:46 -07:00
queues.py gh-71052: Enable test_concurrent_futures on platforms that lack multiprocessing (gh-115917) 2024-02-25 11:38:18 -08:00
reduction.py
resource_sharer.py gh-101225: Increase the socket backlog when creating a multiprocessing.connection.Listener (#113567) 2024-01-13 10:48:33 +01:00
resource_tracker.py gh-104090: Add exit code to multiprocessing ResourceTracker (GH-115410) 2024-02-21 13:54:57 +01:00
shared_memory.py gh-121288: Make error message for index() methods consistent (GH-121395) 2024-07-05 10:50:45 -07:00
sharedctypes.py
spawn.py More actionable error message when spawn is incorrectly used. (#102203) 2023-08-15 18:03:45 -07:00
synchronize.py gh-125679: multiprocessing Lock and RLock - fix invalid representation string on MacOSX. (#125680) 2024-11-07 08:10:57 +00:00
util.py gh-125620: Remove unnecessary import of subprocess in spawnv_passfds (#125624) 2024-10-16 22:42:29 +00:00