AttributeError 'NoneType' object has no attribute 'fileno'.
File "httpx/_client.py", line 1371, in request
response = await self.send(
File "httpx/_client.py", line 1406, in send
response = await self._send_handling_auth(
File "httpx/_client.py", line 1444, in _send_handling_auth
response = await self._send_handling_redirects(
File "httpx/_client.py", line 1476, in _send_handling_redirects
response = await self._send_single_request(request, timeout)
File "httpx/_client.py", line 1502, in _send_single_request
(status_code, headers, stream, ext,) = await transport.arequest(
File "httpcore/_async/http_proxy.py", line 124, in arequest
return await self._tunnel_request(
File "httpcore/_async/http_proxy.py", line 190, in _tunnel_request
connection = await self._get_connection_from_pool(origin)
File "httpcore/_async/connection_pool.py", line 248, in _get_connection_from_pool
if connection.is_socket_readable():
File "httpcore/_async/connection.py", line 169, in is_socket_readable
return self.connection is not None and self.connection.is_socket_readable()
File "httpcore/_async/http11.py", line 205, in is_socket_readable
return self.socket.is_readable()
File "httpcore/_backends/asyncio.py", line 179, in is_readable
return is_socket_readable(sock.fileno())
Anyway, even though I do not fully understand asyncio transports, based on other examples I guess it is pretty reasonable to test if get_exra_info("socket") is not None?
We somewhat discussed the issue at https://gitter.im/encode/community .
TL;DR when connection is closed/reset
httpcoreassumessocketis still available for transport and crashes withEnvironment
Docker image: python:3.8.6-buster
Python: 3.8.6
httpcore: 0.12.2
Details
transport.get_extra_info("socket")returnsNone,sock.fileno()crashes.sockshould probably beOptional[socket.socket].extra["socket"]existence but in the example code they do test it: https://docs.python.org/3/library/asyncio-protocol.html#asyncio.BaseTransport.get_extra_infoextra["socket"]gets cleared, but couldn't find anything related 🤔 For reference it is set hereAnyway, even though I do not fully understand asyncio transports, based on other examples I guess it is pretty reasonable to test if
get_exra_info("socket") is not None?