pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Matthias Apitz <guru@unixarea.de>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: PostgreSQL client hangs sometimes on 'EXEC SQL PREPARE sid_sisisinst FROM :select_anw;'
Date: Sun, 10 May 2020 11:33:41 -0400
Message-ID: <9787.1589124821@sss.pgh.pa.us> (raw)
In-Reply-To: <20200510105226.GA14033@sh4-5.1blu.de>
References: <20200427122123.GA11416@sh4-5.1blu.de>
	<5198.1587991204@sss.pgh.pa.us>
	<20200427130618.GA24964@sh4-5.1blu.de>
	<20200427131955.GB24964@sh4-5.1blu.de>
	<20200428081018.GB4007@sh4-5.1blu.de>
	<20200510105226.GA14033@sh4-5.1blu.de>

Matthias Apitz <guru@unixarea.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





view thread (19+ messages)  latest in thread

Message-ID: <9787.1589124821@sss.pgh.pa.us>
Permalink:  ../9787.1589124821@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/9787.1589124821@sss.pgh.pa.us

 · 

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 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
  Subject: Re: PostgreSQL client hangs sometimes on 'EXEC SQL PREPARE sid_sisisinst FROM :select_anw;'
  In-Reply-To: <9787.1589124821@sss.pgh.pa.us>
  References: <20200427122123.GA11416@sh4-5.1blu.de> <5198.1587991204@sss.pgh.pa.us> <20200427130618.GA24964@sh4-5.1blu.de> <20200427131955.GB24964@sh4-5.1blu.de> <20200428081018.GB4007@sh4-5.1blu.de> <20200510105226.GA14033@sh4-5.1blu.de> <9787.1589124821@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