This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author neologix
Recipients benjamin.peterson, christian.heimes, georg.brandl, larry, neologix, pitrou, python-dev, r.david.murray, sbt, vstinner
Date 2013-10-21.12:50:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAH_1eM2vdcH9nye+Ki+g9YjpNyPaVvASEN2HEGF_i7ayhLCL3g@mail.gmail.com>
In-reply-to <1382292538.51.0.355167042617.issue19227@psf.upfronthosting.co.za>
Content
> Christian Heimes added the comment:
>
> I think it's more likely that my patch is triggering an existing bug. The locking code for the SSL module and OpenSSL doesn't release locks on fork. I have attached an experimental patch that unlocks all locks in the client.

The problem is that this patch can make it even more deadlock-prone:
pthread_mutex_unlock() isn't async-signal safe (it's not just theory:
depending on the implementation, I've seen it deadlock on some
platforms, even on Linux IIRC).

Also, there's another problem with the approach of "unlocking locks in
the child process": locks are usually used to protect critical
sections, i.e. sections of code where an invariant must be preserved
between entry and exit: by merely unlocking the locks in the child
process, we can - maybe, see above - prevent deadlocks, but the data
protected by those locks can very-well be left in an inconsistent
state. So we might be trading a deadlock for a non-functional ssl
library in the child process, which would be - from a security POV -
even worse.

Really, adding fork-hooks is a bad idea: unfortunately, I don't have
anything better to suggest :-(.

Except maybe adding an add-hoc hook to posix_fork(), like the ones
used to reset the GIL, threading module etc: at least, it will not
make the interpreter less safe than now, and won't be able to deadlock
processes that are conform and use subprocess to create processes...
History
Date User Action Args
2013-10-21 12:50:45neologixsetrecipients: + neologix, georg.brandl, pitrou, vstinner, larry, christian.heimes, benjamin.peterson, r.david.murray, python-dev, sbt
2013-10-21 12:50:45neologixlinkissue19227 messages
2013-10-21 12:50:45neologixcreate