Skip to content

Make connections retry in more spots #1598

@yarikoptic

Description

@yarikoptic
eg. this one -- should not just fail, but rather retry a number of times. So we might want to provision it somehow more globally
=================================== FAILURES ===================================
_ test_parse_api_url[https://gui.dandiarchive.org/#/dandiset/000001-parsed_url0] _
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/urllib3/connectionpool.py:787: in urlopen
    response = self._make_request(
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/urllib3/connectionpool.py:488: in _make_request
    raise new_e
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/urllib3/connectionpool.py:464: in _make_request
    self._validate_conn(conn)
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/urllib3/connectionpool.py:1093: in _validate_conn
    conn.connect()
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/urllib3/connection.py:741: in connect
    sock_and_verified = _ssl_wrap_socket_and_match_hostname(
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/urllib3/connection.py:920: in _ssl_wrap_socket_and_match_hostname
    ssl_sock = ssl_wrap_socket(
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/urllib3/util/ssl_.py:460: in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/urllib3/util/ssl_.py:504: in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/ssl.py:513: in wrap_socket
    return self.sslsocket_class._create(
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/ssl.py:1104: in _create
    self.do_handshake()
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/ssl.py:1375: in do_handshake
    self._sslobj.do_handshake()
E   ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/requests/adapters.py:667: in send
    resp = conn.urlopen(
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/urllib3/connectionpool.py:841: in urlopen
    retries = retries.increment(
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/urllib3/util/retry.py:474: in increment
    raise reraise(type(error), error, _stacktrace)
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/urllib3/util/util.py:38: in reraise
    raise value.with_traceback(tb)
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/urllib3/connectionpool.py:787: in urlopen
    response = self._make_request(
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/urllib3/connectionpool.py:488: in _make_request
    raise new_e
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/urllib3/connectionpool.py:464: in _make_request
    self._validate_conn(conn)
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/urllib3/connectionpool.py:1093: in _validate_conn
    conn.connect()
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/urllib3/connection.py:741: in connect
    sock_and_verified = _ssl_wrap_socket_and_match_hostname(
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/urllib3/connection.py:920: in _ssl_wrap_socket_and_match_hostname
    ssl_sock = ssl_wrap_socket(
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/urllib3/util/ssl_.py:460: in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/urllib3/util/ssl_.py:504: in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/ssl.py:513: in wrap_socket
    return self.sslsocket_class._create(
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/ssl.py:1104: in _create
    self.do_handshake()
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/ssl.py:1375: in do_handshake
    self._sslobj.do_handshake()
E   urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:
dandi/tests/test_dandiarchive.py:358: in test_parse_api_url
    assert parse_dandi_url(url) == parsed_url
dandi/dandiarchive.py:755: in parse
    new_url = cls.follow_redirect(url)
dandi/dandiarchive.py:894: in follow_redirect
    r = requests.head(url, allow_redirects=True)
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/requests/api.py:100: in head
    return request("head", url, **kwargs)
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/requests/api.py:59: in request
    return session.request(method=method, url=url, **kwargs)
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/requests/sessions.py:724: in send
    history = [resp for resp in gen]
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/requests/sessions.py:724: in <listcomp>
    history = [resp for resp in gen]
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/requests/sessions.py:265: in resolve_redirects
    resp = self.send(
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/requests/adapters.py:682: in send
    raise ConnectionError(err, request=request)
E   requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

@jwodder do you see the best way to do that overall at requests level to retry all connection resets?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions