This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ctrl_c_handler() vs. cygrunsrv shutdown handling problem


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]