diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2012-05-12 16:36:47 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2012-05-12 16:36:47 -0400 |
commit | 31ad6553646c81f3ce8fccf8aef1a1134a7864c7 (patch) | |
tree | 3e50b673543a07032e2ec6ff5dd3776a342a77f7 /src/backend/port/unix_latch.c | |
parent | d36eaa2167c4baaa654a19432035f47fdf6fbe7d (diff) | |
download | postgresql-31ad6553646c81f3ce8fccf8aef1a1134a7864c7.tar.gz postgresql-31ad6553646c81f3ce8fccf8aef1a1134a7864c7.zip |
Fix WaitLatchOrSocket to handle EOF on socket correctly.
When using poll(), EOF on a socket is reported with the POLLHUP not
POLLIN flag (at least on Linux). WaitLatchOrSocket failed to check
this bit, causing it to go into a busy-wait loop if EOF occurs.
We earlier fixed the same mistake in the test for the state of the
postmaster_alive socket, but missed it for the caller-supplied socket.
Fortunately, this error is new in 9.2, since 9.1 only had a select()
based code path not a poll() based one.
Diffstat (limited to 'src/backend/port/unix_latch.c')
-rw-r--r-- | src/backend/port/unix_latch.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/port/unix_latch.c b/src/backend/port/unix_latch.c index 30d1a488f0a..409beaed8dc 100644 --- a/src/backend/port/unix_latch.c +++ b/src/backend/port/unix_latch.c @@ -293,7 +293,7 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock, result |= WL_TIMEOUT; } if ((wakeEvents & WL_SOCKET_READABLE) && - (pfds[0].revents & POLLIN)) + (pfds[0].revents & (POLLIN | POLLHUP | POLLERR | POLLNVAL))) { /* data available in socket */ result |= WL_SOCKET_READABLE; |