Title: semaphore_tracker is not reused by child processes
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.8
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: davin, pitrou, tomMoral
Priority: normal Keywords: patch

Created on 2019-04-19 13:44 by tomMoral, last changed 2019-04-24 19:46 by pitrou. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 5172 merged tomMoral, 2019-04-19 13:44
Messages (2)
msg340543 - (view) Author: Thomas Moreau (tomMoral) * Date: 2019-04-19 13:44
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.
msg340804 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2019-04-24 19:46
New changeset 004b93ea8947bcbe85b6fa16fe0999bfa712d5c1 by Antoine Pitrou (Thomas Moreau) in branch 'master':
bpo-36668: FIX reuse semaphore tracker for child processes (#5172)
Date User Action Args
2019-04-24 19:46:31pitrousetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-04-24 19:46:16pitrousetmessages: + msg340804
2019-04-19 14:02:35SilentGhostsetnosy: + pitrou, davin
2019-04-19 13:44:23tomMoralsetkeywords: + patch
stage: patch review
pull_requests: + pull_request12805
2019-04-19 13:44:01tomMoralcreate