pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Make WaitLatchOrSocket's timeout detection more robust. 5+ messages / 1 participants [nested] [flat]
* pgsql: Make WaitLatchOrSocket's timeout detection more robust. @ 2015-07-18 15:47 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 5+ messages in thread From: Tom Lane @ 2015-07-18 15:47 UTC (permalink / raw) To: pgsql-committers Make WaitLatchOrSocket's timeout detection more robust. In the previous coding, timeout would be noticed and reported only when poll() or socket() returned zero (or the equivalent behavior on Windows). Ordinarily that should work well enough, but it seems conceivable that we could get into a state where poll() always returns a nonzero value --- for example, if it is noticing a condition on one of the file descriptors that we do not think is reason to exit the loop. If that happened, we'd be in a busy-wait loop that would fail to terminate even when the timeout expires. We can make this more robust at essentially no cost, by deciding to exit of our own accord if we compute a zero or negative time-remaining-to-wait. Previously the code noted this but just clamped the time-remaining to zero, expecting that we'd detect timeout on the next loop iteration. Back-patch to 9.2. While 9.1 had a version of WaitLatchOrSocket, it was primitive compared to later versions, and did not guarantee reliable detection of timeouts anyway. (Essentially, this is a refinement of commit 3e7fdcffd6f77187, which was back-patched only as far as 9.2.) Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/576a95b3a1ce465066c38d6859ccf64fca656e49 Modified Files -------------- src/backend/port/unix_latch.c | 20 +++++++++++++------- src/backend/port/win32_latch.c | 9 ++++++--- 2 files changed, 19 insertions(+), 10 deletions(-) -- 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] 5+ messages in thread
* pgsql: Make WaitLatchOrSocket's timeout detection more robust. @ 2015-07-18 15:47 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 5+ messages in thread From: Tom Lane @ 2015-07-18 15:47 UTC (permalink / raw) To: pgsql-committers Make WaitLatchOrSocket's timeout detection more robust. In the previous coding, timeout would be noticed and reported only when poll() or socket() returned zero (or the equivalent behavior on Windows). Ordinarily that should work well enough, but it seems conceivable that we could get into a state where poll() always returns a nonzero value --- for example, if it is noticing a condition on one of the file descriptors that we do not think is reason to exit the loop. If that happened, we'd be in a busy-wait loop that would fail to terminate even when the timeout expires. We can make this more robust at essentially no cost, by deciding to exit of our own accord if we compute a zero or negative time-remaining-to-wait. Previously the code noted this but just clamped the time-remaining to zero, expecting that we'd detect timeout on the next loop iteration. Back-patch to 9.2. While 9.1 had a version of WaitLatchOrSocket, it was primitive compared to later versions, and did not guarantee reliable detection of timeouts anyway. (Essentially, this is a refinement of commit 3e7fdcffd6f77187, which was back-patched only as far as 9.2.) Branch ------ REL9_5_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/fd735e976cab3a95374c710ff5d2865102e3145a Modified Files -------------- src/backend/port/unix_latch.c | 20 +++++++++++++------- src/backend/port/win32_latch.c | 9 ++++++--- 2 files changed, 19 insertions(+), 10 deletions(-) -- 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] 5+ messages in thread
* pgsql: Make WaitLatchOrSocket's timeout detection more robust. @ 2015-07-18 15:47 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 5+ messages in thread From: Tom Lane @ 2015-07-18 15:47 UTC (permalink / raw) To: pgsql-committers Make WaitLatchOrSocket's timeout detection more robust. In the previous coding, timeout would be noticed and reported only when poll() or socket() returned zero (or the equivalent behavior on Windows). Ordinarily that should work well enough, but it seems conceivable that we could get into a state where poll() always returns a nonzero value --- for example, if it is noticing a condition on one of the file descriptors that we do not think is reason to exit the loop. If that happened, we'd be in a busy-wait loop that would fail to terminate even when the timeout expires. We can make this more robust at essentially no cost, by deciding to exit of our own accord if we compute a zero or negative time-remaining-to-wait. Previously the code noted this but just clamped the time-remaining to zero, expecting that we'd detect timeout on the next loop iteration. Back-patch to 9.2. While 9.1 had a version of WaitLatchOrSocket, it was primitive compared to later versions, and did not guarantee reliable detection of timeouts anyway. (Essentially, this is a refinement of commit 3e7fdcffd6f77187, which was back-patched only as far as 9.2.) Branch ------ REL9_4_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/29efe1b5ebc82512cae363349bae6dd22e9b00eb Modified Files -------------- src/backend/port/unix_latch.c | 20 +++++++++++++------- src/backend/port/win32_latch.c | 9 ++++++--- 2 files changed, 19 insertions(+), 10 deletions(-) -- 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] 5+ messages in thread
* pgsql: Make WaitLatchOrSocket's timeout detection more robust. @ 2015-07-18 15:47 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 5+ messages in thread From: Tom Lane @ 2015-07-18 15:47 UTC (permalink / raw) To: pgsql-committers Make WaitLatchOrSocket's timeout detection more robust. In the previous coding, timeout would be noticed and reported only when poll() or socket() returned zero (or the equivalent behavior on Windows). Ordinarily that should work well enough, but it seems conceivable that we could get into a state where poll() always returns a nonzero value --- for example, if it is noticing a condition on one of the file descriptors that we do not think is reason to exit the loop. If that happened, we'd be in a busy-wait loop that would fail to terminate even when the timeout expires. We can make this more robust at essentially no cost, by deciding to exit of our own accord if we compute a zero or negative time-remaining-to-wait. Previously the code noted this but just clamped the time-remaining to zero, expecting that we'd detect timeout on the next loop iteration. Back-patch to 9.2. While 9.1 had a version of WaitLatchOrSocket, it was primitive compared to later versions, and did not guarantee reliable detection of timeouts anyway. (Essentially, this is a refinement of commit 3e7fdcffd6f77187, which was back-patched only as far as 9.2.) Branch ------ REL9_3_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/498a29dc32f34e6936d456e95a0beb44a9c3b637 Modified Files -------------- src/backend/port/unix_latch.c | 20 +++++++++++++------- src/backend/port/win32_latch.c | 9 ++++++--- 2 files changed, 19 insertions(+), 10 deletions(-) -- 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] 5+ messages in thread
* pgsql: Make WaitLatchOrSocket's timeout detection more robust. @ 2015-07-18 15:47 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 5+ messages in thread From: Tom Lane @ 2015-07-18 15:47 UTC (permalink / raw) To: pgsql-committers Make WaitLatchOrSocket's timeout detection more robust. In the previous coding, timeout would be noticed and reported only when poll() or socket() returned zero (or the equivalent behavior on Windows). Ordinarily that should work well enough, but it seems conceivable that we could get into a state where poll() always returns a nonzero value --- for example, if it is noticing a condition on one of the file descriptors that we do not think is reason to exit the loop. If that happened, we'd be in a busy-wait loop that would fail to terminate even when the timeout expires. We can make this more robust at essentially no cost, by deciding to exit of our own accord if we compute a zero or negative time-remaining-to-wait. Previously the code noted this but just clamped the time-remaining to zero, expecting that we'd detect timeout on the next loop iteration. Back-patch to 9.2. While 9.1 had a version of WaitLatchOrSocket, it was primitive compared to later versions, and did not guarantee reliable detection of timeouts anyway. (Essentially, this is a refinement of commit 3e7fdcffd6f77187, which was back-patched only as far as 9.2.) Branch ------ REL9_2_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/6675301ea56d6f518eefa4b4603a8efd1e754a8f Modified Files -------------- src/backend/port/unix_latch.c | 20 +++++++++++++------- src/backend/port/win32_latch.c | 9 ++++++--- 2 files changed, 19 insertions(+), 10 deletions(-) -- 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] 5+ messages in thread
end of thread, other threads:[~2015-07-18 15:47 UTC | newest] Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2015-07-18 15:47 pgsql: Make WaitLatchOrSocket's timeout detection more robust. Tom Lane <tgl@sss.pgh.pa.us> 2015-07-18 15:47 pgsql: Make WaitLatchOrSocket's timeout detection more robust. Tom Lane <tgl@sss.pgh.pa.us> 2015-07-18 15:47 pgsql: Make WaitLatchOrSocket's timeout detection more robust. Tom Lane <tgl@sss.pgh.pa.us> 2015-07-18 15:47 pgsql: Make WaitLatchOrSocket's timeout detection more robust. Tom Lane <tgl@sss.pgh.pa.us> 2015-07-18 15:47 pgsql: Make WaitLatchOrSocket's timeout detection more robust. Tom Lane <tgl@sss.pgh.pa.us>
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