Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid documentation around request timeouts #6098

Closed
1 task done
andre3racks opened this issue Oct 18, 2021 · 2 comments
Closed
1 task done

Invalid documentation around request timeouts #6098

andre3racks opened this issue Oct 18, 2021 · 2 comments
Labels

Comments

@andre3racks
Copy link

Describe the bug

In this documentation describing timeout configuration, at the end of the section, it states: All fields are floats, None or 0 disables a particular timeout check, see the ClientTimeout reference for defaults and additional details.

After some testing, this holds true if fields are None. However, it doesn't if these fields are set to 0. Setting these fields to 0 results in a timeout upon request. The doc should be updated to reflect this.

To Reproduce

Make a request to some URL with the following timeout object:

timeout = aiohttp.ClientTimeout( total=0, sock_connect=0, connect=0, sock_read=0 )

Expected behavior

aiohttp.client_exceptions.ServerTimeoutError: Connection timeout to host [URL]....

Logs/tracebacks

Traceback (most recent call last):
  File "/home/andreas/.local/lib/python3.8/site-packages/aiohttp/client.py", line 520, in _request
    conn = await self._connector.connect(
  File "/home/andreas/.local/lib/python3.8/site-packages/aiohttp/connector.py", line 535, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/home/andreas/.local/lib/python3.8/site-packages/aiohttp/connector.py", line 892, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/home/andreas/.local/lib/python3.8/site-packages/aiohttp/connector.py", line 999, in _create_direct_connection
    hosts = await asyncio.shield(host_resolved)
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/andreas/.local/lib/python3.8/site-packages/aiohttp/client.py", line 520, in _request
    conn = await self._connector.connect(
  File "/home/andreas/.local/lib/python3.8/site-packages/async_timeout/__init__.py", line 45, in __exit__
    self._do_exit(exc_type)
  File "/home/andreas/.local/lib/python3.8/site-packages/async_timeout/__init__.py", line 92, in _do_exit
    raise asyncio.TimeoutError
asyncio.exceptions.TimeoutError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "hit_bdProfile.py", line 43, in <module>
    loop.run_until_complete(coroutine)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "hit_bdProfile.py", line 29, in make_request
    async with session.request(
  File "/home/andreas/.local/lib/python3.8/site-packages/aiohttp/client.py", line 1117, in __aenter__
    self._resp = await self._coro
  File "/home/andreas/.local/lib/python3.8/site-packages/aiohttp/client.py", line 524, in _request
    raise ServerTimeoutError(
aiohttp.client_exceptions.ServerTimeoutError: Connection timeout to host [URL]...

Python Version

$ python --version
Python 3.8.10

aiohttp Version

$ python -m pip show aiohttp
Name: aiohttp
Version: 3.7.4.post0
Summary: Async http client/server framework (asyncio)
Home-page: https://github.com/aio-libs/aiohttp
Author: Nikolay Kim
Author-email: [email protected]
License: Apache 2
Location: /home/andreas/.local/lib/python3.8/site-packages
Requires: multidict, typing-extensions, async-timeout, chardet, attrs, yarl
Required-by:

multidict Version

$ python -m pip show multidict
Name: multidict
Version: 5.2.0
Summary: multidict implementation
Home-page: https://github.com/aio-libs/multidict
Author: Andrew Svetlov
Author-email: [email protected]
License: Apache 2
Location: /home/andreas/.local/lib/python3.8/site-packages
Requires:
Required-by: yarl, aiohttp

yarl Version

$ python -m pip show yarl
Name: yarl
Version: 1.7.0
Summary: Yet another URL library
Home-page: https://github.com/aio-libs/yarl/
Author: Andrew Svetlov
Author-email: [email protected]
License: Apache 2
Location: /home/andreas/.local/lib/python3.8/site-packages
Requires: idna, multidict
Required-by: aiohttp

OS

Windows 10, running through WSL1

Related component

Client

Additional context

No response

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct
@lafolle
Copy link

lafolle commented Oct 20, 2021

Related issue- #5527

@Dreamsorcerer
Copy link
Member

Already fixed in 3.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants