Subject: Re: [ANNOUNCEMENT] Updated: cygrunsrv-0.94-1
From: Fred Yankowski <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Thu, 12 Jul 2001 11:42:08 -0500

On Thu, Jul 12, 2001 at 11:45:39AM -0400, Jason Tishler wrote:
> Please post your patch -- I've been waiting with bated breath since you
> first mentioned it.  :,)  I will be quite willing to champion it (or a
> better solution, if one can be devised) for inclusion into PostgreSQL CVS.

OK, here's the patch.  It's crude, simply causing the SIGHUP handlers
(one for postmaster and one for postgres) to return immediately
without triggering the normal config-file-reloading response.

BTW, while testing this patch again after a 'cvs update' I notice that
I've got more 'postgres' processes running than usual.  In the idle
state I expect to have just one process named 'postgres' running; it's
actually the postmaster and has cygrunsrv as its parent.  But now I've
got two other postgres processes, one a child of the postmaster and
the other a child of the first.  I don't remember seeing this before.
I don't have any client programs running.  Stopping and restarting the
service results in the same situation.  Starting a client causes a new
postgres child process of the postmaster to run while the client is
connected, as usual.  I'm puzzled about those two other processes.

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

--

Index: src/backend/postmaster/postmaster.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/postmaster/postmaster.c,v
retrieving revision 1.229
diff -u -p -r1.229 postmaster.c
--- src/backend/postmaster/postmaster.c 2001/06/29 16:05:57     1.229
+++ src/backend/postmaster/postmaster.c 2001/07/12 16:34:29
@@ -1284,6 +1284,18 @@ SIGHUP_handler(SIGNAL_ARGS)
        int                     save_errno = errno;

        PG_SETMASK(&BlockSig);
+#ifdef __CYGWIN__
+       /*
+        * Ignore SIGHUP since Cygwin sends a SIGHUP when NT is being
+        * shut down.  Attempting to handle this signal as normal
+        * seems to block the concurrent activity to shutdown the
+        * postmaster.
+        */
+       if (DebugLvl)
+         postmaster_error("ignoring caught SIGHUP in postmaster");
+       errno = save_errno;
+       return;
+#endif

        if (Shutdown <= SmartShutdown)
        {
Index: src/backend/tcop/postgres.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/tcop/postgres.c,v
retrieving revision 1.227
diff -u -p -r1.227 postgres.c
--- src/backend/tcop/postgres.c 2001/06/29 16:05:56     1.227
+++ src/backend/tcop/postgres.c 2001/07/12 16:34:31
@@ -1022,6 +1022,10 @@ FloatExceptionHandler(SIGNAL_ARGS)
 static void
 SigHupHandler(SIGNAL_ARGS)
 {
+#ifdef __CYGWIN__
+       elog(DEBUG, "ignoring caught SIGHUP in postgres\n");
+       return;
+#endif
        got_SIGHUP = true;
 }

--
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/