[issue36533] logging regression with threading + fork are mixed in 3.7.1rc2 (deadlock potential)

Gregory P. Smith report at bugs.python.org
Fri Apr 5 04:23:09 EDT 2019


Gregory P. Smith <greg at krypto.org> added the comment:

That custom DebugHandler's emit() implementation that calls into one or more sub-handlers suggests that libreswan _might_ be able to fix it in the custom DebugHandler by implementing custom acquire() and release() methods... BUT that is a fundamentally flawed problem: It requires acquiring multiple locks in a single atomic operation OR guaranteeing that they will always be acquired in a single specific order.

Given the logging module's fork-time code maintains no order, even implementing a custom acquire() and release() method in your custom DebugHandler would not be sufficient as sub-handler locks could be acquired first during fork.  also, that would be assuming your sub-handlers are not also used directly elsewhere within all possible coexisting logger configurations.

An implementable _gross workaround_ that libreswan or anything else in this boat could implement satisfying that constraint would be to force all potentially related handlers to share the same single RLock instance.  :(

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36533>
_______________________________________


More information about the Python-bugs-list mailing list