This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author asvetlov
Recipients asvetlov, yselivanov
Date 2019-05-24.14:32:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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:

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:57asvetlovsetrecipients: + asvetlov, yselivanov
2019-05-24 14:32:57asvetlovsetmessageid: <>
2019-05-24 14:32:57asvetlovlinkissue37035 messages
2019-05-24 14:32:56asvetlovcreate