From: Tom Lane <tgl@sss.pgh.pa.us>
To: James Sewell <james.sewell@jirotech.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Max connections reached without max connections reached
Date: Tue, 23 Nov 2021 10:33:27 -0500
Message-ID: <4176160.1637681607@sss.pgh.pa.us> (raw)
In-Reply-To: <CAANVwEt-jwj_5axSJ5M9fOJRtW_1iXqBhsnK+Fofc09hhmsZJA@mail.gmail.com>
References: <CAANVwEt-jwj_5axSJ5M9fOJRtW_1iXqBhsnK+Fofc09hhmsZJA@mail.gmail.com>
James Sewell <james.sewell@jirotech.com> writes:
> The system handles a lot of connections - we have a max_connections of 600.
> Most are long lived JDBC, but there are a lot of ETL / ad-hoc jobs etc.
> Connections normally sit at 300ish, with 70 active at the most. The
> machines have 32 CPU cores . PgBouncer is sadly not an option hereas we are
> using many long lived connections which make use of prepared statements.
> Sometimes a strange condition occurs. The number of connections is well
> under 600 (and dropping), but new connections are not being allowed into
> the database, I can see this message in the logs:
> (0:53300)FATAL: remaining connection slots are reserved for
> non-replication superuser connections
What are you looking at to claim the number of connections is under 600?
Maybe there's some disconnect between what you're measuring and what the
database thinks.
A different line of thought is that ProcArray slots can be consumed by
things that aren't client connection processes, in particular
(1) parallel-query workers
(2) autovacuum workers
Looking into pg_stat_activity when you see this issue might help
clarify that.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, james.sewell@jirotech.com
Subject: Re: Max connections reached without max connections reached
In-Reply-To: <4176160.1637681607@sss.pgh.pa.us>
References: <CAANVwEt-jwj_5axSJ5M9fOJRtW_1iXqBhsnK+Fofc09hhmsZJA@mail.gmail.com> <4176160.1637681607@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox