Random OpenSSL errors when doing API requests, appears to be IP address related

We are experiencing strange errors when doing cURL requests on https://api.openai.com/v1/completions, the language model doesn’t seem to make a difference.
When executing repeated requests with either the exact same or slightly modified prompt, we receive a successful response only about half of the time, the rest of the time we get one of the following errors:

OpenSSL SSL_read: error:1409441A:SSL routines:ssl3_read_bytes:tlsv1 alert decode error

or like:

OpenSSL SSL_read: error:140943FC:SSL routines:ssl3_read_bytes:sslv3 alert bad record mac

These errors are random. It’s clearly not related to a rate limit, because the same happens when I wait a few minutes. It’s always either hit or miss when I re-execute the request.

We’ve tried doing the exact same request with the exact same API key repeatedly from other servers and there was no error at all. When we temporarily changed the IP address of the server, the errors also disappeared. So it appears somehow to be IP address related.

Does anyone have any idea what it could be or experienced the same? Does OpenAI perhaps intentionally (partially) block or limit IPs? Any feedback is appreciated!

Ran into the same error when calling the Whisper API. Trying multiple times resulted in the same error, but one of the calls in between seems to have succeeded and I got a proper response.

Pretty odd, but just wanted to document this behavior.

Same random errors:
ssl.SSLError: [SSL: SSLV3_ALERT_BAD_RECORD_MAC] sslv3 alert bad record mac (_ssl.c:2548)

openai.APIConnectionError: Connection error.

Now I’m getting the errors randomly too.

Me getting same now, everday on several request. No Code and no Server Settings changed.

OpenSSL SSL_read: error:0A0003FC:SSL routines::sslv3 alert bad record mac, errno 0 - Code: 56

MAC.svg

Does not appear to be IP address related, but can be something breaking the secure connection on the network.

A random thing you can do just to eliminate your side’s code is to update networking stack libraries, particularly those that have certificates from Mozilla authority or similar, certifi, requests, urllib3 on python, or system libs.

Have you guys solved this ? I’m having those in production container since 4 days, no way to figure out.

I too am intermittently seeing this error on certain devices. When this is encountered I have tried to resubmit the request multiple times with a delay but that did not resolve the problem.

Has anyone had any luck with this?