summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathew Robinson <chasinglogic@gmail.com>2019-04-05 18:17:04 -0400
committerMathew Robinson <chasinglogic@gmail.com>2019-04-08 14:08:49 -0400
commit2db32e10f3e1e5aedb80703104fae838acfcf696 (patch)
tree0cee7885ab5f63c02486209ddff99827e415905a
parent415dfa9ec016d8a1e37d950adda64a17efc950c1 (diff)
downloadmongo-2db32e10f3e1e5aedb80703104fae838acfcf696.tar.gz
SERVER-40514 Fix race in Resmoke
-rw-r--r--buildscripts/resmokelib/logging/handlers.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/buildscripts/resmokelib/logging/handlers.py b/buildscripts/resmokelib/logging/handlers.py
index fecbde906fa..7a00dcac988 100644
--- a/buildscripts/resmokelib/logging/handlers.py
+++ b/buildscripts/resmokelib/logging/handlers.py
@@ -58,6 +58,7 @@ class BufferedHandler(logging.Handler):
self.__emit_buffer = []
self.__flush_event = None # A handle to the event that calls self.flush().
self.__flush_scheduled_by_emit = False
+ self.__close_called = False
self.__flush_lock = threading.Lock() # Serializes callers of self.flush().
@@ -119,7 +120,7 @@ class BufferedHandler(logging.Handler):
self.__flush(close_called=False)
with self.__emit_lock:
- if self.__flush_event is not None:
+ if self.__flush_event is not None and not self.__close_called:
# We cancel 'self.__flush_event' in case flush() was called by someone other than
# the flush thread to avoid having multiple flush() events scheduled.
flush.cancel(self.__flush_event)
@@ -149,6 +150,8 @@ class BufferedHandler(logging.Handler):
"""Flush the buffer and tidies up any resources used by this handler."""
with self.__emit_lock:
+ self.__close_called = True
+
if self.__flush_event is not None:
flush.cancel(self.__flush_event)