• Thomas Munro's avatar
    Don't trust signalfd() on illumos. · e086b553
    Thomas Munro authored
    Since commit 6a2a70a0, 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: default avatarJapin Li <japinli@hotmail.com>
    Reported-by: Olaf Bohlen <olbohlen@eenfach.de> (off-list)
    Reviewed-by: default avatarJapin Li <japinli@hotmail.com>
    Discussion: https://postgr.es/m/MEYP282MB1669C8D88F0997354C2313C1B6CA9%40MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM
    e086b553
latch.c 59.2 KB