Commit df488237 authored by David Wilson's avatar David Wilson

core: fix race in PidfulStreamHandler

Need to re-test with the lock held, else >1 threads can end up waiting
for lock then reopening the log repeatedly.
parent a06c92d2
......@@ -219,6 +219,8 @@ class PidfulStreamHandler(logging.StreamHandler):
def _reopen(self):
self.acquire()
try:
if self.open_pid == os.getpid():
return
ts = time.strftime('%Y%m%d_%H%M%S')
path = self.template % (os.getpid(), ts)
self.stream = open(path, 'w', 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment