From: Tom Lane <tgl@sss.pgh.pa.us>
To: Matthias Apitz <guru@unixarea.de>
Cc: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: client waits for end of update operation and server proc is idle
Date: Sun, 25 Apr 2021 11:51:45 -0400
Message-ID: <1935464.1619365905@sss.pgh.pa.us> (raw)
In-Reply-To: <YIWM0LlZF0mwlemB@c720-r368166.fritz.box>
References: <YIKCCXcEozx9iiBU@c720-r368166.fritz.box>
<0551daad25ee518071e002ca17c4b6dac08a236c.camel@cybertec.at>
<YIKUEg8Eo0DchREa@c720-r368166.fritz.box>
<YIVYich/4L12jk3a@c720-r368166.fritz.box>
<YIWM0LlZF0mwlemB@c720-r368166.fritz.box>
Matthias Apitz <guru@unixarea.de> writes:
> At the end of the day, it turned out that out client caused the problem.
> Because we were hunting some other issue, the client was logging some
> message with fprintf(stderr, ...) but the fd=2 was not stderr, fd=2 was the
> connection to the socket of the PostgreSQL server. And ofc the Pos
> server could not understand our human message.
Hmph. So why wasn't this visible in the tcpdump trace?
My initial thought was that the server process should log a message
and drop the connection once it received something that didn't look
like a valid Postgres-protocol message, on the assumption that
message-boundary sync could never be recovered reliably. But on
further thought, it would start by taking the second through fifth
bytes of the input as a message length, and it wouldn't really do
anything interesting until it had collected that much input ---
and, if those bytes were text, that would look like a large number.
So what the server is really doing is waiting for the rest of the
imaginary message, which will never arrive.
Maybe we should have more sanity checking on alleged message lengths.
I recall there is some checking of that sort in libpq, but I'm less
sure about the server.
regards, tom lane
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-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, guru@unixarea.de, laurenz.albe@cybertec.at
Subject: Re: client waits for end of update operation and server proc is idle
In-Reply-To: <1935464.1619365905@sss.pgh.pa.us>
References: <YIKCCXcEozx9iiBU@c720-r368166.fritz.box> <0551daad25ee518071e002ca17c4b6dac08a236c.camel@cybertec.at> <YIKUEg8Eo0DchREa@c720-r368166.fritz.box> <YIVYich/4L12jk3a@c720-r368166.fritz.box> <YIWM0LlZF0mwlemB@c720-r368166.fritz.box> <1935464.1619365905@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