From: Vinay Sajip Date: Tue, 8 Mar 2011 22:39:55 +0000 (+0000) Subject: Issue #11444: Lock handlers while flushing/closing during shutdown. X-Git-Tag: v2.6.7~16 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f4d0af460a279859b75c11500f14d14a1b29ee79;p=python Issue #11444: Lock handlers while flushing/closing during shutdown. --- diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index b48bee85bd..a3b3e391ec 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -1513,12 +1513,15 @@ def shutdown(handlerList=_handlerList): #errors might occur, for example, if files are locked #we just ignore them if raiseExceptions is not set try: + h.acquire() h.flush() h.close() except: if raiseExceptions: raise #else, swallow + finally: + h.release() #Let's try and shutdown automatically on application exit... try: