System shutdown signal on Windows (was Re: [GENERAL])

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Krystian Bigaj <krystian(dot)bigaj(at)gmail(dot)com>
Cc: Kalai R <softlinne(dot)kv(at)gmail(dot)com>, pgsql-hackers(at)postgreSQL(dot)org
Subject: System shutdown signal on Windows (was Re: [GENERAL])
Date: 2014-07-23 20:16:10
Message-ID: 26514.1406146570@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Krystian Bigaj <krystian(dot)bigaj(at)gmail(dot)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

In response to

  • Re: at 2014-07-23 19:52:39 from Krystian Bigaj

Responses

Browse pgsql-general by date

  From Date Subject
Next Message hubert depesz lubaczewski 2014-07-23 20:26:30 Re: tab_to_sting
Previous Message Tom Lane 2014-07-23 20:03:23 Re: Dead Locks

Browse pgsql-hackers by date

  From Date Subject
Next Message Adrian Klaver 2014-07-23 20:29:11 Re:
Previous Message Andrew Dunstan 2014-07-23 20:15:51 Re: PDF builds broken again