X-Spam-Check-By: sourceware.org Date: Mon, 13 Nov 2006 08:55:54 -0500 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: Bash process remains after I close rxvt in certain ways Message-ID: <20061113135554.GA4064@trixie.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <45586C29 DOT 4050805 AT byu DOT net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.11 Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Mon, Nov 13, 2006 at 08:15:15AM -0500, Igor Peshansky wrote: >On Mon, 13 Nov 2006, Eric Blake wrote: > >> According to Eric Lilja on 11/12/2006 12:52 PM: >> > I recently upgraded to a dual core machine which made me use the windows >> > task manager alot. That's when I noticed that if I close the rxvt window >> > by pressing 'x' in the top right corner (or doing alt-f4, I never do >> > this, just tried it now to see what happened) the rxvt process is >> > terminated and the window disappears but the "underlying" bash process >> > is still running (without a visible window), consuming ~3.5 MB of memory >> > and 0 cpu time according to the task manager. >> >> So far, no one has found a good way for a cygwin process killed by Alt-F4 >> (or the X button) to treat that as a SIGHUP and pass that information on >> to all of its children processes. So, by killing rxvt abruptly, you are >> indeed stranding bash as a zombie process. >> >> > If I exit rxvt by typing >> > exit, the bash process is terminated too. >> >> Actually, typing exit will exit bash, not rxvt; but when rxvt realizes >> that all of its children processes have exited, it exits as well. >> >> > Can I do something so the bash >> > process is always terminated properly no matter how I close the rxvt >> > window? >> >> Submit a patch to make cygwin processes recognize Alt-F4 as a SIGHUP that >> needs to be passed to their children? Or possibly even a patch such that >> when a controlling pty terminal is closed, all children (such as bash) >> reading from that pty get an end-of-input (possibly a SIGPIPE) when trying >> to read from the disappearing terminal? > >Actually, it's not the Cygwin processes that need that feature, but the >W11 library. When rxvt is closed via the 'X' button or Alt-F4, Windows >sends it the WM_QUIT message, which ought to be handled properly in the >library as application exit (and thus send SIGHUP to all immediate >children). This is done by the Cygwin console already, so it may simply >be a matter of copying/pasting some code... Actually, Cygwin sends a SIGHUP to the process being closed when it sees a CTRL_CLOSE_EVENT. Maybe it just needs to send a SIGHUP to the entire process group rather than just the one process. I'll look into that. cgf -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/