Skip to content

EOF occurred in violation of protocol starting Python3.10 on large requests #110467

Description

@3asm

Bug report

Bug description:

We have identified a regression starting with Python 3.10 when making a large request over TLS.

importrequestsrequests.post('https://google.com', data=b'A'*1000000)
urllib3.exceptions.SSLError: EOFoccurredinviolationofprotocol (_ssl.c:2426)
Theaboveexceptionwasthedirectcauseofthefollowingexception:
Traceback (mostrecentcalllast):
File"/usr/local/lib/python3.10/site-packages/requests/adapters.py", line486, insendresp=conn.urlopen(
File"/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line844, inurlopenretries=retries.increment(
File"/usr/local/lib/python3.10/site-packages/urllib3/util/retry.py", line515, inincrementraiseMaxRetryError(_pool, url, reason) fromreason# type: ignore[arg-type]urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='google.com', port=443): Maxretriesexceededwithurl: / (CausedbySSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:2426)')))
Duringhandlingoftheaboveexception, anotherexceptionoccurred:
Traceback (mostrecentcalllast):
File"<stdin>", line1, in<module>File"/usr/local/lib/python3.10/site-packages/requests/api.py", line115, inpostreturnrequest("post", url, data=data, json=json, **kwargs)
File"/usr/local/lib/python3.10/site-packages/requests/api.py", line59, inrequestreturnsession.request(method=method, url=url, **kwargs)
File"/usr/local/lib/python3.10/site-packages/requests/sessions.py", line589, inrequestresp=self.send(prep, **send_kwargs)
File"/usr/local/lib/python3.10/site-packages/requests/sessions.py", line703, insendr=adapter.send(request, **kwargs)
File"/usr/local/lib/python3.10/site-packages/requests/adapters.py", line517, insendraiseSSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='google.com', port=443): Maxretriesexceededwithurl: / (CausedbySSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:2426)')))

The same request works fine on Python 3.9.

CPython versions tested on:

3.10, 3.11, 3.12

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions