Skip to content

Commit

Permalink
Merge pull request #6600 from MestreLion/MestreLion-connection-timeou…
Browse files Browse the repository at this point in the history
…t-note

Add note on connection timeout being larger than specified. Fix #5773
  • Loading branch information
sigmavirus24 committed Dec 16, 2023
2 parents 51d0d83 + 92f9e43 commit 1ddf014
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/user/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1122,4 +1122,18 @@ coffee.

r = requests.get('https://github.com', timeout=None)

.. note:: The connect timeout applies to each connection attempt to an IP address.
If multiple addresses exist for a domain name, the underlying ``urllib3`` will
try each address sequentially until one successfully connects.
This may lead to an effective total connection timeout *multiple* times longer
than the specified time, e.g. an unresponsive server having both IPv4 and IPv6
addresses will have its perceived timeout *doubled*, so take that into account
when setting the connection timeout.
.. note:: Neither the connect nor read timeouts are `wall clock`_. This means
that if you start a request, and look at the time, and then look at
the time when the request finishes or times out, the real-world time
may be greater than what you specified.


.. _`wall clock`: https://wiki.php.net/rfc/max_execution_wall_time
.. _`connect()`: https://linux.die.net/man/2/connect

0 comments on commit 1ddf014

Please sign in to comment.