pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix corner-case bug in WaitEventSetWaitBlock on Windows.
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix corner-case bug in WaitEventSetWaitBlock on Windows.
@ 2016-12-21 16:15  Robert Haas <rhaas@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Robert Haas @ 2016-12-21 16:15 UTC (permalink / raw)
  To: pgsql-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
------
REL9_6_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/b98e5513f33154ede701963ee9115ea056e9dea9

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


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix corner-case bug in WaitEventSetWaitBlock on Windows.
@ 2016-12-21 16:15  Robert Haas <rhaas@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Robert Haas @ 2016-12-21 16:15 UTC (permalink / raw)
  To: pgsql-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


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2016-12-21 16:15 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-12-21 16:15 pgsql: Fix corner-case bug in WaitEventSetWaitBlock on Windows. Robert Haas <rhaas@postgresql.org>
2016-12-21 16:15 pgsql: Fix corner-case bug in WaitEventSetWaitBlock on Windows. Robert Haas <rhaas@postgresql.org>

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