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
semaphore_tracker is not reused by child processes #80849
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2019-04-24.19:46:31.192>created_at=<Date2019-04-19.13:44:01.381>labels= ['3.8', 'type-bug', 'library']
title='semaphore_tracker is not reused by child processes'updated_at=<Date2019-04-24.19:46:31.192>user='https://github.com/tomMoral'
The current implementation of the semaphore_tracker creates a new process for each children.
The easy fix would be to pass the _pid to the children but the current mechanism to check if the semaphore_tracker is alive relies on waitpid which cannot be used in child processes (the semaphore_tracker is only a sibling of these processes). The main issue is to have a reliable check that either:
The pipe is open. This is what is done here by sending a message. I don't know if there is a more efficient way to check it.
Check that a given pid is alive. As we cannot rely on waitpid, I don't see an efficient mechanism.
I propose to add a PROBE command in the semaphore tracker. When the pipe is closed, the send command will fail, meaning that the semaphore tracker is down.
New changeset 004b93e by Antoine Pitrou (Thomas Moreau) in branch 'master': bpo-36668: FIX reuse semaphore tracker for child processes (bpo-5172) 004b93e
Activity
tomMoral commentedon Apr 19, 2019
The current implementation of the semaphore_tracker creates a new process for each children.
The easy fix would be to pass the _pid to the children but the current mechanism to check if the semaphore_tracker is alive relies on waitpid which cannot be used in child processes (the semaphore_tracker is only a sibling of these processes). The main issue is to have a reliable check that either:
I propose to add a PROBE command in the semaphore tracker. When the pipe is closed, the send command will fail, meaning that the semaphore tracker is down.
pitrou commentedon Apr 24, 2019
New changeset 004b93e by Antoine Pitrou (Thomas Moreau) in branch 'master':
bpo-36668: FIX reuse semaphore tracker for child processes (bpo-5172)
004b93e
pythongh-146313: Fix ResourceTracker deadlock after os.fork()
gh-146313: Fix multiprocessing ResourceTracker deadlock after os.fork…
pythongh-146313: Fix multiprocessing ResourceTracker deadlock after o…
pythongh-146313: Fix multiprocessing ResourceTracker deadlock after o…
[3.14] gh-146313: Fix multiprocessing ResourceTracker deadlock after …
[3.13] gh-146313: Fix multiprocessing ResourceTracker deadlock after …
pythongh-146313: Fix multiprocessing ResourceTracker deadlock after o…