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

Any ipv6 request spuriously stays stuck for a long time, sometimes never progressing #6788

Closed
sanjacob opened this issue Aug 12, 2024 · 1 comment
Labels
actions/autoclose-qa Used for automation to auto-close an issue Question/Not a bug

Comments

@sanjacob
Copy link

I have an issue with my OS, that I am not sure how to diagnose, but it seems to affect requests too:

requests [required: >=2.20, installed: 2.32.3]
│   ├── certifi [required: >=2017.4.17, installed: 2024.7.4]
│   ├── charset-normalizer [required: >=2,<4, installed: 3.3.2]
│   ├── idna [required: >=2.5,<4, installed: 3.7]
│   └── urllib3 [required: >=1.21.1,<3, installed: 2.2.2]
  • 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.

@sanjacob sanjacob added actions/autoclose-qa Used for automation to auto-close an issue Question/Not a bug labels Aug 12, 2024
Copy link

As described in the template, we won't be able to answer questions on this issue tracker. Please use Stack Overflow

@github-actions github-actions bot locked as off-topic and limited conversation to collaborators Aug 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
actions/autoclose-qa Used for automation to auto-close an issue Question/Not a bug
Projects
None yet
Development

No branches or pull requests

1 participant