Re: PostgreSQL 17: Bug in libpq when libpq is dlopened/closed multiple times - Mailing list pgsql-hackers

From Jacob Champion
Subject Re: PostgreSQL 17: Bug in libpq when libpq is dlopened/closed multiple times
Date
Msg-id CAOYmi+nJ19kj4bnyyX66VpvTPhjaGVWGvPsyVQdnV=R6aLGo0A@mail.gmail.com
Whole thread
In response to Re: PostgreSQL 17: Bug in libpq when libpq is dlopened/closed multiple times  (Nico Williams <nico@cryptonector.com>)
List pgsql-hackers
On Wed, Apr 22, 2026 at 12:22 PM Nico Williams <nico@cryptonector.com> wrote:
> Leaking a dl handle is a way to prevent unloading.  Not saying that's a
> great answer, just that it's a workaround.

Hmm, I did that for our handle to libpq-oauth, but I imagine that
leaking a handle to _ourselves_ may make someone very unhappy with us
at some point? Plus, it might kick off the tiniest, most pointless
arms race:

    // why does libpq do this
    dlclose(libpq_handle);
    dlclose(libpq_handle);

I guess we could play around with RTLD_NODELETE... Something to keep
in the back pocket, maybe?

--Jacob



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [RFC][PATCH] Order qual clauses by combined cost and selectivity
Next
From: Jacob Champion
Date:
Subject: Re: PostgreSQL 17: Bug in libpq when libpq is dlopened/closed multiple times