Author haypo
Recipients alex, christian.heimes, dstufft, haypo, janssen, martin.panter, pitrou
Date 2017-07-04.11:45:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I propose to ignore ECONNRESET in socket.close() and ENOTCONN and WSAEINVAL on socket.shutdown(). If we see more failures later, we can extend these lists.

asyncore also ignores ENOTCONN on socket.close(), but I don't trust this module at this point: it seems like asyncore also handles pipes, not only socket.socket.

Errors seen on buildbots:

* ECONNRESET (ConnectionResetError) on socket.close()
* ENOTCONN and WSAEINVAL on socket.shutdown() -- that's why I ignored these errors in poplib and imaplib

The Python standard library already ignores some errors on socket.shutdown() and socket.close() depending on the module:

* poplib, imaplib: ignore ENOTCONN and WSAEINVAL on socket.shutdown()

* asyncore: ignore ENOTCONN and EBADF on socket.close(). asyncore ignores much more errors on functions doing read, write or close (depending on the received event): ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED, EPIPE, EBADF. In a function doing read+close, it says "winsock sometimes raises ENOTCONN".

* asyncio: don't log a fatal error for EPIPE, ESHUTDOWN, ECONNRESET, ECONNABORTED errors. Lib/asyncio/

# Exceptions which must not call the exception handler in fatal error
# methods (_fatal_error())
_FATAL_ERROR_IGNORE = (BrokenPipeError, ConnectionResetError, ConnectionAbortedError)

Mapping of exceptions to error codes:

* BrokenPipeError: EPIPE, ESHUTDOWN
* ConnectionResetError: ECONNRESET
* ConnectionAbortedError: ECONNABORTED
Date User Action Args
2017-07-04 11:45:36hayposetrecipients: + haypo, janssen, pitrou, christian.heimes, alex, martin.panter, dstufft
2017-07-04 11:45:36hayposetmessageid: <>
2017-07-04 11:45:36haypolinkissue30319 messages
2017-07-04 11:45:36haypocreate