pgsql: Don't trust signalfd() on illumos. - Mailing list pgsql-committers

From Thomas Munro
Subject pgsql: Don't trust signalfd() on illumos.
Date
Msg-id E1o5F16-001olC-F8@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Don't trust signalfd() on illumos.

Since commit 6a2a70a02, we've used signalfd() to receive latch wakeups
when building with WAIT_USE_EPOLL (default for Linux and illumos), and
our traditional self-pipe when falling back to WAIT_USE_POLL (default
for other Unixes with neither epoll() nor kqueue()).

Unexplained hangs and kernel panics have been reported on illumos
systems, apparently linked to this use of signalfd(), leading illumos
users and build farm members to have to define WAIT_USE_POLL explicitly
as a work-around.  A bug report exists at
https://www.illumos.org/issues/13700 but no fix is available yet.

Let's provide a way for illumos users to go back to self-pipes with
epoll(), like releases before 14, and choose that by default.  No change
for Linux users.  To help with development/debugging, macros
WAIT_USE_{EPOLL,POLL} and WAIT_USE_{SIGNALFD,SELF_PIPE} can be defined
explicitly to override the defaults.

Back-patch to 14, where we started using signalfd().

Reported-by: Japin Li <japinli@hotmail.com>
Reported-by: Olaf Bohlen <olbohlen@eenfach.de> (off-list)
Reviewed-by: Japin Li <japinli@hotmail.com>
Discussion: https://postgr.es/m/MEYP282MB1669C8D88F0997354C2313C1B6CA9%40MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3ab4fc5dcf30ebc90a23ad878342dc528e2d25ce

Modified Files
--------------
src/backend/storage/ipc/latch.c | 58 ++++++++++++++++++++++++++++-------------
1 file changed, 40 insertions(+), 18 deletions(-)


pgsql-committers by date:

Previous
From: Noah Misch
Date:
Subject: pgsql: Fix PostgreSQL::Test aliasing for Perl v5.10.1.
Next
From: Thomas Munro
Date:
Subject: pgsql: Don't trust signalfd() on illumos.