pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jacob Champion <jacob.champion@enterprisedb.com>
Cc: Matt Carter <Matt.Carter@twosigma.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #19411: libpq 16.x exhibits a memory leak when connections are repeatedly created and destroyed
Date: Fri, 30 Oct 2026 17:04:33 -0400
Message-ID: <2751951.1793394273@sss.pgh.pa.us> (raw)
In-Reply-To: <CAOYmi+=G-k=Tupx2F-8qWyVy=sYB+tmtV81LUEi0rXu55hzBFg@mail.gmail.com>
References: <19411-0440c8897a04b638@postgresql.org>
	<1702505.1771347709@sss.pgh.pa.us>
	<BL3PR08MB728301C87997AF17C743633A996DA@BL3PR08MB7283.namprd08.prod.outlook.com>
	<1881734.1771354069@sss.pgh.pa.us>
	<6xylkfh6idnx7ujhfhyoxku3v67ygoeve4yt7z2ytc65vzwvcv@z2sj5jnamhbe>
	<BL3PR08MB72830323C3ED904202F002E0996E2@BL3PR08MB7283.namprd08.prod.outlook.com>
	<2114661.1793306838@sss.pgh.pa.us>
	<BL3PR08MB728371A661250E2282D5FD0E996E2@BL3PR08MB7283.namprd08.prod.outlook.com>
	<2601836.1793379300@sss.pgh.pa.us>
	<CAOYmi+=fdEq0VMx0Rqn=5C06wLdZ-h_5_xR2eWHFGv1O_Hg0QQ@mail.gmail.com>
	<2744647.1793388749@sss.pgh.pa.us>
	<CAOYmi+=G-k=Tupx2F-8qWyVy=sYB+tmtV81LUEi0rXu55hzBFg@mail.gmail.com>

Jacob Champion <jacob.champion@enterprisedb.com> writes:
> On Fri, Oct 30, 2026 at 12:32 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> How can delegation succeed if there's nothing to delegate?

> IIUC, GSS_C_NO_CREDENTIAL doesn't actually mean "no credentials" to
> gss_init_sec_context(), it means "get the default credentials from
> somewhere magic." I don't know enough about the API to know whether
> the gss_acquire_cred() call we're making separately is equivalent to
> that magic behavior.

Oh, that's very interesting!

If you look back at v14, there is just one call to 
pg_GSS_have_cred_cache, and AFAICS it happens unconditionally if
we attempt GSS encryption, and we don't reach any other
GSS code if it fails.

In the code as it stands, my coverage result says it's possible to
reach pg_GSS_continue without having already obtained credentials, but
I don't quite see how.  select_next_encryption_method doesn't look
like it will permit using ENC_GSSAPI unless we obtain credentials.

Too bad this code is so poorly documented.  It's really pretty unclear
what the intent is.

			regards, tom lane






view thread (17+ messages)

Message-ID: <2751951.1793394273@sss.pgh.pa.us>
Permalink:  ../2751951.1793394273@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2751951.1793394273@sss.pgh.pa.us

 · 

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 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-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jacob.champion@enterprisedb.com, Matt.Carter@twosigma.com, andres@anarazel.de
  Subject: Re: BUG #19411: libpq 16.x exhibits a memory leak when connections are repeatedly created and destroyed
  In-Reply-To: <2751951.1793394273@sss.pgh.pa.us>
  References: <19411-0440c8897a04b638@postgresql.org> <1702505.1771347709@sss.pgh.pa.us> <BL3PR08MB728301C87997AF17C743633A996DA@BL3PR08MB7283.namprd08.prod.outlook.com> <1881734.1771354069@sss.pgh.pa.us> <6xylkfh6idnx7ujhfhyoxku3v67ygoeve4yt7z2ytc65vzwvcv@z2sj5jnamhbe> <BL3PR08MB72830323C3ED904202F002E0996E2@BL3PR08MB7283.namprd08.prod.outlook.com> <2114661.1793306838@sss.pgh.pa.us> <BL3PR08MB728371A661250E2282D5FD0E996E2@BL3PR08MB7283.namprd08.prod.outlook.com> <2601836.1793379300@sss.pgh.pa.us> <CAOYmi+=fdEq0VMx0Rqn=5C06wLdZ-h_5_xR2eWHFGv1O_Hg0QQ@mail.gmail.com> <2744647.1793388749@sss.pgh.pa.us> <CAOYmi+=G-k=Tupx2F-8qWyVy=sYB+tmtV81LUEi0rXu55hzBFg@mail.gmail.com> <2751951.1793394273@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