Re: PostgreSQL client hangs sometimes on 'EXEC SQL PREPARE sid_sisisinst FROM :select_anw;'

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Matthias Apitz <guru(at)unixarea(dot)de>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: PostgreSQL client hangs sometimes on 'EXEC SQL PREPARE sid_sisisinst FROM :select_anw;'
Date: 2020-05-10 15:33:41
Message-ID: 9787.1589124821@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Matthias Apitz <guru(at)unixarea(dot)de> writes:
> 1. In addition to the above code, can I get somehow the connecting client's PID? If

Not in any portable way. If you believe that the offending client is on
the local system, you could try building something involving netstat,
lsof, etc. getpeereid() might be useful too.

> 2. Can I get something out of the buffer of the startup packet?

I'm fairly sure that at the point where the error is thrown, we've
only read the putative length word, so there's nothing buffered.
But sure, you could try to collect whatever is available from the
socket and dump that --- probably a hex dump would be advisable,
because it'll contain \0 bytes. Seems like a good idea.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mary Johnson 2020-05-10 18:27:07 what to log in csvlogs
Previous Message Matthias Apitz 2020-05-10 10:52:26 Re: PostgreSQL client hangs sometimes on 'EXEC SQL PREPARE sid_sisisinst FROM :select_anw;'