Too many idle wsrelay-awx-tasks

Hi,

Running AWX 23.7.0 with external backend. See high number of idle connections with application name awx-somenumbers-wsrelay-awx-tasks with query

SELECT "conf_setting"."id", "conf_setting"."created", "conf_setting"."modified", "conf_setting"."key", "conf_setting"."value", "conf_setting"."user_id" FROM "conf_setting" WHERE ("conf_setting"."key" = 'LOG_AGGREGATOR_LOGGERS' AND "conf_setting"."user_id" IS NULL) ORDER BY "conf_setting"."id" ASC LIMIT 1

Is there a way to reduce the keepalive for these connections? and possibly manage the number of connections made per task awx-task?

we recently had a connection leak in wsrelay code Fix wsrelay connection leak by TheRealHaoLiu · Pull Request #15113 · ansible/awx · GitHub
but your version predated the PR that introduced the connection leak

can you query pg_stat_activity to see if there’s a(nother) connection leak?

1 Like

only long lasting queries i see are

SELECT "conf_setting"."id", "conf_setting"."created", "conf_setting"."modified", "conf_setting"."key", "conf_setting"."value", "conf_setting"."user_id" FROM "conf_setting" WHERE ("conf_setting"."key" = 'LOG_AGGREGATOR_ENABLED' AND "conf_setting"."user_id" IS NULL) ORDER BY "conf_setting"."id" AS LIMIT 1

for either rsyslog or wsrelay from the task pods.

other queries are either LISTEN or heartbeat which I think are normal to be long to keepalive.

Could this setting be overridden per app like wsrelay or rsyslog?

the config ur referring to is TCP keepalive for the database connection

it doesn’t result in db query PostgreSQL: Documentation: 16: 20.3. Connections and Authentication

Shouldn’t these idle DB connections be closed once the query is run? hence my question on TCP settings to the DB.