[New-bugs-announce] [issue31913] forkserver could warn if several threads are running

Antoine Pitrou report at bugs.python.org
Tue Oct 31 14:12:26 EDT 2017

New submission from Antoine Pitrou <pitrou at free.fr>:

I'm not sure this is worth handling, but I had an interaction with a user who had weird deadlock problems in a glibc function (getaddrinfo) in worker processes launched with the forkserver method.

The explanation turned out to be that a sitecustomize.py did some stuff that eventually launched a helper thread, and that made the forkserver process's forking fundamentally unsafe (fork() is guaranteed to be safe if there's only one thread running in the parent process).

It would be easy to check that threading.enumerate() returns only one thread, and otherwise warn the user about it.  Note this only handles Python threads and not C threads invisible to Python... (a more complete solution would involve psutil :-)).

components: Library (Lib)
messages: 305323
nosy: davin, gregory.p.smith, pitrou
priority: low
severity: normal
status: open
title: forkserver could warn if several threads are running
type: enhancement
versions: Python 3.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list