-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Async API server starts throwing errors and works fine after restart #971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hmm, there's not a lot of details to go off of here. Can you share some of your code, and the timeouts that you're seeing? |
So, the code that I using is straightforward
After a few hundred API calls, we start seeing a lot of timeout events. i.e. the API is not able to respond within 6 seconds. Once we restart the server the open AI end points start functioning again. I feel that this is somewhat related this issue
|
Hmm. Have you tried increasing the connection pool size? |
I suspect this is the result of running out of connections; please try this: from openai import AsyncOpenAI
import httpx
client = AsyncOpenAI(
http_client=httpx.Client(
limits=httpx.Limits(
max_connections=1000,
max_keepalive_connections=100
)
)
) Let us know if that helps. If that doesn't work, we should reopen this issue. |
seeing the same issue here. @rattrayalex wouldn't bumping the limit, just cause it to show up later? |
If the limit is higher than your rate limits or use in practice, it would not show up later. |
Hey @rattrayalex my understanding was that this was being caused by connections not being properly closed, and therefore increasing over time. Is that incorrect? If so, what's causing this? |
ah, since you are passing If you don't do this, the connection for that request will hang open indefinitely. |
Confirm this is an issue with the Python library and not an underlying OpenAI API
Describe the bug
All the requests to the open ai end point start throwing timeouts. This changed after doing two things
GPT_3_5_TURBO_1106
model as well as using the async client.GPT_3_5_TURBO_1106
change but the issue is still happeningI am using
openai = "^1.3.9"
To Reproduce
Use a combination of above + Fastify
After some number of requests we start getting timeouts
Code snippets
No response
OS
macOs
Python version
3.11.5
Library version
1.3.9
The text was updated successfully, but these errors were encountered: