Re: setBinaryStream can abandon connection - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: setBinaryStream can abandon connection
Date
Msg-id 4172E3AC.1040102@opencloud.com
Whole thread Raw
In response to Re: setBinaryStream can abandon connection  (Kris Jurka <books@ejurka.com>)
Responses Re: setBinaryStream can abandon connection
List pgsql-jdbc
Kris Jurka wrote:

> The message length will not cause the backend to allocate large amounts of
> memory, the individual parameter lengths are what actually allocates
> memory.

Are you sure about this? I see in pq_getmessage (called from the main
backend loop via SocketBackend):

if (len > 0)
{
     /* Allocate space for message */
     enlargeStringInfo(s, len);

     /* And grab the message */
     if (pq_getbytes(s->data, len) == EOF)
     // ...
}

'len' is the total packet length, not a per-parameter length.

> So if we don't have a problem with a broken connection we don't actually
> need to check for these errors because they don't do anything terrible,
> but obviously I believe a broken connection is bad.

I'd still like to see a more useful error message in the overflow case.
We really shouldn't be generating a negative message length in the first
place.

-O

pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: setBinaryStream can abandon connection
Next
From: Kris Jurka
Date:
Subject: Re: setBinaryStream can abandon connection