pgsql: Use SA_RESTART for all signals, including SIGALRM.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Use SA_RESTART for all signals, including SIGALRM.
Date: 2013-06-15 19:40:18
Message-ID: E1UnwKg-0002LW-18@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Use SA_RESTART for all signals, including SIGALRM.

The exclusion of SIGALRM dates back to Berkeley days, when Postgres used
SIGALRM in only one very short stretch of code. Nowadays, allowing it to
interrupt kernel calls doesn't seem like a very good idea, since its use
for statement_timeout means SIGALRM could occur anyplace in the code, and
there are far too many call sites where we aren't prepared to deal with
EINTR failures. When third-party code is taken into consideration, it
seems impossible that we ever could be fully EINTR-proof, so better to
use SA_RESTART always and deal with the implications of that. One such
implication is that we should not assume pg_usleep() will be terminated
early by a signal. Therefore, long sleeps should probably be replaced
by WaitLatch operations where practical.

Back-patch to 9.3 so we can get some beta testing on this change.

Branch
------
REL9_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/61f3ada319038e7597c81f7f454982852bf02de3

Modified Files
--------------
src/backend/port/sysv_sema.c | 4 ++--
src/port/pqsignal.c | 4 +---
2 files changed, 3 insertions(+), 5 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2013-06-15 20:17:50 pgsql: Fix pg_restore -l with the directory archive to display the corr
Previous Message Tom Lane 2013-06-15 19:40:17 pgsql: Use SA_RESTART for all signals, including SIGALRM.