Re: libpqrcv_connect() leaks PGconn

From: Noah Misch <noah(at)leadboat(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: libpqrcv_connect() leaks PGconn
Date: 2023-01-22 07:14:08
Message-ID: 20230122071408.GB1400215@rfd.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Jan 21, 2023 at 12:04:53PM -0800, Andres Freund wrote:
> On 2023-01-21 08:16:42 -0800, Noah Misch wrote:
> > On Fri, Jan 20, 2023 at 06:50:37PM -0800, Andres Freund wrote:
> > > I seems we don't have any tests for creating a subscription that fails during
> > > connection establishment? That doesn't seem optimal - I guess there may have
> > > been concern around portability of the error messages?
> >
> > Perhaps. We have various (non-subscription) tests using "\set VERBOSITY
> > sqlstate" for that problem. If even the sqlstate varies, a DO block is the
> > next level of error swallowing.
>
> That's a good trick I need to remember. And the errcode for an invalid
> connection string luckily differs from the one for a not working one.
>
>
> I think found an even easier way - port=-1 is rejected during PQconnectPoll()
> and will never even open a socket. That'd make it reasonable for the test to
> happen in subscription.sql, instead of a tap test, I think (faster, easier to
> maintain). It may be that we'll one day move that error into the
> PQconninfoParse() phase, but I don't think we need to worry about it now.
>
> Any reason not to go for that?

No, a port=-1 test in subscription.sql sounds ideal.

> If not, I'll add a test for an invalid conninfo and a non-working connection
> string to subscription.sql.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2023-01-22 09:49:57 Re: run pgindent on a regular basis / scripted manner
Previous Message Andres Freund 2023-01-22 07:05:45 Re: run pgindent on a regular basis / scripted manner