Frequent freezes occuring with no apparent changes #6298
Replies: 1 comment 3 replies
-
hi - information about the environment is the start. What kind of application is it? command line, web application, daemon process? what kind of web container / server container / etc are in use? What kind of async frameworks etc. are in use ? Does the program have this freeze while it is doing exactly just this one thing at a time or are there other concurrent awaitables in progress? how many database connections are in play at at a time when this freeze occurs? your pool is configured to allow as many as 26 connections at once. if your program reaches for a 27th connection, that awaitable will pause until a connection is available. are you configured to run more concurrent awaitables than 26 ? does the program use any other concurrency systems in addtion to awaitables? like threads, thread executors, multiprocessing, fork, etc? Or does the application environent / web container / etc use these things? during the freeze, what is shown in the database? E.g. select from pg_stat_activity while the freeze occurs. are transactions from the relevant pids in progress? what is their status? |
Beta Was this translation helpful? Give feedback.
-
Hello,
I am starting this discussion as a we are recently experiencing frequent freezes with SQLAlchemy's async engine.
The engine was created with the following parameters
The dialect is postgresql and the driver is asynccpg. However, we were able of reproducing the same problem with mysql and aiomysql. The code below shows how the insert operations are performed. We also tried a version with rollback() but it did not make a difference.
We also note that the timeout set in line
connect_args={'timeout': 3},
does not have any effect once the freeze happens.Initially we believed that we are dealing with a deadlock on the database site, but nothing could be found in the logs. There are also no issues with memory or CPU load.
Finally, the log looks as follows:
Insertions are the only operation type and all queries look as follows:
INSERT INTO "SENSOR_#" (id, value, unit, timestamp, source) VALUES (:id, :value, :unit, :timestamp, :source)'
The number of insertions per second average at around 34, but there are short bursts where we end up with over 100 insertions per second.
We are trying to troubleshoot this issue for 10 days already but to no avail. Any help or hint is welcome
Thank you in advance
Beta Was this translation helpful? Give feedback.
All reactions