Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-29010

Receiving 'EOF occurred in violation of protocol (_ssl.c:2426)' when uploading big files

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • rhel-8.9.0
    • python3.11
    • sst_cs_apps
    • ssg_core_services
    • False
    • Hide

      None

      Show
      None
    • Red Hat Enterprise Linux

      This issue appears to be related to the following upstream Github issue. When uploading (either via POST or via PUT) big files, Python errors out immediately.

      The two reproducers (one for requests, one for http.client) outlined in the upstream issue have been tested, both on RHEL 8 and 9, and using Python 3.9 and Python 3.11. Python 3.11 is affected, both using requests as well as http.client.

      • RHEL 8, Python 3.9, requests (python3-requests-2.20.0-2.1.el8_1.noarch), unaffected:
      [root@r88 ~]# python3.9
      Python 3.9.16 (main, May 31 2023, 12:21:58) 
      [GCC 8.5.0 20210514 (Red Hat 8.5.0-18)] on linux
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import requests
      >>> requests.post('https://google.com', data=b'A'*1000000)
      <Response [413]>
      >>> 
      
      • RHEL 8, Python 3.9, http.client (python39-3.9.16-1.module+el8.8.0+18968+3d7b19f0.1.x86_64), unaffected:
      [root@r88 ~]# python3.9
      Python 3.9.16 (main, May 31 2023, 12:21:58) 
      [GCC 8.5.0 20210514 (Red Hat 8.5.0-18)] on linux
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import http.client
      >>> http.client.HTTPSConnection("www.google.com").request('GET', '/', body=b'A'*1000000)
      >>> 
      
      • RHEL 8, Python 3.11, requests (python3.11-requests-2.28.1-1.el9.noarch), affected:
      [root@r88 ~]# python3.11
      Python 3.11.5 (main, Sep 22 2023, 15:34:29) [GCC 8.5.0 20210514 (Red Hat 8.5.0-20)] on linux
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import requests
      >>> requests.post('https://google.com', data=b'A'*1000000)
      Traceback (most recent call last):
        File "/usr/lib/python3.11/site-packages/urllib3/connectionpool.py", line 703, in urlopen
          httplib_response = self._make_request(
                             ^^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.11/site-packages/urllib3/connectionpool.py", line 398, in _make_request
          conn.request(method, url, **httplib_request_kw)
        File "/usr/lib/python3.11/site-packages/urllib3/connection.py", line 239, in request
          super(HTTPConnection, self).request(method, url, body=body, headers=headers)
        File "/usr/lib64/python3.11/http/client.py", line 1286, in request
          self._send_request(method, url, body, headers, encode_chunked)
        File "/usr/lib64/python3.11/http/client.py", line 1332, in _send_request
          self.endheaders(body, encode_chunked=encode_chunked)
        File "/usr/lib64/python3.11/http/client.py", line 1281, in endheaders
          self._send_output(message_body, encode_chunked=encode_chunked)
        File "/usr/lib64/python3.11/http/client.py", line 1080, in _send_output
          self.send(chunk)
        File "/usr/lib64/python3.11/http/client.py", line 1002, in send
          self.sock.sendall(data)
        File "/usr/lib64/python3.11/ssl.py", line 1274, in sendall
          v = self.send(byte_view[count:])
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib64/python3.11/ssl.py", line 1243, in send
          return self._sslobj.write(data)
                 ^^^^^^^^^^^^^^^^^^^^^^^^
      ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2427)
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/usr/lib/python3.11/site-packages/requests/adapters.py", line 489, in send
          resp = conn.urlopen(
                 ^^^^^^^^^^^^^
        File "/usr/lib/python3.11/site-packages/urllib3/connectionpool.py", line 787, in urlopen
          retries = retries.increment(
                    ^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.11/site-packages/urllib3/util/retry.py", line 592, in increment
          raise MaxRetryError(_pool, url, error or ResponseError(cause))
      urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='google.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLEOFError(8, 'EOF)
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "/usr/lib/python3.11/site-packages/requests/api.py", line 115, in post
          return request("post", url, data=data, json=json, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.11/site-packages/requests/api.py", line 59, in request
          return session.request(method=method, url=url, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.11/site-packages/requests/sessions.py", line 587, in request
          resp = self.send(prep, **send_kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.11/site-packages/requests/sessions.py", line 701, in send
          r = adapter.send(request, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.11/site-packages/requests/adapters.py", line 563, in send
          raise SSLError(e, request=request)
      requests.exceptions.SSLError: HTTPSConnectionPool(host='google.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLEOFError(8, 'EOF occ)
      >>> 
      
      • RHEL 8, Python 3.11, http.client (python3.11-3.11.5-1.el8_9.x86_64), affected:
      [root@r88 ~]# python3.11
      Python 3.11.5 (main, Sep 22 2023, 15:34:29) [GCC 8.5.0 20210514 (Red Hat 8.5.0-20)] on linux
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import http.client
      >>> http.client.HTTPSConnection("www.google.com").request('GET', '/', body=b'A'*1000000)
      >>> 
      [root@r88 ~]# python3.11
      Python 3.11.5 (main, Sep 22 2023, 15:34:29) [GCC 8.5.0 20210514 (Red Hat 8.5.0-20)] on linux
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import http.client
      >>> http.client.HTTPSConnection("www.google.com").request('POST', '/', body=b'A'*1000000)
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "/usr/lib64/python3.11/http/client.py", line 1286, in request
          self._send_request(method, url, body, headers, encode_chunked)
        File "/usr/lib64/python3.11/http/client.py", line 1332, in _send_request
          self.endheaders(body, encode_chunked=encode_chunked)
        File "/usr/lib64/python3.11/http/client.py", line 1281, in endheaders
          self._send_output(message_body, encode_chunked=encode_chunked)
        File "/usr/lib64/python3.11/http/client.py", line 1080, in _send_output
          self.send(chunk)
        File "/usr/lib64/python3.11/http/client.py", line 1002, in send
          self.sock.sendall(data)
        File "/usr/lib64/python3.11/ssl.py", line 1274, in sendall
          v = self.send(byte_view[count:])
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib64/python3.11/ssl.py", line 1243, in send
          return self._sslobj.write(data)
                 ^^^^^^^^^^^^^^^^^^^^^^^^
      ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2427)
      >>> 
      
      • RHEL 9, Python 3.9, requests (python3-requests-2.25.1-7.el9_2.noarch), unaffected:
      [root@r93 ~]# python3.9
      Python 3.9.18 (main, Sep  7 2023, 00:00:00) 
      [GCC 11.4.1 20230605 (Red Hat 11.4.1-2)] on linux
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import requests
      >>> requests.post('https://google.com', data=b'A'*1000000)
      <Response [413]>
      >>> 
      
      • RHEL 9, Python 3.9, http.client (python3-3.9.18-1.el9_3.x86_64), unaffected:
      [root@r93 ~]# python3.9
      Python 3.9.18 (main, Sep  7 2023, 00:00:00) 
      [GCC 11.4.1 20230605 (Red Hat 11.4.1-2)] on linux
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import http.client
      >>> http.client.HTTPSConnection("www.google.com").request('GET', '/', body=b'A'*1000000)
      >>> 
      
      • RHEL 9, Python 3.11, requests (python3.11-requests-2.28.1-1.el9.noarch), affected:
      [root@r93 ~]# python3.11
      Python 3.11.5 (main, Sep  7 2023, 00:00:00) [GCC 11.4.1 20230605 (Red Hat 11.4.1-2)] on linux
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import requests
      >>> requests.post('https://google.com', data=b'A'*1000000)
      Traceback (most recent call last):
        File "/usr/lib/python3.11/site-packages/urllib3/connectionpool.py", line 703, in urlopen
          httplib_response = self._make_request(
                             ^^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.11/site-packages/urllib3/connectionpool.py", line 398, in _make_request
          conn.request(method, url, **httplib_request_kw)
        File "/usr/lib/python3.11/site-packages/urllib3/connection.py", line 239, in request
          super(HTTPConnection, self).request(method, url, body=body, headers=headers)
        File "/usr/lib64/python3.11/http/client.py", line 1286, in request
          self._send_request(method, url, body, headers, encode_chunked)
        File "/usr/lib64/python3.11/http/client.py", line 1332, in _send_request
          self.endheaders(body, encode_chunked=encode_chunked)
        File "/usr/lib64/python3.11/http/client.py", line 1281, in endheaders
          self._send_output(message_body, encode_chunked=encode_chunked)
        File "/usr/lib64/python3.11/http/client.py", line 1080, in _send_output
          self.send(chunk)
        File "/usr/lib64/python3.11/http/client.py", line 1002, in send
          self.sock.sendall(data)
        File "/usr/lib64/python3.11/ssl.py", line 1274, in sendall
          v = self.send(byte_view[count:])
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib64/python3.11/ssl.py", line 1243, in send
          return self._sslobj.write(data)
                 ^^^^^^^^^^^^^^^^^^^^^^^^
      ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2427)
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/usr/lib/python3.11/site-packages/requests/adapters.py", line 489, in send
          resp = conn.urlopen(
                 ^^^^^^^^^^^^^
        File "/usr/lib/python3.11/site-packages/urllib3/connectionpool.py", line 787, in urlopen
          retries = retries.increment(
                    ^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.11/site-packages/urllib3/util/retry.py", line 592, in increment
          raise MaxRetryError(_pool, url, error or ResponseError(cause))
      urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='google.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:2427)')))
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "/usr/lib/python3.11/site-packages/requests/api.py", line 115, in post
          return request("post", url, data=data, json=json, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.11/site-packages/requests/api.py", line 59, in request
          return session.request(method=method, url=url, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.11/site-packages/requests/sessions.py", line 587, in request
          resp = self.send(prep, **send_kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.11/site-packages/requests/sessions.py", line 701, in send
          r = adapter.send(request, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.11/site-packages/requests/adapters.py", line 563, in send
          raise SSLError(e, request=request)
      requests.exceptions.SSLError: HTTPSConnectionPool(host='google.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:2427)')))
      >>> 
      
      • RHEL 9, Python 3.11, http.client (python3.11-3.11.5-1.el9_3.x86_64), affected:
      [root@r93 ~]# python3.11
      Python 3.11.5 (main, Sep  7 2023, 00:00:00) [GCC 11.4.1 20230605 (Red Hat 11.4.1-2)] on linux
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import http.client
      >>> http.client.HTTPSConnection("www.google.com").request('GET', '/', body=b'A'*1000000)
      >>> 
      [root@r93 ~]# python3.11
      Python 3.11.5 (main, Sep  7 2023, 00:00:00) [GCC 11.4.1 20230605 (Red Hat 11.4.1-2)] on linux
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import http.client
      >>> http.client.HTTPSConnection("www.google.com").request('POST', '/', body=b'A'*1000000)
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "/usr/lib64/python3.11/http/client.py", line 1286, in request
          self._send_request(method, url, body, headers, encode_chunked)
        File "/usr/lib64/python3.11/http/client.py", line 1332, in _send_request
          self.endheaders(body, encode_chunked=encode_chunked)
        File "/usr/lib64/python3.11/http/client.py", line 1281, in endheaders
          self._send_output(message_body, encode_chunked=encode_chunked)
        File "/usr/lib64/python3.11/http/client.py", line 1080, in _send_output
          self.send(chunk)
        File "/usr/lib64/python3.11/http/client.py", line 1002, in send
          self.sock.sendall(data)
        File "/usr/lib64/python3.11/ssl.py", line 1274, in sendall
          v = self.send(byte_view[count:])
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib64/python3.11/ssl.py", line 1243, in send
          return self._sslobj.write(data)
                 ^^^^^^^^^^^^^^^^^^^^^^^^
      ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2427)
      >>> 
      

            python-maint python-maint
            rhn-support-jsantos Juan Santos
            python-maint python-maint
            Lukas Zachar Lukas Zachar
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: