mirror of
https://github.com/postgres/postgres.git
synced 2025-11-12 05:01:15 +03:00
Enable SIGTERM and SIGQUIT during client authentication so
the postmaster can kill the forked off processes when shutdown is requested. Jan
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.239 2001/09/07 00:46:42 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.240 2001/09/07 16:12:48 wieck Exp $
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
@@ -112,10 +112,12 @@
|
||||
|
||||
#ifdef HAVE_SIGPROCMASK
|
||||
sigset_t UnBlockSig,
|
||||
BlockSig;
|
||||
BlockSig,
|
||||
AuthBlockSig;
|
||||
#else
|
||||
int UnBlockSig,
|
||||
BlockSig;
|
||||
BlockSig,
|
||||
AuthBlockSig;
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -1932,6 +1934,16 @@ DoBackend(Port *port)
|
||||
|
||||
whereToSendOutput = Remote; /* XXX probably doesn't belong here */
|
||||
|
||||
/*
|
||||
* We arrange for a simple exit(0) if we receive SIGTERM or SIGQUIT
|
||||
* during any client authentication related communication. Otherwise
|
||||
* the postmaster cannot shutdown the database FAST or IMMED cleanly
|
||||
* if a buggy client blocks a backend during authentication.
|
||||
*/
|
||||
pqsignal(SIGTERM, authdie);
|
||||
pqsignal(SIGQUIT, authdie);
|
||||
PG_SETMASK(&AuthBlockSig);
|
||||
|
||||
/*
|
||||
* Receive the startup packet (which might turn out to be a cancel
|
||||
* request packet); then perform client authentication.
|
||||
@@ -1943,6 +1955,8 @@ DoBackend(Port *port)
|
||||
|
||||
ClientAuthentication(MyProcPort); /* might not return, if failure */
|
||||
|
||||
PG_SETMASK(&BlockSig);
|
||||
|
||||
/*
|
||||
* Don't want backend to be able to see the postmaster random number
|
||||
* generator state. We have to clobber the static random_seed *and*
|
||||
|
||||
Reference in New Issue
Block a user