pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: Fix corner-case bug in WaitEventSetWaitBlock on Windows.
Date: Wed, 21 Dec 2016 16:15:07 +0000
Message-ID: <E1cJjXn-0007RL-PM@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Fix corner-case bug in WaitEventSetWaitBlock on Windows.

If we do not reset the FD_READ event, WaitForMultipleObjects won't
return it again again unless we've meanwhile read from the socket,
which is generally true but not guaranteed.  WaitEventSetWaitBlock
itself may fail to return the event to the caller if the latch is
also set, and even if we changed that, the caller isn't obliged to
handle all returned events at once.  On non-Windows systems, the
socket-read event is purely level-triggered, so this issue does
not exist.  To fix, make Windows reset the event when needed.

This bug was introduced by 98a64d0bd713cb89e61bef6432befc4b7b5da59e,
and causes hangs when trying to use the pldebugger extension.

Patch by Amit Kapial.  Reported and tested by Ashutosh Sharma, who
also provided some analysis.  Further analysis by Michael Paquier.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/3b790d256f8489d0765c3389d6860f1c6b4a9b2d

Modified Files
--------------
src/backend/storage/ipc/latch.c | 27 +++++++++++++++++++++++++++
src/include/storage/latch.h     |  3 +++
2 files changed, 30 insertions(+)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


view thread (2+ messages)

Message-ID: <E1cJjXn-0007RL-PM@gemulon.postgresql.org>
Permalink:  ../E1cJjXn-0007RL-PM@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1cJjXn-0007RL-PM@gemulon.postgresql.org

 · 

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-committers@postgresql.org
  Cc: rhaas@postgresql.org
  Subject: Re: pgsql: Fix corner-case bug in WaitEventSetWaitBlock on Windows.
  In-Reply-To: <E1cJjXn-0007RL-PM@gemulon.postgresql.org>
  References: <E1cJjXn-0007RL-PM@gemulon.postgresql.org>

* 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