public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Fred Yankowski <fred@ontosys.com>
To: cygwin@cygwin.com, pgsql-cygwin@postgresql.org
Subject: Re: [ANNOUNCEMENT] Updated: cygrunsrv-0.94-1
Date: Mon, 16 Jul 2001 09:51:00 -0000	[thread overview]
Message-ID: <20010716115100.A87766@enteract.com> (raw)
In-Reply-To: <20010716182727.Y25442@cygbert.vinschen.de>

On Mon, Jul 16, 2001 at 06:27:27PM +0200, Corinna Vinschen wrote:
> For example when changing the runlevel on a Linux system is requested,
> init(8) sends a SIGTERM to processes which aren't defined on the new
> runlevel. Which is a similar situation, IMO. Perhaps changing Cygwin
> from sending SIGHUP to sending SIGTERM makes any sense?

Sending SIGTERM rather than SIGHUP does seem more appropriate for this
case in general.  However, it might not work well for PostgreSQL.

PostgreSQL has three modes of shutdown (that I know of):  SIGTERM
triggers a "smart" shutdown mode that will wait for clients to
disconnect first; SIGINT triggers "fast" shutdown that aborts current
transactions and shuts down cleanly very quickly; SIGQUIT triggers
"immediate" shutdown that quits with minimal attempt to clean up
first, leading to recovery on the next restart.  Unfortunately for our
case, the SIGTERM mode is not appropriate for system shutdown because
we would block until interactive clients all happen to disconnect,
which is likely to cause the win32 system to just kill the postgresql
processes after it waits the maximum allowed time for services to
shutdown.

Cygrunsrv can send an arbitrary signal to the managed process in the
event of system shutdown, and I configure it to send SIGINT for
PostgreSQL to trigger smart shutdown.  The problem, as I see it, is
that there is a race condition and if we have Cygwin send SIGTERM
rather than SIGHUP then the PostgreSQL processes may get that before
the SIGINT sent by cygrunsrv and will embark on the smart shutdown
path.  I believe (but, I realize, I'm not sure) that PostgreSQL will
continue with the "smart" shutdown even on later receipt of SIGINT.

A Unix system would typically give daemon processes a chance to
shutdown cleanly between run-levels through the use of /etc/init.d
scripts (or the like), before hammering them with a signal.
Cygrunsrv's --shutdown option gives us a limited capability similar to
those init.d scripts, but unfortunately doesn't get the same priority
in time that the scripts get.

-- 
Fred Yankowski           fred@OntoSys.com      tel: +1.630.879.1312
Principal Consultant     www.OntoSys.com       fax: +1.630.879.1370
OntoSys, Inc             38W242 Deerpath Rd, Batavia, IL 60510, USA

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

  reply	other threads:[~2001-07-16  9:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-12  3:26 Riaan Labuschagne
2001-07-12  4:37 ` Corinna Vinschen
2001-07-12  8:19 ` Fred Yankowski
2001-07-12  8:46   ` Jason Tishler
2001-07-12  9:42     ` Fred Yankowski
2001-07-16  7:04       ` Jason Tishler
2001-07-16  8:19         ` Corinna Vinschen
2001-07-16  8:34           ` Jason Tishler
2001-07-16  9:27             ` Corinna Vinschen
2001-07-16  9:51               ` Fred Yankowski [this message]
2001-07-16 10:16                 ` Corinna Vinschen
2001-07-16 11:15                   ` Fred Yankowski
2001-07-18 12:11               ` Jason Tishler
2001-07-18 13:20                 ` Corinna Vinschen
2001-07-19  8:26                 ` Fred Yankowski
2001-07-16  9:36         ` Fred Yankowski
  -- strict thread matches above, loose matches on Subject: below --
2001-07-12  1:55 Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010716115100.A87766@enteract.com \
    --to=fred@ontosys.com \
    --cc=cygwin@cygwin.com \
    --cc=pgsql-cygwin@postgresql.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).