8000 connection.py / create_connection blocks forever if socket.getaddrinfo stalls · Issue #3588 · urllib3/urllib3 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

connection.py / create_connection blocks forever if socket.getaddrinfo stalls #3588

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

Open
simlei opened this issue Apr 10, 2025 · 0 comments
Open

Comments

@simlei
Copy link
simlei commented Apr 10, 2025

Environment

  • requesting a server that is normally connected to via vpn (something like 10.0.x.x). if the vpn is down, naturally the server can't be reached
  • urllib3 version 2.3.0

Problem

My problem is, the connection.py request does not time out ever.

I traced it down to

for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):

Here, the socket.getaddrinfo() is not returning.

Expectation

The timeout to apply to all connection-setup-related things like getaddrinfo, too.

Research

https://groups.google.com/g/python-tulip/c/-SFI8kkQEj4

I was not able to determine if they ended up implementing an always-terminating behavior on all OS and whether that even is to the exact point of the problem here.

Log

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/sleischnig/sandbox/mb-inst-stable/ws/path/spl-infra/python/spl_infra/cli/__main__.py", line 5, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/sleischnig/sandbox/mb-inst-stable/ws/path/spl-infra/python/spl_infra/cli/__init__.py", line 25, in main
    app = create_app(repo_path)
          ^^^^^^^^^^^^^^^^^^^^^
  [elided for privacy]
  File "/home/sleischnig/sandbox/mb-inst-stable/ws/<...>", line 159, in from_path
    gl_project = session.projects.get(path_with_namespace)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sleischnig/sandbox/mb-inst-stable/.cache/PythonEnv/__main_____main__/lib/python3.12/site-packages/gitlab/v4/objects/projects.py", line 871, in get
    return cast(Project, super().get(id=id, lazy=lazy, **kwargs))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sleischnig/sandbox/mb-inst-stable/.cache/PythonEnv/__main_____main__/lib/python3.12/site-packages/gitlab/exceptions.py", line 344, in wrapped_f
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "/home/sleischnig/sandbox/mb-inst-stable/.cache/PythonEnv/__main_____main__/lib/python3.12/site-packages/gitlab/mixins.py", line 125, in get
    server_data = self.gitlab.http_get(path, **kwargs)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sleischnig/sandbox/mb-inst-stable/.cache/PythonEnv/__main_____main__/lib/python3.12/site-packages/gitlab/client.py", line 813, in http_get
    result = self.http_request(
             ^^^^^^^^^^^^^^^^^^
  File "/home/sleischnig/sandbox/mb-inst-stable/.cache/PythonEnv/__main_____main__/lib/python3.12/site-packages/gitlab/client.py", line 737, in http_request
    result = self._backend.http_request(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sleischnig/sandbox/mb-inst-stable/.cache/PythonEnv/__main_____main__/lib/python3.12/site-packages/gitlab/_backends/requests_backend.py", line 157, in http_request
    response: requests.Response = self._client.request(
                                  ^^^^^^^^^^^^^^^^^^^^^
  File "/home/sleischnig/sandbox/mb-inst-stable/ws/path/vims-layer-simlei-base/shared/pack/dev/opt/gv/mb-module/PythonEnv_venv/lib/python3.12/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sleischnig/sandbox/mb-inst-stable/ws/path/vims-layer-simlei-base/shared/pack/dev/opt/gv/mb-module/PythonEnv_venv/lib/python3.12/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sleischnig/sandbox/mb-inst-stable/ws/path/vims-layer-simlei-base/shared/pack/dev/opt/gv/mb-module/PythonEnv_venv/lib/python3.12/site-packages/requests/adapters.py", line 669, in send
    method=request.method,
       ^^^^^^^^^^^^^^^^^^^
  File "/home/sleischnig/sandbox/mb-inst-stable/ws/path/vims-layer-simlei-base/shared/pack/dev/opt/gv/mb-module/PythonEnv_venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 787, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/home/sleischnig/sandbox/mb-inst-stable/ws/path/vims-layer-simlei-base/shared/pack/dev/opt/gv/mb-module/PythonEnv_venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 493, in _make_request
    conn.request(
  File "/home/sleischnig/sandbox/mb-inst-stable/ws/path/vims-layer-simlei-base/shared/pack/dev/opt/gv/mb-module/PythonEnv_venv/lib/python3.12/site-packages/urllib3/connection.py", line 445, in request
    self.endheaders()
  File "/home/sleischnig/sandbox/mb-inst-stable/ws/path/simlei_python/installation/lib/python3.12/http/client.py", line 1333, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/home/sleischnig/sandbox/mb-inst-stable/ws/path/simlei_python/installation/lib/python3.12/http/client.py", line 1093, in _send_output
    self.send(msg)
  File "/home/sleischnig/sandbox/mb-inst-stable/ws/path/simlei_python/installation/lib/python3.12/http/client.py", line 1037, in send
    self.connect()
  File "/home/sleischnig/sandbox/mb-inst-stable/ws/path/vims-layer-simlei-base/shared/pack/dev/opt/gv/mb-module/PythonEnv_venv/lib/python3.12/site-packages/urllib3/connection.py", line 276, in connect
    self.sock = self._new_conn()
                ^^^^^^^^^^^^^^^^
  File "/home/sleischnig/sandbox/mb-inst-stable/ws/path/vims-layer-simlei-base/shared/pack/dev/opt/gv/mb-module/PythonEnv_venv/lib/python3.12/site-packages/urllib3/connection.py", line 214, in _new_conn
    self, f"Failed to establish a new connection: {e}"
                                                  ^^^
KeyboardInterrupt

I had to Control-C the process to error out eventually...

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

No branches or pull requests

1 participant
0