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 hniksic
Recipients hniksic
Date 2018-08-26.07:44:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1535269470.94.0.56676864532.issue34506@psf.upfronthosting.co.za>
In-reply-to
Content
When an SSL handshake fails in asyncio, an exception traceback is logged to standard error even if the application code catches the exception. This logging cannot be suppressed, except by providing a custom exception handler for the whole event loop. The question was raised on StackOverflow in https://stackoverflow.com/q/52012488/1600898

To reproduce the issue, run the attached minimal example (taken from the SO question). Expected behavior is for "Error handled" to be printed. Actual behavior is that, in addition to that line, two tracebacks are printed.

It looks like a bug that _fatal_error both logs the exception and calls connection_lost on the protocol (through transport._force_close()). If the idea is for the exception not to get swallowed by protocols that don't implement a sensible connection_lost (e.g. because they've just inherited from BaseProtocol, like the echo server examples), then maybe a protocol that propagates the exception in connection_lost should be able to opt out of the additional logging. That way the stream protocols would avoid spurious output for the suppressed exception by default, and the same opt-out mechanism would be available to user-written protocols.
History
Date User Action Args
2018-08-26 07:44:30hniksicsetrecipients: + hniksic
2018-08-26 07:44:30hniksicsetmessageid: <1535269470.94.0.56676864532.issue34506@psf.upfronthosting.co.za>
2018-08-26 07:44:30hniksiclinkissue34506 messages
2018-08-26 07:44:30hniksiccreate