Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jXny9-0001Xm-3Y for pgsql-general@arkaria.postgresql.org; Sun, 10 May 2020 15:34:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jXnxc-0006Zn-BP for pgsql-general@arkaria.postgresql.org; Sun, 10 May 2020 15:33:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jXnxc-0006Zc-3O for pgsql-general@lists.postgresql.org; Sun, 10 May 2020 15:33:48 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jXnxY-0001Ob-TK for pgsql-general@lists.postgresql.org; Sun, 10 May 2020 15:33:47 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 04AFXf56009788; Sun, 10 May 2020 11:33:41 -0400 From: Tom Lane To: Matthias Apitz cc: pgsql-general@lists.postgresql.org Subject: Re: PostgreSQL client hangs sometimes on 'EXEC SQL PREPARE sid_sisisinst FROM :select_anw;' 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> Comments: In-reply-to Matthias Apitz message dated "Sun, 10 May 2020 12:52:26 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <9786.1589124821.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 10 May 2020 11:33:41 -0400 Message-ID: <9787.1589124821@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Matthias Apitz writes: > 1. In addition to the above code, can I get somehow the connecting clien= t'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