Frequent API timeout errors recently

I’ve also been getting ECONNRESET and Request failed with status code 502 errors in the past 10 hours. BTW openai api takes several minutes before throwing an error and timing out, which is a bit annoying.

You can write code in your app to shorten this timeout.

Normally, this is a good time to work on error and exception handling code when performance is bad.

For example, check out this current topic:

:slight_smile:

Makes sense. I just set a 30 seconds timeout and then I try with gpt-3.5-turbo-0301. Not sure if changing the model will make any improvement though

1 Like

having 3 + days of failed requests because of timeouts is pretty bad for a business

4 Likes

same error to me, what is the solution? :broken_heart:

It does. Sometimes, outages do not work the same way for all the models/endpoints (sometimes they do).
@ljia31523 All the strategies are pretty much explained in this link that @ruby_coder already shared. Feel free to reach out if you still have doubts or do not know how to implement them.

1 Like

Same problem with davinci-003 and 3.5-turbo

Experiencing the same issue with both davinci-003 and davinci-002.
It’s almost been 3 days with the same issue. It’s making it really hard to work.

1 Like

what is most annoying to me is:
I try to set a timeout at openai.ChatCompletion.create(..., timeout=10) hoping that that after 10seconds, if it is still “hunging”, please stop.

I am using @retry(wait = wait_random_exponential(min =1, max = 60), stop = stop_after_attempt(6)) def chatcompletion_with_backoff(**kwargs): to hope to handle this.

HOWEVER, there are no “timeout”. I have been monitoring the process. There are mulititimes that the the request being going on >minutes, and yet no Timeout is thrown out.

See this for the similar complaints…

I mean, basic coding principle, things should “do what they say, say what they do”… it’s clearly not the case here.

any guidance pls? Just keep “trying” and wait for things to clear, unfortunately is not an option

1 Like

Exactly, does not give me the confidence to roll my app functionality out to further users at all, unless things get a bit more stable.

2 Likes

I’ve faced the same timeout issue. In the Python API, if you pass the parameter request_timeout to openai.ChatCompletion.create instead of timeout then it will throw a Timeout exception after n seconds. Hope it helps

But yes, I’ve been facing these issues as well…

We have exactly the same problem with timeouts.

thank you for pointing out therequest_timeout

1 Like

same here! I plan to use claude to see if it is more stable

thanks, I have try catch and add timeout in my code. The api may be stable today.

1 Like

Probably is intermittent. If it times out continuously more than a certain amount of time it would change to something else.

Hi @georgei

Yeah, I hear you.

I’m been working for about an hour and it TIMEOUT about 70% of the time or so…

:slight_smile:

1 Like

Timeouts started increasing around 1am Sunday and continued through Monday. Back to normal today. Here’s a graph of the increase. The blue line is timeout errors.

Is it working with retry decorator?

Call result = openai.ChatCompletion.create within a ThreadPoolExecutor. Try and catch future.result(10). When ThreadPoolTimeoutError is raised, use tenacity to retry on this exception