From de35a9771004b9d521c9d5882db6be4fba20e80e Mon Sep 17 00:00:00 2001 From: Noah Misch Date: Fri, 25 Jul 2014 18:51:48 -0400 Subject: Handle WAIT_IO_COMPLETION return from WaitForMultipleObjectsEx(). This return code is possible wherever we pass bAlertable = TRUE; it arises when Windows caused the current thread to run an "I/O completion routine" or an "asynchronous procedure call". PostgreSQL does not provoke either of those Windows facilities, hence this bug remaining largely unnoticed, but other local code might do so. Due to a shortage of complaints, no back-patch for now. Per report from Shiv Shivaraju Gowda, this bug can cause PGSemaphoreLock() to PANIC. The bug can also cause select() to report timeout expiration too early, which might confuse pgstat_init() and CheckRADIUSAuth(). --- src/backend/port/win32/socket.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/backend/port/win32/socket.c') diff --git a/src/backend/port/win32/socket.c b/src/backend/port/win32/socket.c index 6a518e5b6d9..c981169fe1f 100644 --- a/src/backend/port/win32/socket.c +++ b/src/backend/port/win32/socket.c @@ -623,7 +623,8 @@ pgwin32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, c return 0; } - if (r == WAIT_OBJECT_0 + numevents) + /* Signal-like events. */ + if (r == WAIT_OBJECT_0 + numevents || r == WAIT_IO_COMPLETION) { pgwin32_dispatch_queued_signals(); errno = EINTR; -- cgit v1.2.3