Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id DA2C1633445 for ; Sat, 1 Aug 2009 12:28:22 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 14318-05 for ; Sat, 1 Aug 2009 15:28:12 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-fx0-f210.google.com (mail-fx0-f210.google.com [209.85.220.210]) by mail.postgresql.org (Postfix) with ESMTP id 368D5633F01 for ; Sat, 1 Aug 2009 12:28:11 -0300 (ADT) Received: by fxm6 with SMTP id 6so671583fxm.19 for ; Sat, 01 Aug 2009 08:28:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.204.60.194 with SMTP id q2mr4668382bkh.150.1249140490750; Sat, 01 Aug 2009 08:28:10 -0700 (PDT) In-Reply-To: <20090731234901.GD11098@alvh.no-ip.org> References: <200907311459.n6VExuSa036743@wwwmaster.postgresql.org> <20090731234901.GD11098@alvh.no-ip.org> Date: Sat, 1 Aug 2009 17:28:10 +0200 Message-ID: <9837222c0908010828x7182494av3fd5909b64f4b2ad@mail.gmail.com> Subject: Re: BUG #4958: Stats collector hung on WaitForMultipleObjectsEx while attempting to recv a datagram From: Magnus Hagander To: Alvaro Herrera Cc: 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=0 tagged_above=-10 required=5 tests=none X-Spam-Level: X-Archive-Number: 200908/1 X-Sequence-Number: 23828 On Sat, Aug 1, 2009 at 01:49, Alvaro Herrera wr= ote: > Luke Koops wrote: > >> Description: =A0 =A0 =A0 =A0Stats collector hung on WaitForMultipleObjec= tsEx while >> attempting to recv a datagram >> Details: >> >> While running a load test with 80 processes connected to postgres, of wh= ich >> 62 were generating load, the stats collector got blocked on >> WaitForMultipleObjectsEx which was called with INFINITE timeout. =A0The = stack >> trace for the hung thread follows: > > >> 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... To generate packets, you should be able to use for example "nc" that is available as a win32 binary as well. --=20 Magnus Hagander Self: http://www.hagander.net/ Work: http://www.redpill-linpro.com/