STINNER Victor added the comment: 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/base_events.py: # 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 ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30319> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com