Re: PostgreSQL 17: Bug in libpq when libpq is dlopened/closed multiple times

From: Nico Williams <nico(at)cryptonector(dot)com>
To: Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Daniel Schreiber <daniel(dot)schreiber(at)hrz(dot)tu-chemnitz(dot)de>
Subject: Re: PostgreSQL 17: Bug in libpq when libpq is dlopened/closed multiple times
Date: 2026-04-22 19:22:09
Message-ID: aekf4cx42tNs6C0j@ubby
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Wed, Apr 22, 2026 at 11:29:04AM -0700, Jacob Champion wrote:
> > (I'd be surprised if this were the only such resource leak across all
> > supported versions and combinations of Kerberos, OpenSSL, OpenLDAP,
> > Curl, etc. etc. From a quick search, you're the first to report this
> > in the ten years since the leak was introduced, so there may be more
> > dragons where you're headed.)
>
> If anyone has thoughts on that, I'd love to hear them. I don't mind
> removing this unnecessary code in HEAD, or even backpatching as a
> courtesy -- but if it were up to me, I would not guarantee zero global
> resource leaks across libpq and its entire dependency graph. (Even if
> we magically had control over all those dependencies, I think it'd
> still be reasonable for libpq devs to use "allocate once and move on"
> patterns... and I want to continue using those in my new code.)

Leaking a dl handle is a way to prevent unloading. Not saying that's a
great answer, just that it's a workaround.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2026-04-22 19:23:53 Re: PostgreSQL 17: Bug in libpq when libpq is dlopened/closed multiple times
Previous Message Jacob Champion 2026-04-22 18:29:04 Re: PostgreSQL 17: Bug in libpq when libpq is dlopened/closed multiple times

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2026-04-22 19:23:53 Re: PostgreSQL 17: Bug in libpq when libpq is dlopened/closed multiple times
Previous Message Jeff Davis 2026-04-22 19:18:48 GUC parameter ACLs and physical walsender