• Tom Lane's avatar
    Accept SIGQUIT during error recovery in auxiliary processes. · 7634bd4f
    Tom Lane authored
    The bgwriter, checkpointer, walwriter, and walreceiver processes
    claimed to allow SIGQUIT "at all times".  In reality SIGQUIT
    would get re-blocked during error recovery, because we didn't
    update the actual signal mask immediately, so sigsetjmp() would
    save and reinstate a mask that includes SIGQUIT.
    
    This appears to be simply a coding oversight.  There's never a
    good reason to hold off SIGQUIT in these processes, because it's
    going to just call _exit(2) which should be safe enough, especially
    since the postmaster is going to tear down shared memory afterwards.
    Hence, stick in PG_SETMASK() calls to install the modified BlockSig
    mask immediately.
    
    Also try to improve the comments around sigsetjmp blocks.  Most of
    them were just referencing postgres.c, which is misleading because
    actually postgres.c manages the signals differently.
    
    No back-patch, since there's no evidence that this is causing any
    problems in the field.
    
    Discussion: https://postgr.es/m/CALDaNm1d1hHPZUg3xU4XjtWBOLCrA+-2cJcLpw-cePZ=GgDVfA@mail.gmail.com
    7634bd4f
bgwriter.c 11.7 KB