[issue39763] Hang after fork due to logging trying to reacquire the module lock in an atfork() handler

2020-02-26 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

Note the original problem stems when you using "setup.py -j ".

The attached reproducer is a bit of a red herring, because indeed doing fork() 
+ exec() in pure Python is too fragile.  That is why the standard subprocess 
does it in C.  The problem here is that the `distutils.spawn` module still has 
its hand-baked fork() + exec() pure Python code from the 1990s.

So the solution to the OP's actual problem should be to recode 
`distutils.spawn` using the subprocess module.

Original mailing-list discussion at:
https://mail.python.org/archives/list/python-...@python.org/thread/PTJ3UAZNYBYBYQ4WLMSERZR2XIVWISLM/

--
type:  -> behavior
versions: +Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39763] Hang after fork due to logging trying to reacquire the module lock in an atfork() handler

2020-02-26 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy: +gvanrossum, pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39763] Hang after fork due to logging trying to reacquire the module lock in an atfork() handler

2020-02-26 Thread Elad Lahav


New submission from Elad Lahav :

The attached code causes the child processes to hang on QNX. The hang is caused 
by the logging module trying to acquire the module lock while in an atfork() 
handler. In a system where semaphore state is kept in user mode and is thus 
inherited from the parent on fork() the semaphore may appear to have a value of 
0, and thus will never be posted to in the single-threaded child.
I don't know how it works on other systems - may be pure chance.

--
components: Library (Lib)
files: fork_mt.py
messages: 362717
nosy: Elad Lahav
priority: normal
severity: normal
status: open
title: Hang after fork due to logging trying to reacquire the module lock in an 
atfork() handler
versions: Python 3.8
Added file: https://bugs.python.org/file48917/fork_mt.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com