ctrl_c_handler() vs. cygrunsrv shutdown handling problem

Christopher Faylor cgf@redhat.com
Thu May 29 18:48:00 GMT 2003


On Thu, May 29, 2003 at 01:12:36PM -0400, Jason Tishler wrote:
>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?

Why not add an option to have cygrunsrv set SIGTERM to SIG_IGN?

cgf



More information about the Cygwin-developers mailing list