Re: Logging broken messages

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rui Pacheco <rui(dot)pacheco(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Logging broken messages
Date: 2017-02-07 20:12:41
Message-ID: 20777.1486498361@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Steve Atkins <steve(at)blighty(dot)com> writes:
>> On Feb 6, 2017, at 9:21 AM, Rui Pacheco <rui(dot)pacheco(at)gmail(dot)com> wrote:
>> I’m trying to implement a version of the wire protocol but I’ve hit a problem: whenever I send a Close Statement message to the remote, it just hangs indefinitely. I suspect the problem could be on my side but I can’t find anything on my code that doesn’t match the manual.
>>
>> Is there a way to configure Postgres to debug this? I’ve tried setting a number of log parameters but nothing shows up on syslog:

> Wireshark has a v3 postgresql protocol dissector. It might be worth comparing your code with libpq and see if anything looks different.

Also, you could try attaching to the connected backend with gdb and
look at where it's waiting.

To cut to the chase, though: I'd bet you are either sending a wrong
message length word, or failing to flush your buffer out to the socket.
Either way the backend would be sitting waiting to accumulate the
full message. If it had what it thought was a complete message, it
would be doing something with it --- either executing it or complaining.
But it doesn't really make any attempt to validate an incoming message
until it's got all of it as per the length word.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Patrick B 2017-02-08 02:52:16 FATAL: remaining connection slots are reserved for non-replication superuser connections
Previous Message Steve Atkins 2017-02-07 20:05:00 Re: Logging broken messages