summaryrefslogtreecommitdiff
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:21:09 -0400
commit1a379e6d17fc344be69137cc16e8811f302af08c (patch)
tree7f716bc7a453bee29db8884ac69eb2e2d5f522d8
parente4d5ed2ed6f2f6f460b35f0aed39e5443c55fcea (diff)
downloadmongo-1a379e6d17fc344be69137cc16e8811f302af08c.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 c0a920f706d..cc463a1f836 100644
--- a/buildscripts/resmokelib/logging/handlers.py
+++ b/buildscripts/resmokelib/logging/handlers.py
@@ -50,6 +50,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().
@@ -113,7 +114,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)
@@ -150,6 +151,8 @@ class BufferedHandler(logging.Handler):
"""
with self.__emit_lock:
+ self.__close_called = True
+
if self.__flush_event is not None:
flush.cancel(self.__flush_event)