public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: Re: BUG #19411: libpq 16.x exhibits a memory leak when connections are repeatedly created and destroyed
Date: Tue, 17 Feb 2026 12:01:49 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
PG Bug reporting form <[email protected]> writes:
> This report is for the libpq client library for PostgreSQL.
> I noticed the issue because my Apache Airflow task supervisor processes were
> experiencing memory growth of ~600 KB/min. When running hundreds of tasks,
> my 32 GB machine OOM-crashed every few hours. I traced the problem to when
> I upgraded libpq from version 13 to 16. Varying Python version, and
> PostgreSQL DB version didn't make a difference. When I updated to psycopg3,
> the leak rate dropped dramatically.
I think there are way too many moving parts here, and too few
configuration details, to allow assigning blame confidently.
I tried making a simple C test program that just connected, issued
BEGIN/UPDATE/COMMIT, and disconnected in a tight loop. I see zero
leakage with that. So either the leak isn't actually in libpq, or
there's some critical environmental factor you didn't mention.
Plausible such factors include connection type and authentication
method. (For example, years ago libpq did leak memory while using
GSSAPI encryption.) I tried both regular and SSL connections but
didn't really push hard on that, since I'd just be guessing blindly
about what your setup is.
regards, tom lane
reply
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 using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: BUG #19411: libpq 16.x exhibits a memory leak when connections are repeatedly created and destroyed
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox