delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/05/10/12:27:29

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
X-Authentication-Warning: shell-3.enteract.com: fcy set sender to fred AT ontosys DOT com using -f
Date: Thu, 10 May 2001 11:26:39 -0500
From: Fred Yankowski <fred AT ontosys DOT com>
Cc: cygwin AT cygwin DOT com
Subject: Re: SIGTERM does not stop backend postgres processes immediately
Message-ID: <20010510112639.A26981@enteract.com>
References: <E94FF01DFF6CD31186F4080009DC361502086B8D AT nttwr2 DOT tower DOT bldgs DOT butlermfg DOT org>
Mime-Version: 1.0
User-Agent: Mutt/1.2.5i
In-Reply-To: <E94FF01DFF6CD31186F4080009DC361502086B8D@nttwr2.tower.bldgs.butlermfg.org>; from rdparker@butlermfg.com on Wed, May 09, 2001 at 04:48:28PM -0500

To unblock recv() on receipt of a signal -- SIGHUP in particular, for
this test -- I set up a signal handler that calls close() on the
socket fd.  It looks to me like this should call
fhandler_socket::close() on that fd, which then calls closesocket() on
the underlying Win32/winsock SOCKET, which is purported to unblock
the Win32 recv() call on that socket.

But this isn't working because the signal handler function is not
being called directly in response to receipt of SIGHUP.  Using strace
I can see that wait_sig() runs right away but seems to put the signal
in pending state.  It's not until recv() next unblocks due to data
received over the socket that the signal handler function runs,
defeating the whole point.

I've attached some of the relevant strace output to this note.
Process 548 is sending to process 718 over the socket.

-- 
Fred Yankowski           fred AT OntoSys DOT com      tel: +1.630.879.1312
Principal Consultant     www.OntoSys.com       fax: +1.630.879.1370
OntoSys, Inc             38W242 Deerpath Rd, Batavia, IL 60510, USA

--

09:51:11 [main] testrecv 548 cygwin_send: 21 = send (3, 240FE44, 21, 0)
09:51:11 [main] testrecv 718 cygwin_recv: 21 = recv (4, 240FC44, 200, 0)
09:51:11 [main] testrecv 548 sleep: sleep (10)
09:51:14 [sig] testrecv 718 wait_sig: awake
09:51:14 [sig] testrecv 718 wait_sig: processing signal 1
09:51:14 [sig] testrecv 718 wait_sig: Got signal 1
09:51:14 [sig] testrecv 718 sig_handle: signal 1
09:51:14 [sig] testrecv 718 sig_handle: signal 1, about to call 0x4011F8
09:51:14 [sig] testrecv 718 interruptible: h 0x1, interruptible 0
09:51:14 [sig] testrecv 718 proc_subproc: args: 3, 1
09:51:14 [sig] testrecv 718 proc_subproc: clear waiting threads
09:51:14 [sig] testrecv 718 proc_subproc: finished clearing
09:51:14 [sig] testrecv 718 proc_subproc: returning 1
09:51:14 [sig] testrecv 718 setup_handler: armed signal_arrived 0xEC, res 1
09:51:14 [sig] testrecv 718 setup_handler: good.  Didn't suspend main thread, th
 0x6108E72C
09:51:14 [sig] testrecv 718 setup_handler: returning 1
09:51:14 [sig] testrecv 718 sig_handle: returning 1
09:51:14 [sig] testrecv 718 wait_sig: looping
09:51:21 [main] testrecv 548 sleep: 0 = sleep (10)
09:51:21 [main] testrecv 548 cygwin_send: 21 = send (3, 240FE44, 21, 0)
09:51:21 [main] testrecv 718 cygwin_recv: 21 = recv (4, 240FC44, 200, 0)
09:51:21 [main] testrecv 548 sleep: sleep (10)
09:51:21 [main] testrecv 718 reset_signal_arrived: reset signal_arrived
09:51:21 [main] testrecv 718 set_process_mask: old mask = 0, new mask = 1
09:51:21 [main] testrecv 718 _close: close (4)
09:51:21 [main] testrecv 718 _close: 0 = close (4)
09:51:21 [main] testrecv 718 set_process_mask: old mask = 1, new mask = 0
09:51:21 [main] testrecv 718 do_exit: do_exit (0)
09:51:21 [main] testrecv 718 void: 0x0 = signal (20, 0x1)
09:51:21 [main] testrecv 718 void: 0x4011F8 = signal (1, 0x1)
09:51:21 [main] testrecv 718 void: 0x0 = signal (2, 0x1)
09:51:21 [main] testrecv 718 void: 0x0 = signal (3, 0x1)
09:51:21 [main] testrecv 718 fhandler_base::close: handle 0xB4
09:51:21 [main] testrecv 718 proc_terminate: nchildren 0, nzombies 0
09:51:21 [main] testrecv 718 proc_terminate: leaving
09:51:21 [main] testrecv 718 sigproc_terminate: entering
09:51:21 [main] testrecv 718 sigproc_terminate: done
...

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019