Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 5A7B714E23D2 for ; Wed, 21 Dec 2011 07:46:22 -0400 (AST) Received: from fw.sogeasoft.biz ([151.9.34.199]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RdKcj-0004bP-MM for pgsql-bugs@postgresql.org; Wed, 21 Dec 2011 11:46:22 +0000 Received: from localhost (localhost [127.0.0.1]) by fw.sogeasoft.biz (Postfix) with ESMTP id 7280F340826D1; Wed, 21 Dec 2011 12:46:05 +0100 (CET) X-Virus-Scanned: amavisd-new at fw.sogeasoft.biz Received: from fw.sogeasoft.biz ([127.0.0.1]) by localhost (fw.sogeasoft.biz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wU3xoiSWTNnZ; Wed, 21 Dec 2011 12:46:03 +0100 (CET) Received: from andreagrassi (123-2-1-233.core.dodo.com.au [123.2.1.233]) by fw.sogeasoft.biz (Postfix) with ESMTP id 7193A340812B7; Wed, 21 Dec 2011 12:46:03 +0100 (CET) From: "Andrea Grassi" To: "'Craig Ringer'" , "'Tom Lane'" Cc: , "'Pg Bugs'" , "'Alvaro Herrera'" References: <4EEB0006.7080205@ringerc.id.au> <001201ccbbfc$82c987a0$885c96e0$@com> <4EEC3462.80702@ringerc.id.au> <000601ccbef6$060820d0$12186270$@com> <1324395708-sup-4443@alvh.no-ip.org> <001701ccbf34$72480970$56d81c50$@com> <20092.1324399103@sss.pgh.pa.us> <002301ccbf3c$cc34b110$649e1330$@com> <6410.1324402946@sss.pgh.pa.us> <4EF12097.5060907@ringerc.id.au> In-Reply-To: <4EF12097.5060907@ringerc.id.au> Subject: R: R: R: R: R: BUG #6342: libpq blocks forever in "poll" function Date: Wed, 21 Dec 2011 12:46:01 +0100 Message-ID: <000c01ccbfd6$1d5a5e70$580f1b50$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Acy/cvjn5p8XT91cQEClV9opdpvuQAAYAFUA Content-Language: it X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201112/187 X-Sequence-Number: 31998 Then I meet my colleague who is the systems engineer that takes care of = the machine and I explain your hints (suggested by Craig Ringer) about how detect and log kernel issues. If it can be useful, the content of file /proc/$pid/wchan in the moment = of block is "_stext". In the meantime, to be sure that it could not been a libpq bug, I ask = you one thing. In internet I searched for detailed specifications of poll/select system functions but I didn't understand one thing, that is which one of the 2 statement is true: 1) poll/select wait only for FUTURE modifications of ready-read state of sockets 2) poll/select check if there is something to read at the moment of the = call and otherwise wait for FUTURE modifications of ready-read state =20 Because if it was true the first statement, it could be that the answer = of the server arrives between the request and the call of poll (this time = is surely very short but however strictly greater than 0 and in this = interval the server answer could arrive).=20 Theoretical sequence:=20 1) Client request to server=20 2) Server answer to client 3) client wait calling poll In this case client and server go in a sort of deadlock because server = and client wait each other for the other and could be a libpq bug. What do you think about ? This scenario could be possible or the true statement is the second ? Regard, Andrea -----Messaggio originale----- Da: Craig Ringer [mailto:ringerc@ringerc.id.au]=20 Inviato: mercoled=EC 21 dicembre 2011 0.56 A: Tom Lane Cc: Andrea Grassi; harrywr2@comcast.net; 'Pg Bugs'; 'Alvaro Herrera' Oggetto: Re: R: R: R: R: [BUGS] BUG #6342: libpq blocks forever in = "poll" function On 21/12/2011 1:42 AM, Tom Lane wrote: > Hrm. What's with the 48 bytes in the client's receive queue? Surely > the kernel should be reporting that the socket is read-ready, if it's > got some data. I think you've found an obscure kernel bug ---- = somehow > it's failing to wake the poll() caller. > I've been leaning that way too; that's why I was asking him for=20 /proc/$pid/stack and `wchan -C programname -o wchan:80=3D` output - to = get=20 some idea of what function in the kernel it's sitting in. Unfortunately the OP is on some enterprise distro that doesn't have=20 /proc/$pid/stack . wchan info would still be useful. I wonder how old=20 their kernel is? The bug could've already been fixed. /proc/pid/stack=20 has been around since 2008 so it must be pretty elderly. OP: You can also get a kernel stack for a process by enabling the magic=20 SysRQ key (see Google) then using Alt-SysRq-T . This requires a physical = keyboard directly connected to the server. It emits the stack=20 information via dmesg. See: http://en.wikipedia.org/wiki/Magic_SysRq_key There's a "sysrqd" that apparently lets you use these features remotely, = but I've never tried it. -- Craig Ringer