Skip to content

Commit c8ab6ee

Browse files
committed
Issue #11444: Lock handlers while flushing/closing during shutdown.
1 parent 49d7149 commit c8ab6ee

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

Lib/logging/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,12 +1507,15 @@ def shutdown(handlerList=_handlerList):
15071507
#errors might occur, for example, if files are locked
15081508
#we just ignore them if raiseExceptions is not set
15091509
try:
1510+
h.acquire()
15101511
h.flush()
15111512
h.close()
15121513
except:
15131514
if raiseExceptions:
15141515
raise
15151516
#else, swallow
1517+
finally:
1518+
h.release()
15161519

15171520
#Let's try and shutdown automatically on application exit...
15181521
try:

0 commit comments

Comments
 (0)