summaryrefslogtreecommitdiff
path: root/buildscripts/resmokelib
diff options
context:
space:
mode:
authorMathew Robinson <chasinglogic@gmail.com>2019-04-05 18:17:04 -0400
committerMathew Robinson <chasinglogic@gmail.com>2019-05-01 12:20:42 -0400
commitb67e3c53ea2be50c8ecdc27e1499604ee98d445c (patch)
treeec85ad523cd35685f4c50463cb199649b0ab4b5b /buildscripts/resmokelib
parent6a71c575a907af7af297f94401aea727ab28bd43 (diff)
downloadmongo-b67e3c53ea2be50c8ecdc27e1499604ee98d445c.tar.gz
SERVER-40514 Fix race in Resmoke
Diffstat (limited to 'buildscripts/resmokelib')
-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 d67bf13f724..cff5793392c 100644
--- a/buildscripts/resmokelib/logging/handlers.py
+++ b/buildscripts/resmokelib/logging/handlers.py
@@ -60,6 +60,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().
@@ -121,7 +122,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)
@@ -151,6 +152,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)