# FATAL: too many connections for role "kong"

**URL:** <https://discuss.konghq.com/t/fatal-too-many-connections-for-role-kong/4602>\
**Category:** Questions\
**Created:** [October 9, 2019, 6:07pm UTC](https://discuss.konghq.com/t/fatal-too-many-connections-for-role-kong/4602 "2019-10-09T18:07:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![reloaded](https://avatars.discourse-cdn.com/v4/letter/r/51bf81/32.png) [@reloaded](https://discuss.konghq.com/u/reloaded)\
**Post date:** [October 9, 2019, 6:07pm UTC](https://discuss.konghq.com/t/fatal-too-many-connections-for-role-kong/4602/1 "2019-10-09T18:07:41Z")

</div>

Hello,

I’m running Kong in DB mode with Postgres and I’m finding it’s exhausting all my DB connections. My suspicion is that Kong isn’t releasing/closing DB connections properly after it uses them.

I’ve setup a “kong” postgres user that’s the owner of the “kong” database. I set the max\_connections for the “kong” PG user to 200. Seems like 200 max connections should be more than enough for an API gateway proxy.

However, frequently Kong is throwing an error like the one below.

> 2019/10/09 17:54:05 [error] 31#0: \*37149566 [kong] init.lua:98 FATAL: too many connections for role “kong”, client: 127.0.0.1, server: kong\_admin, request: “GET /services HTTP/1.1”, host: “localhost:8444”

1. Is the Kong Admin API the only component that connects to the DB or does Kong ingress controller connect to the DB too?

2. Assuming Kong is properly closing its DB connections what would you recommend for max\_connections? Disabling max\_connection on the “kong” DB user results in all PG connection slots being exhausted and my other apps fail to acquire a DB connection because Kong takes all the connection slots.

3. Is there any other suggestions you’d recommend to resolve this issue?

---

<div class="post-metadata">

**Author:** ![p0pr0ck5](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/p0pr0ck5/32/987_2.png) [@p0pr0ck5](https://discuss.konghq.com/u/p0pr0ck5)\
**Post date:** [October 11, 2019, 12:19am UTC](https://discuss.konghq.com/t/fatal-too-many-connections-for-role-kong/4602/2 "2019-10-11T00:19:50Z")

</div>

Have a look at the `pg_max_concurrent_queries` config value ([https://docs.konghq.com/1.3.x/configuration/#postgres-settings](https://docs.konghq.com/1.3.x/configuration/#postgres-settings)); it was implemented exactly for this problem 🙂

---

<div class="post-metadata">

**Author:** ![leslie](https://avatars.discourse-cdn.com/v4/letter/l/ba8739/32.png) [@leslie](https://discuss.konghq.com/u/leslie)\
**Post date:** [October 28, 2021, 2:04am UTC](https://discuss.konghq.com/t/fatal-too-many-connections-for-role-kong/4602/3 "2021-10-28T02:04:16Z")

</div>

I tried this config in my test environment, and it does not work

---

<div class="post-metadata">

**Author:** ![kapil\_jain](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/kapil_jain/32/5062_2.png) [@kapil\_jain](https://discuss.konghq.com/u/kapil_jain)\
**Post date:** [October 29, 2025, 2:42am UTC](https://discuss.konghq.com/t/fatal-too-many-connections-for-role-kong/4602/4 "2025-10-29T02:42:52Z")

</div>

We’re facing the same issue since last week in production.

We’re running kong gateway as KIC setup with both proxy and ingress containera running inside pod replicated to 3 on separate worker nodes. DB is postgres and on progress max connections settings it is allowed to have 1000 max connections.

Twice kong gateway has restarted with errors showing the same error- too many connections for the Role kong. Errors keep on occurring resulting to auto pod restart. As checked on Postgres end max connections reached to only 50-55.

Can anyone help here to check what’s wrong with Kong? And how to troubleshoot why kong is restarting without reaching to postgres max connections limit.
