ctrl_c_handler() vs. cygrunsrv shutdown handling problem

Jason Tishler jason@tishler.net
Thu May 29 17:25:00 GMT 2003

The SIGTERM signal sent by Cygwin's ctrl_c_handler() is interfering with
cygrunsrv's shutdown handling -- at least for PostgreSQL.  See the
attached for an example of this problem.

The bottom line is ctrl_c_handler()'s SIGTERM signal arrives before the
SIGINT signal sent by cygrunsrv.  This causes PostgreSQL to perform a
"smart" instead of a "fast" shutdown which can cause an improper
shutdown -- at least under XP.  It is possible that other Unix daemons
may be adversely affected by this double signal problem too.

I verified that preventing Cygwin from sending the SIGTERM:

    @@ -933,7 +933,7 @@ ctrl_c_handler (DWORD type)
          is shut down or console window is closed. */
       if (type == CTRL_SHUTDOWN_EVENT)
    -      sig_send (NULL, SIGTERM);
    +      // sig_send (NULL, SIGTERM);
           return FALSE;
       if (type == CTRL_CLOSE_EVENT)

works around the problem.

I'm willing to work up a patch to fix this problem properly.
Unfortunately, the only solution I can think of is a new CYGWIN setting.
Is this acceptable?  If not, any other ideas?


PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6
-------------- next part --------------
An embedded message was scrubbed...
From: Frank Seesink <frank@mail.wvnet.edu>
Subject: [CYGWIN] PostgreSQL 7.3.2 running as NT service under Windows XP not always clearing PID file on restart
Date: Thu, 22 May 2003 16:44:30 -0400
Size: 6026
URL: <http://cygwin.com/pipermail/cygwin-developers/attachments/20030529/a7dc18ba/attachment.eml>

More information about the Cygwin-developers mailing list