# Too many idle wsrelay-awx-tasks

**URL:** <https://forum.ansible.com/t/too-many-idle-wsrelay-awx-tasks/5232>\
**Category:** Get Help\
**Tags:** awx\
**Created:** [May 1, 2024, 12:36am UTC](https://forum.ansible.com/t/too-many-idle-wsrelay-awx-tasks/5232 "2024-05-01T00:36:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mimianddaniel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/mimianddaniel/32/2123_2.png) [@mimianddaniel](https://forum.ansible.com/u/mimianddaniel)\
**Post date:** [May 1, 2024, 12:36am UTC](https://forum.ansible.com/t/too-many-idle-wsrelay-awx-tasks/5232/1 "2024-05-01T00:36:43Z")

</div>

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

```auto
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?

---

<div class="post-metadata">

**Author:** ![TheRealHaoLiu](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/therealhaoliu/32/100_2.png) [@TheRealHaoLiu](https://forum.ansible.com/u/TheRealHaoLiu)\
**Post date:** [May 1, 2024, 3:26pm UTC](https://forum.ansible.com/t/too-many-idle-wsrelay-awx-tasks/5232/2 "2024-05-01T15:26:46Z")

</div>

we recently had a connection leak in wsrelay code [Fix wsrelay connection leak by TheRealHaoLiu · Pull Request #15113 · ansible/awx · GitHub](https://github.com/ansible/awx/pull/15113)  
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?

---

<div class="post-metadata">

**Author:** ![mimianddaniel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/mimianddaniel/32/2123_2.png) [@mimianddaniel](https://forum.ansible.com/u/mimianddaniel)\
**Post date:** [May 1, 2024, 10:29pm UTC](https://forum.ansible.com/t/too-many-idle-wsrelay-awx-tasks/5232/3 "2024-05-01T22:29:57Z")

</div>

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.

> <https://github.com/ansible/awx/blob/20f054d600689c8c016bce83f8445f3c9b5cffb3/awx/settings/defaults.py#L42-L47>

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

---

<div class="post-metadata">

**Author:** ![TheRealHaoLiu](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/therealhaoliu/32/100_2.png) [@TheRealHaoLiu](https://forum.ansible.com/u/TheRealHaoLiu)\
**Post date:** [May 2, 2024, 3:14am UTC](https://forum.ansible.com/t/too-many-idle-wsrelay-awx-tasks/5232/4 "2024-05-02T03:14:55Z")

</div>

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

it doesn’t result in db query [PostgreSQL: Documentation: 16: 20.3.&nbsp;Connections and Authentication](https://www.postgresql.org/docs/current/runtime-config-connection.html#RUNTIME-CONFIG-TCP-SETTINGS)

---

<div class="post-metadata">

**Author:** ![mimianddaniel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/mimianddaniel/32/2123_2.png) [@mimianddaniel](https://forum.ansible.com/u/mimianddaniel)\
**Post date:** [May 2, 2024, 4:42am UTC](https://forum.ansible.com/t/too-many-idle-wsrelay-awx-tasks/5232/5 "2024-05-02T04:42:47Z")

</div>

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