Author gregory.p.smith
Recipients christian.heimes, gregory.p.smith, sbt, twouters
Date 2012-11-20.00:13:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAGE7PNKo5RZW+6Mgt51z0xoZvq8ymsaC-R+Q+F327mC4nzASdw@mail.gmail.com>
In-reply-to <CAGE7PN+tS3WL89qcmSG2-899dY3T3NKUrzRXjAfMqjKkdGzLBw@mail.gmail.com>
Content
pthread_atfork() cannot be used to implement this. Another non-python
thread started by a C extension module or the C application that is
embedding Python within it is always free to call fork() on its own with
zero knowledge that Python even exists at all. It's guaranteed that fork
will be called while the Python GIL is held in this situation which would
cause any pre-fork thing registered by Python to deadlock.

At best, this can be implemented manually as we do with some of the before
and after fork stuff today but it must come with the caveat warning that it
cannot guarantee that these things are actually called before and after
fork() other than direct os.fork() calls from Python code or extremely
Python aware C extension modules that may call fork() (very rare, most C &
C++ libraries an extension module may be using assume that they've got the
run of the house).  ie: this problem is unsolvable unless you control 100%
of the code being used by your entire user application.

On Mon, Nov 19, 2012 at 3:59 PM, Gregory P. Smith <report@bugs.python.org>wrote:

>
> Gregory P. Smith added the comment:
>
> I would not allow exceptions to propagate. No caller is expecting them.
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue16500>
> _______________________________________
>
History
Date User Action Args
2012-11-20 00:13:31gregory.p.smithsetrecipients: + gregory.p.smith, twouters, christian.heimes, sbt
2012-11-20 00:13:31gregory.p.smithlinkissue16500 messages
2012-11-20 00:13:30gregory.p.smithcreate