Open
Description
Bug report
Python 3.10.5
While running FastAPI (Uvicorn) and the SysLogHandler. The Socket if using a TCP stream is being closed after the first message, causing all additional messages to fail stating OSError10083. In looking through the SysLogHandler code I was able to add a try/except that solved the issue by opening a new socket if the current is found to be closed.
Lines 990/991:
else:
self.socket.sendall(msg)
I changed to:
else:
try:
self.socket.sendall(msg)
except OSError:
with socket.create_connection(self.address) as s:
s.sendall(msg)
Your environment
Python 3.10
- CPython versions tested on: 3.10
- Operating system and architecture: Windows 10