-
Notifications
You must be signed in to change notification settings - Fork 404
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
TimeoutError on multiple requests #1076
Comments
@elprans, any ideas on the above? It's happening pretty consistently and we've tried basically everything to get this sorted. Some input would be very welcome. |
This seems like a connection timeout, not a query timeout, so I'd investigate the network configuration. How are you hosting your app? Also, why do you need to register the codec alias for the enum types? Asyncpg already decodes them as text by default. |
The app is a FastAPI app running in EC2 - we're using uvicorn and start about 10 workers. The postgres instance is in AWS RDS (instance type What we notice is that the "Average active sessions" sometimes blows up even with not that high usage and causes these timeouts. The reason for registering was because we sometimes notice spikes of the following query (even though we have jitt set to off) and as part off some investigations this was a proposed solution (but didn't help). The query:
I am not sure if the connection pool is being drained here but it's highly unlikely in my opinion. Let me know your thoughts @elprans ✋ |
Any ideas @elprans? Sorry for bugging you but it's quite an interesting thing. |
Could it be that you've restarted your app at that time and all workers had their connection pools populated? |
This happens because you are registering codecs, the query is executed by |
Hey @ilirosmanaj, did you resolve this by any chance? We're having the exact same issues |
the issue with a local PostgreSQL install?: We can reproduce it, not locally
We're using FastAPI ,and our current code for setting up the db connection is:
We added the
register_enum_types
as we were thinking that the query:SELECT t.oid, t.typelem AS elemtype, t.typtype AS kind FROM pg_catalog.pg_type AS t WHERE t.oid = $1
which we saw a lot in AWS RDS monitoring is causing the issue, but now we're not sure what is it anymore.
In logs when it happens we see:
File "/path/to/file/python3.10/site-packages/asyncpg/connect_utils.py", line 780, in _connect_addr raise asyncio.TimeoutError asyncio.exceptions.TimeoutError
and after some time, it gets back to normal.
The text was updated successfully, but these errors were encountered: