Python 3.10.11 (main, Dec 26 2023, 17:59:09) [GCC 10.2.1 20210110] on linux
OS: Debian GNU/Linux 12 (bookworm) x86_64
Kernel: 6.1.0-23-amd64
Expected behaviour: requests hits timeout error
Actual behaviour: Stuck for a long time (10-20 minutes+)
>>> requests.get("https://google.com", timeout=2000) # Using IPv6
^CTraceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/.../.local/share/virtualenvs/.../lib/python3.10/site-packages/requests/api.py", line 73, in get
return request("get", url, params=params, **kwargs)
File "/home/.../.local/share/virtualenvs/.../lib/python3.10/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "/home/.../.local/share/virtualenvs/.../lib/python3.10/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "/home/.../.local/share/virtualenvs/.../lib/python3.10/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "/home/.../.local/share/virtualenvs/.../lib/python3.10/site-packages/requests/adapters.py", line 667, in send
resp = conn.urlopen(
File "/home/.../.local/share/virtualenvs/.../lib/python3.10/site-packages/urllib3/connectionpool.py", line 789, in urlopen
response = self._make_request(
File "/home/.../.local/share/virtualenvs/.../lib/python3.10/site-packages/urllib3/connectionpool.py", line 466, in _make_request
self._validate_conn(conn)
File "/home/.../.local/share/virtualenvs/.../lib/python3.10/site-packages/urllib3/connectionpool.py", line 1095, in _validate_conn
conn.connect()
File "/home/.../.local/share/virtualenvs/.../lib/python3.10/site-packages/urllib3/connection.py", line 615, in connect
self.sock = sock = self._new_conn()
File "/home/.../.local/share/virtualenvs/.../lib/python3.10/site-packages/urllib3/connection.py", line 196, in _new_conn
sock = connection.create_connection(
File "/home/.../.local/share/virtualenvs/.../lib/python3.10/site-packages/urllib3/util/connection.py", line 73, in create_connection
sock.connect(sa)
KeyboardInterrupt
>>> requests.packages.urllib3.util.connection.HAS_IPV6 = False # manually disable ipv6
>>> requests.get("https://google.com", timeout=2000) # no problem with this
<Response [200]>
>>> requests.packages.urllib3.util.connection.HAS_IPV6 = True # tried request again and stuck for a long time
Unfortunately this also affects git push and git pull, so I know for a fact this is not a requests bug. But I do expect timeout to work in this rare(?) circumstance. Whatever the case, if you happen to know why my ipv6 connections seem to either take forever or never happen, please let me know.
I have an issue with my OS, that I am not sure how to diagnose, but it seems to affect requests too:
Expected behaviour: requests hits timeout error Actual behaviour: Stuck for a long time (10-20 minutes+)
Unfortunately this also affects
git push
andgit pull
, so I know for a fact this is not a requests bug. But I do expect timeout to work in this rare(?) circumstance. Whatever the case, if you happen to know why my ipv6 connections seem to either take forever or never happen, please let me know.