Re: SIGQUIT handling, redux
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-09-10T14:36:23Z
Lists: pgsql-hackers
On Wed, Sep 9, 2020 at 10:07 PM Tom Lane <tgl@sss.pgh.pa.us> wrote: > bgworker_die (SIGTERM) > > Calls ereport(FATAL). This is surely not any safer than, say, > quickdie(). No, it's worse, because at least that won't try > to go out via proc_exit(). I think bgworker_die() is pretty much a terrible idea. Every background worker I've written has actually needed to use CHECK_FOR_INTERRUPTS(). I think that the only way this could actually be safe is if you have a background worker that never uses ereport() itself, so that the ereport() in the signal handler can't be interrupting one that's already happening. This seems unlikely to be the normal case, or anything close to it. Most background workers probably are shared-memory connected and use a lot of PostgreSQL infrastructure and thus ereport() all over the place. Now what to do about it I don't know exactly, but it would be nice to do something. > StandbyDeadLockHandler (from SIGALRM) > StandbyTimeoutHandler (ditto) > > Calls CancelDBBackends, which just for starters tries to acquire > an LWLock. I think the only reason we've gotten away with this > for this long is the high probability that by the time either > timeout fires, we're going to be blocked on a semaphore. Yeah, I'm not sure these are so bad. In fact, in the deadlock case, I believe the old coding was designed to make sure we *had to* be blocked on a semaphore, but I'm not sure whether that's still true. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
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