Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Date: Wed, 18 Jul 2001 15:11:42 -0400 From: Jason Tishler To: cygwin AT cygwin DOT com Cc: pgsql-cygwin AT postgresql DOT org Subject: Re: [ANNOUNCEMENT] Updated: cygrunsrv-0.94-1 Message-ID: <20010718151142.B612@dothill.com> Mail-Followup-To: cygwin AT cygwin DOT com, pgsql-cygwin AT postgresql DOT org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Th45YL+WzQ3/Z5K6" Content-Disposition: inline In-Reply-To: <20010716182727.Y25442@cygbert.vinschen.de> User-Agent: Mutt/1.3.18i Organization: Dot Hill Systems Corp. --Th45YL+WzQ3/Z5K6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Corinna, On Mon, Jul 16, 2001 at 06:27:27PM +0200, Corinna Vinschen wrote: > Perhaps changing Cygwin from sending SIGHUP to sending SIGTERM makes > any sense? Yes, I believe that this is the way to go -- at least for PostgreSQL... On Mon, Jul 16, 2001 at 11:51:00AM -0500, Fred Yankowski wrote: > Sending SIGTERM rather than SIGHUP does seem more appropriate for this > case in general. However, it might not work well for PostgreSQL. I appear to have empirical evidence that indicates that PostgreSQL can tolerate receiving SIGTERM and/or SIGINT during an NT shutdown. My procedure is as follows: 1. I applied the attached patch, rebuilt my Cygwin DLL, and installed it. 2. I installed postmaster under cygrunsrv as follows: $ cygrunsrv --install postmaster --path /usr/bin/postmaster \ --args "-D /usr/share/postgresql/data -i" --dep ipc-daemon \ --termsig INT --user 'bhmco\jt' --shutdown 3. I connected to this postmaster via psql running on another machine. 4. I restarted this NT box. The following are the messages displayed during shutdown and startup: Smart Shutdown request at Wed Jul 18 14:00:32 2001 [1] FATAL 1: This connection has been terminated by the administrator. [2] DEBUG: shutting down Fast Shutdown request at Wed Jul 18 14:00:33 2001 [3] DEBUG: database system is shut down DEBUG: database system was shut down at 2001-07-18 14:00:35 [restart occurs here] DEBUG: CheckPoint record at (0, 63186000) DEBUG: Redo record at (0, 63186000); Undo record at (0, 0); Shutdown TRUE DEBUG: NextTransactionId: 11662; NextOid: 414368 DEBUG: database system is in production state [4] Message [1] is due to ctrl_c_handler() sending a SIGTERM instead of SIGHUP to the postmaster process. Message [2] is due to ctrl_c_handler() sending a SIGTERM to the backend postgres process that is serving the only connection (from psql) which causes it to terminate. Note that normally it is postmaster that sends this signal (not some other process). Message [3] is due to cygrunsrv responding to the NT shutdown message and in turn sending a SIGINT to postmaster. Note that this seems to indicate that a Fast Shutdown can interrupt and supersede a Smart one. Message [4] indicates that PostgreSQL was able to restart without any manual intervention. Although the above is not quite how PostgreSQL shutdowns on other platforms, it is very close and seems to work. Should I submit the attached patch (with ChangeLog) to cygwin-patches for consideration? Thanks, Jason -- Jason Tishler Director, Software Engineering Phone: 732.264.8770 x235 Dot Hill Systems Corp. Fax: 732.264.8798 82 Bethany Road, Suite 7 Email: Jason DOT Tishler AT dothill DOT com Hazlet, NJ 07730 USA WWW: http://www.dothill.com --Th45YL+WzQ3/Z5K6 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="exceptions.cc.patch" Index: exceptions.cc =================================================================== RCS file: /cvs/src/src/winsup/cygwin/exceptions.cc,v retrieving revision 1.91 diff -u -p -r1.91 exceptions.cc --- exceptions.cc 2001/06/28 02:19:57 1.91 +++ exceptions.cc 2001/07/18 18:39:18 @@ -900,7 +900,7 @@ ctrl_c_handler (DWORD type) for each Cygwin process window that's open when the computer is shut down or console window is closed. */ { - sig_send (NULL, SIGHUP); + sig_send (NULL, SIGTERM); return FALSE; } tty_min *t = cygwin_shared->tty.get_tty (myself->ctty); --Th45YL+WzQ3/Z5K6 Content-Type: text/plain; charset=us-ascii -- 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/ --Th45YL+WzQ3/Z5K6--