Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 4F87A635AE6 for ; Mon, 3 Aug 2009 10:48:14 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 09431-02-9 for ; Mon, 3 Aug 2009 13:47:54 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from exprod7og119.obsmtp.com (exprod7og119.obsmtp.com [64.18.2.16]) by mail.postgresql.org (Postfix) with SMTP id A19766359D6 for ; Mon, 3 Aug 2009 10:47:20 -0300 (ADT) Received: from source ([209.85.222.199]) by exprod7ob119.postini.com ([64.18.6.12]) with SMTP ID DSNKSnbqZb/tNljrap3l7whbViWr3+pgVuug@postini.com; Mon, 03 Aug 2009 06:47:19 PDT Received: by pzk37 with SMTP id 37so2171454pzk.26 for ; Mon, 03 Aug 2009 06:47:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.180.4 with SMTP id c4mr476456wff.287.1249307237223; Mon, 03 Aug 2009 06:47:17 -0700 (PDT) In-Reply-To: <9837222c0908010828x7182494av3fd5909b64f4b2ad@mail.gmail.com> References: <200907311459.n6VExuSa036743@wwwmaster.postgresql.org> <20090731234901.GD11098@alvh.no-ip.org> <9837222c0908010828x7182494av3fd5909b64f4b2ad@mail.gmail.com> Date: Mon, 3 Aug 2009 19:17:17 +0530 Message-ID: Subject: Re: BUG #4958: Stats collector hung on WaitForMultipleObjectsEx while attempting to recv a datagram From: Nikhil Sontakke To: Magnus Hagander Cc: Alvaro Herrera , Luke Koops , pgsql-bugs@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.753 tagged_above=-10 required=5 tests=AWL=0.846, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200908/3 X-Sequence-Number: 23830 Hi, >> >> >>> ntdll.dll!NtWaitForMultipleObjects+0xc >>> kernel32.dll!WaitForMultipleObjectsEx+0x11a >>> postgres.exe!pgwin32_waitforsinglesocket+0x1ed >>> postgres.exe!pgwin32_recv+0x90 >>> postgres.exe!PgstatCollectorMain+0x17f >>> postgres.exe!SubPostmasterMain+0x33a >>> postgres.exe!main+0x168 >>> postgres.exe!__tmainCRTStartup+0x10f >>> kernel32.dll!BaseProcessStart+0x23 >> >> I have seen this problem too. =A0The process seems stuck for no good >> reason. =A0I wondered at the time if it could be a kernel issue. =A0I >> remember trying to send some data to the collector to verify whether >> it'd wake up, but no luck. =A0(I mean I couldn't find a way to do it on >> Windows). > > I have seen this as well, but only in cases where there has been > broken firewall software or such things involved. I have seen a couple > of reports from the field though. > > Anyway, this really is a should-never-happen thing. As soon as a new > packet is sent in, WaitForMultipleObjectsEx() should return right > away. And given that backends regularly send packets over, it > shouldn't be an issue even if we miss one... > And this fact should lend credence to Alvaro's (as well as mine) suspicions that it seems to be a Windows kernel issue. As a consequence, Magnus I was wondering if having a loop similar to the WRITE handling of waiting for a fixed timeout in a loop (rather than an INFINITE call to WaitForMultipleObjectsEx) inside the pgwin32_waitforsinglesocket() function will help for the READ case too? I believe Teogor Sigaev had raised a similar concern a while back about it: http://www.nabble.com/-GENERAL--Stats-collector-frozen--td8569977i20.html Regards, Nikhils --=20 http://www.enterprisedb.com