| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Matt Carter <Matt(dot)Carter(at)twosigma(dot)com> |
| Cc: | Andres Freund <andres(at)anarazel(dot)de>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: BUG #19411: libpq 16.x exhibits a memory leak when connections are repeatedly created and destroyed |
| Date: | 2026-10-30 16:55:00 |
| Message-ID: | 2601836.1793379300@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Matt Carter <Matt(dot)Carter(at)twosigma(dot)com> writes:
> Tom Lane wrote:
>> I propose changing its name altogether, as attached.
> Thanks, Tom. I tested your patch against my GSSAPI-authenticated server (MIT krb5 1.20.1, OpenSSL 1.1). It applies to 18.3 with line offsets and builds without warnings. Using the reproducer from my previous message, these are the bytes per connection still allocated after warm-up (450 connections):
> 18.3 unpatched 17844
> 18.3 + your patch 108
> 18.3 + your patch, gssencmode=disable 42
> GSSAPI authentication works as before.
Thanks for testing that, but after looking closer, I believe that
pg_GSS_continue has even more problems here. It will attempt to
acquire credentials whether or not GSS delegation is enabled,
contrary to the adjacent comment and unlike what happens in
pqsecure_open_gss. And if GSS delegation is enabled, it will
set the GSS_C_DELEG_FLAG whether or not it was able to acquire
credentials, which seems not very sane and again different from
the logic in pqsecure_open_gss. So I think what we really need
is more like the attached. This passes our own test suite, but
I wonder if you can exercise it in your own environment.
> We would benefit from back-patches to 16 and 17:
Yeah, this problem was visibly introduced in v16 when we added
GSS delegation support, so I anticipate back-patching that far.
regards, tom lane
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-libpq-handle-GSS-credentials-more-sanely.patch | text/x-diff | 6.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2026-10-30 17:36:56 | Re: BUG #19411: libpq 16.x exhibits a memory leak when connections are repeatedly created and destroyed |
| Previous Message | Tom Lane | 2026-10-30 13:48:19 | Re: crash in ltree_compare_distance() in 14.24 |