replicate/replicate-python

EOF occured in violation of protocol -- From EC2 AWS

bertello72 opened this issue · 4 comments

I got this error message executing the code in Ec2 AWS Linux Ubuntu 22.04.2 (not locally): [SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1007)

Replicate v. 0.23.1

Error log:

Traceback (most recent call last):
  File "/home/ubuntu/News/LLM_confronto.py", line 42, in generate_summary
    for event in replicate.stream(
  File "/home/ubuntu/.local/lib/python3.10/site-packages/replicate/stream.py", line 200, in stream
    with client._client.stream("GET", url, headers=headers) as response:
  File "/usr/lib/python3.10/contextlib.py", line 135, in __enter__
    return next(self.gen)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/httpx/_client.py", line 871, in stream
    response = self.send(
  File "/home/ubuntu/.local/lib/python3.10/site-packages/httpx/_client.py", line 915, in send
    response = self._send_handling_auth(
  File "/home/ubuntu/.local/lib/python3.10/site-packages/httpx/_client.py", line 943, in _send_handling_auth
    response = self._send_handling_redirects(
  File "/home/ubuntu/.local/lib/python3.10/site-packages/httpx/_client.py", line 980, in _send_handling_redirects
    response = self._send_single_request(request)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/httpx/_client.py", line 1016, in _send_single_request
    response = transport.handle_request(request)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/replicate/client.py", line 258, in handle_request
    response = self._wrapped_transport.handle_request(request)  # type: ignore
  File "/home/ubuntu/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 230, in handle_request
    with map_httpcore_exceptions():
  File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 84, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectError: [SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1007)

Hi, @bertello72. Is this happening every time? Intermittently? Just a one-off?

@bertello72 Thanks for clarifying. Searching around for that error message, it sounds like the problem can be resolved by upgrading your installation of OpenSSL or nginx (if you're using that). See this SO thread.

i haven't used nginx and I've checked OpenSSL; it's the latest available in AWS EC2 Amazon Linux.

AWS Service Support gave me this advice:

<<I did researched about the error "[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1007)" and found that it might be related to SSL/TLS mismtach between server and hosts. I have got information from below external source:
https://community.cisco.com/t5/radkit-discussions/getting-conda-error-encountered-an-ssl-error-most-likely-a/td-p/4873809>>

Does it rise in your mind some insights on how to fix the problem?