-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Description
Hi,
I recently opened this issue due to server availability problems, when using CVAT version 2.11.2, caused by reaching the maximum number of connections (200, which I increased to 500). After successfully monitoring all the connected IPs, I proceeded to check active connections to the cvat_db, and noticed many idle connections, like the ones shown below:
psql cvat
SELECT pid, usename, datname, state, query, state_change FROM pg_stat_activity order by state_change;
pid | usename | datname | state | query | state_change
----+----------+----------+-----+-------+--------------
... | anonymized | cvat | idle | SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."id" = 1 LIMIT 21 | 2025-02-24 08:19:29.901414+00
... | anonymized | cvat | idle | SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."id" = 1 LIMIT 21 | 2025-02-24 07:36:58.635467+00
... | anonymized | cvat | idle | SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."id" = 1 LIMIT 21 | 2025-02-21 18:53:09.882007+00Although I show just three connections here, there are 53 connections in total, and only one of them is active. Currently, one user is labeling, which is why there should be at least one active connection.
When I run the query above, the following result is printed::
SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."id" = 1 LIMIT 21;
id | password | last_login | is_superuser | username | first_name | last_name | email | is_staff | is_active | date_joined
---+-----------+----------+--------------+-----------+------------+-----------+------+--------+---------+-------------
1 | anonymized_pwd | 2025-02-21 18:43:35.628501+00 | t | anonymized_user | | | | t | t | 2024-04-02 08:14:00.765091+00
(1 row)Could you help me understand the origin of these idle connections? What could be causing them to stay in an idle state? Any guidance on how to address this issue would be greatly appreciated.
Thanks in advance. Cheers,
Manuel