Turn off logging.logThreads when monkey-patched

We've seen proxy-servers lock up while trying to log client disconnects.
The trouble is that we happen to do this while we're *already*
trying to log *something else*. If the timing works out particularly
badly, we end up with a double-call to (an eventlet-patched)
threading.current_thread(), which needs to enumerate all pthreads, which
uses a non-re-entrant lock in CPython.

The most expedient solution seems to be disabling logThreads so we never
call threading.current_thread().

Change-Id: Ida9418a1bd30ed300a8a850cda567d60c9889ec7
Closes-Bug: #1895739
This commit is contained in:
Tim Burke 2020-09-17 17:41:03 -07:00
parent 4b2d8c2258
commit 86b966d950

View File

@ -554,6 +554,9 @@ def eventlet_monkey_patch():
# if thread is monkey-patched.
eventlet.patcher.monkey_patch(all=False, socket=True, select=True,
thread=True)
# Trying to log threads while monkey-patched can lead to deadlocks; see
# https://bugs.launchpad.net/swift/+bug/1895739
logging.logThreads = 0
def noop_libc_function(*args):