Message343389
Currently asyncio uses `loop.call_exception_handler()` for logging *fatal* exceptions from underlying sockets before calling protocol.connection_lost().
There is a list of exceptions that are not logged: BrokenPipeError,
ConnectionResetError, ConnectionAbortedError
Later ssl.SSLCertVerificationError was added.
There is a request to skip TimeoutError as well: #34148
aiohttp has a bug report about logging SSLError: https://github.com/aio-libs/aiohttp/issues/3535
I am pretty sure that the network subsystem can raise other exceptions that users don't want to see in logs.
I suggest changing suppression logic to skip logging of *all* OSError exceptions and eliminate _FATAL_ERROR_IGNORE list.
OSError is a sign of communication over network to peer, these problems cannot be avoided by fixing a program logic.
All other exceptions are indicators for programming errors, the user's source code should be fixed to get rid of such problems (e.g. AttributeError raised by protocol callback etc). Logging non-OSErrors is pretty nice and desired feature.
Note, the list now contains OSError derived exceptions only, both TimeoutError and SSLError falls into this category too.
Not-logged exceptions are not skipped but reported to the user by protocol.connection_lost(exc) callback.
User code can (and should) handle them properly.
The fix is very simple, and don't change application logic.
It can be backported to 3.7 as well. |
|
Date |
User |
Action |
Args |
2019-05-24 14:32:57 | asvetlov | set | recipients:
+ asvetlov, yselivanov |
2019-05-24 14:32:57 | asvetlov | set | messageid: <1558708377.15.0.222546736903.issue37035@roundup.psfhosted.org> |
2019-05-24 14:32:57 | asvetlov | link | issue37035 messages |
2019-05-24 14:32:56 | asvetlov | create | |
|