public inbox for [email protected]  
help / color / mirror / Atom feed
From: Peter Eisentraut <[email protected]>
To: Heikki Linnakangas <[email protected]>
To: solai v <[email protected]>
To: Jacob Champion <[email protected]>
Cc: Mark Dilger <[email protected]>
Cc: Andres Freund <[email protected]>
Cc: Lars Kanis <[email protected]>
Cc: [email protected]
Cc: Merlin Moncure <[email protected]>
Subject: Re: libpq: Process buffered SSL read bytes to support records >8kB on async API
Date: Wed, 8 Jul 2026 21:16:18 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<CAOYmi+=jZNU9mZ4Z83aR0RiqZ2pF35u5040gCxBgcFqoA4oNbQ@mail.gmail.com>
	<CAOYmi+mpymrgZ76Jre2dx_PwRniS9YZojwH0rZnTuiGHCsj0rA@mail.gmail.com>
	<CAOYmi+=kbb7pV7k7RfWUcFt=CArJmp1R+R1Xnb8UnZLwpFgOwA@mail.gmail.com>
	<CAOYmi+==Y5ZZiwukN-wzGCyxdrL1dU3wOG-j0nza3MC3R2XhcA@mail.gmail.com>
	<kl6inl3iyycxqpiedmnnzaz2ytid5dw6knwwqk5plg6ej34oi6@fbyu4ll7ebzn>
	<CAOYmi+kZhv_LCg=g8Z6xtiueSYdz1fCvrXwAJ-i9m3VMm9_tXw@mail.gmail.com>
	<CAOYmi+mD6EbDEYfwZON0FCUAvGO+2=jR2V4KQYx+d+g0ap0Amg@mail.gmail.com>
	<CAOYmi+=YJ2J_sQ6yS8y1o9AX1Xgz35_r0hApV8QRWwi1K8gC0g@mail.gmail.com>
	<[email protected]>
	<CAHgHdKseseJG0j_96xrOuP3LgubvGScvXsQyPCYWANnBxTL4tA@mail.gmail.com>
	<[email protected]>
	<CAF0whuf=-G3SwXSTWyZNO148qoaEmth71cM7XBuX4X+2PnQkPQ@mail.gmail.com>
	<[email protected]>
	<[email protected]>

On 07.07.26 17:58, Heikki Linnakangas wrote:
> On 03/07/2026 12:25, Heikki Linnakangas wrote:
>> On 14/05/2026 07:32, solai v wrote:
>>> Hi,
>>> i tested the latest V3 patch series on current postgreSQL HEAD with 
>>> SSL enabled.The patches applied cleanly,build succeeded,and the 
>>> server started successfully.I ran the async libpq test repeatedly and 
>>> also tested large COPY TO STDOUT operations over SSL.I did not 
>>> observe hangs,crashes,or visible regressions during testing.
>>
>> Thanks for the testing!
>>
>> Here's another patch version, with some small comment and commit 
>> message changes, and I split the changes slightly differently between 
>> the two patches. End result is otherwise the same.
>>
>> I plan to commit this in the next few days.
> 
> Committed and backpatched to all supported versions. Thanks everyone!

In pqDrainPending(), there is

     nread = pqsecure_read(conn, conn->inBuffer + conn->inEnd,
                           bytes_pending);
     conn->inEnd += nread;

But pqsecure_read() can return -1 for error.  So adding that to 
conn->inEnd at that point seems wrong.

There is error handling in the following code, but this would still kind 
of corrupt the conn->inEnd value?

     /* When there are bytes pending, the read function is not supposed 
to fail */
     if (nread != bytes_pending)
     {
         libpq_append_conn_error(conn,
                                 "drained only %zu of %zd pending bytes 
in transport buffer",
                                 nread, bytes_pending);
         return -1;
     }

I'm not sure if that comment means that a -1 return cannot happen?  Or 
just that the whole error check should not happen?

Also note that the format placeholder for nread is wrong.  If you do get 
a -1, it will print some large unsigned value.







view thread (10+ messages)  latest in thread

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: libpq: Process buffered SSL read bytes to support records >8kB on async API
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox