Re: SIGQUIT handling, redux
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Stephen Frost <sfrost@snowman.net>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2020-09-09T14:46:28Z
Lists: pgsql-hackers
Stephen Frost <sfrost@snowman.net> writes: > * Tom Lane (tgl@sss.pgh.pa.us) wrote: >> Of course, this is only safe if the SIGQUIT handler is safe to be invoked >> anywhere, so I did a quick survey of backend signal handlers to see if >> that is true. I immediately found pgarch_exit() which surely is not. It >> turns out that Horiguchi-san already noticed that and proposed to fix it, >> within the seemingly entirely unrelated patch series for a shared-memory >> based stats collector (see patch 0001 in [2]). I think we should go ahead >> and commit that, and maybe even back-patch it. There seems no good reason >> for the archiver to treat SIGQUIT as nonfatal when other postmaster >> children do not. > As I mentioned over there, I agree that we should do this and we should > further have the statistics collector also do so, which currently sets > up SIGQUIT with ShutdownRequestPending() and in its loop decides it's > fine to write out the stats file (which we're going to remove during > recovery anyway...) and then call exit(0). I noticed that that was different from everything else, but it's not actually signal-unsafe, so it seems like a different topic from what I'm on about at the moment. I don't mind if you or somebody else wants to change it, but I don't see it as a back-patchable bug fix. > I also think we should > back-patch these changes, as the commit mentioned in Horiguchi-san's > patch for pgarch_exit() was. Agreed; I'll go make it happen. regards, tom lane
Commits
-
Log a message when resorting to SIGKILL during shutdown/crash recovery.
- 10095ca634fb 14.0 landed
-
Don't run atexit callbacks during signal exits from ProcessStartupPacket.
- 6693a96b329e 14.0 landed
-
Use _exit(2) for SIGQUIT during ProcessStartupPacket, too.
- 58c6feccfae1 14.0 landed
- e2c9bedc9660 9.5.24 landed
- dc71c640985f 9.6.20 landed
- ac695b8f2d11 10.15 landed
- 93871b693c3e 11.10 landed
- 4e10c0c8a669 12.5 landed
- 3f29aa48b6df 13.0 landed
-
Make archiver's SIGQUIT handler exit via _exit().
- bedadc73220f 14.0 landed
- d038c6c6318b 12.5 landed
- b2eaddd9b00a 9.6.20 landed
- 95cd8902e62d 10.15 landed
- 67dde49a3ddb 11.10 landed
- 581855b6ae23 9.5.24 landed
- 35e59398abbb 13.0 landed