Skip to content

Commit

Permalink
Fix error in test suite teardown
Browse files Browse the repository at this point in the history
The error seen was:

Exception ignored in atexit callback: <bound method DeferredStreamHandler.flush of <DeferredStreamHandler <_io.FileIO [closed]> (WARNING)>>
Traceback (most recent call last):
  File "/home/dan/src/salt/salt/_logging/handlers.py", line 68, in flush
    super().flush()
  File "/usr/local/lib/python3.10/logging/__init__.py", line 1084, in flush
    self.stream.flush()
ValueError: I/O operation on closed file.
  • Loading branch information
dwoz committed Sep 23, 2024
1 parent b6e3f9b commit cc4d628
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion salt/_logging/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ def flush(self):
super().handle(record)
finally:
self.__emitting = False
super().flush()
# Seeing an exception from calling flush on a closed file in the test
# suite. Handling this condition for now but this seems to be
# indicitive of an un-clean teardown at some point.
if not self.stream.closed:
super().flush()

def sync_with_handlers(self, handlers=()):
"""
Expand Down

0 comments on commit cc4d628

Please sign in to comment.