Connection errors can also trigger OSError
cjrh opened this issue · 3 comments
Unexpected error
Traceback (most recent call last):
File "C:\Users\caleb\temp\testaiorun\aiomsg\__init__.py", line 202, in connect_with_retry
await new_connection()
File "C:\Users\caleb\temp\testaiorun\aiomsg\__init__.py", line 186, in new_connection
hostname, port, loop=self.loop, ssl=ssl_context
File "G:\Programs\Python37\lib\asyncio\streams.py", line 77, in open_connection
lambda: protocol, host, port, **kwds)
File "G:\Programs\Python37\lib\asyncio\base_events.py", line 968, in create_connection
', '.join(str(exc) for exc in exceptions)))
OSError: Multiple exceptions: [Errno 10061] Connect call failed ('::1', 25001, 0, 0), [Errno 10061] Conn
ect call failed ('127.0.0.1', 25001)
Unexpected error
Traceback (most recent call last):
File "C:\Users\caleb\temp\testaiorun\aiomsg\__init__.py", line 202, in connect_with_retry
await new_connection()
File "C:\Users\caleb\temp\testaiorun\aiomsg\__init__.py", line 186, in new_connection
hostname, port, loop=self.loop, ssl=ssl_context
File "G:\Programs\Python37\lib\asyncio\streams.py", line 77, in open_connection
lambda: protocol, host, port, **kwds)
File "G:\Programs\Python37\lib\asyncio\base_events.py", line 968, in create_connection
', '.join(str(exc) for exc in exceptions)))
OSError: Multiple exceptions: [Errno 10061] Connect call failed ('::1', 25001, 0, 0), [Errno 10061] Conn
ect call failed ('127.0.0.1', 25001)
Unexpected error
Traceback (most recent call last):
File "C:\Users\caleb\temp\testaiorun\aiomsg\__init__.py", line 202, in connect_with_retry
await new_connection()
File "C:\Users\caleb\temp\testaiorun\aiomsg\__init__.py", line 186, in new_connection
hostname, port, loop=self.loop, ssl=ssl_context
File "G:\Programs\Python37\lib\asyncio\streams.py", line 77, in open_connection
lambda: protocol, host, port, **kwds)
File "G:\Programs\Python37\lib\asyncio\base_events.py", line 968, in create_connection
', '.join(str(exc) for exc in exceptions)))
OSError: Multiple exceptions: [Errno 10061] Connect call failed ('::1', 25001, 0, 0), [Errno 10061] Conn
ect call failed ('127.0.0.1', 25001)
Ok, my knowledge of these socket exceptions is very old. See this stackoverflow for more details on modern handling: https://stackoverflow.com/a/19192988/170656
See https://docs.python.org/3/library/exceptions.html#os-exceptions
The following exceptions are subclasses of OSError, they get raised depending on the system error code.
exception ConnectionError
A base class for connection-related issues.
Subclasses are BrokenPipeError, ConnectionAbortedError, ConnectionRefusedError and ConnectionResetError.
exception BrokenPipeError
A subclass of ConnectionError, raised when trying to write on a pipe while the other end has been closed, or trying to write on a socket which has been shutdown for writing. Corresponds to errno EPIPE and ESHUTDOWN.
exception ConnectionAbortedError
A subclass of ConnectionError, raised when a connection attempt is aborted by the peer. Corresponds to errno ECONNABORTED.
exception ConnectionRefusedError
A subclass of ConnectionError, raised when a connection attempt is refused by the peer. Corresponds to errno ECONNREFUSED.
exception ConnectionResetError
A subclass of ConnectionError, raised when a connection is reset by the peer. Corresponds to errno ECONNRESET.
Fixed in release 2019.5.0