aio-libs / aiohttp

Asynchronous HTTP client/server framework for asyncio and Python
https://docs.aiohttp.org
Other
15.03k stars 2k forks source link

Fatal read error on socket transport (TimeoutError) #4784

Open boxOfAces opened 4 years ago

boxOfAces commented 4 years ago

Long story short

This issue has previously been referenced in #3117, but same has been closed without any resolution provided

Expected behaviour

No exception

Actual behaviour

Fatal read error on socket transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x1336afb38>
transport: <_SelectorSocketTransport fd=66 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/selector_events.py", line 801, in _read_ready__data_received
    data = self._sock.recv(self.max_size)
TimeoutError: [Errno 60] Operation timed out

However, this exception doesn't cause any problem per se in the execution of any code after this. The event loop runs fine and coro calling this also executes. The request also gets completed everytime.

Steps to reproduce

...
# Aiohttp persistent session
self._session = loop.run_until_complete(self.create_session())

async def create_session(self):
    return aiohttp.ClientSession()

...
# 'url' below is a third party server url
try:
      async with self._session.request(method,
                                       url,
                                       data = params,
                                       params = params,
                                       headers = self._headers,
                                       ssl = False,
                                       allow_redirects = True,
                                       timeout = aiohttp.ClientTimeout(total = 7)) as r:
   # Do something
except Exception as e:
      raise e

Your environment

aiohttp==3.6.2 asyncio==3.4.3 python==3.7.3 macos== 10.13.6

Dreamsorcerer commented 1 month ago

Is this still an issue? Can you provide a complete reproducer, including URL etc? Your reproducer appears to just be "make a request" with ssl disabled. Unless it's an ssl issue, millions of other users are making a request without this exception, so we'll need more to go on...