pgsql: Don't trust signalfd() on illumos.

From: Thomas Munro <tmunro(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Don't trust signalfd() on illumos.
Date: 2022-06-25 23:16:51
Message-ID: E1o5F1H-001oln-5v@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)hotmail(dot)com>
Reported-by: Olaf Bohlen <olbohlen(at)eenfach(dot)de> (off-list)
Reviewed-by: Japin Li <japinli(at)hotmail(dot)com>
Discussion: https://postgr.es/m/MEYP282MB1669C8D88F0997354C2313C1B6CA9%40MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/e086b55381a98975348051d218cff0752c19d0f9

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

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2022-06-26 12:58:28 pgsql: Harden range_table_mutator() against null RangeTblEntry.subquery
Previous Message Thomas Munro 2022-06-25 23:16:40 pgsql: Don't trust signalfd() on illumos.