System shutdown signal on Windows (was Re: [GENERAL]) - Mailing list pgsql-hackers

From Tom Lane
Subject System shutdown signal on Windows (was Re: [GENERAL])
Date
Msg-id 26514.1406146570@sss.pgh.pa.us
Whole thread Raw
Responses Re: System shutdown signal on Windows (was Re: [GENERAL])  (Krystian Bigaj <krystian.bigaj@gmail.com>)
List pgsql-hackers
Krystian Bigaj <krystian.bigaj@gmail.com> writes:
> - when pg_console_handler receives CTRL_SHUTDOWN_EVENT from OS, then it
> calls pg_queue_signal(SIGINT).

> Problems:
> - when OS is in shutdown path, then it sends CTRL_SHUTDOWN_EVENT, and *all*
> Postgres processes (main and sub/forked) will call pg_queue_signal(SIGINT)
> - so main and sub processes will start to shutdown independently? Can this
> have any bad consequences?

Hm.  We ought to have that sending SIGTERM instead, so as to mimic the
situation when Unix "init" is trying to shut down the system.  It might be
that SIGINT will more or less work, but the postmaster logic is designed
to work with global SIGTERM as being the clean-up-ASAP trigger.  As an
example, backends servicing remote applications (which will *not* have
already gotten killed) would not exit in response to SIGINT.

> I think that CTRL_SHUTDOWN_EVENT should be removed from pg_console_handler,

That does not sound like a good idea, at least not if Windows has the
same behavior as "init" does of proceeding to hard kills after some
grace period.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: PDF builds broken again
Next
From: Magnus Hagander
Date:
Subject: Re: PDF builds broken again