From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8123 invoked by alias); 29 Apr 2010 15:21:51 -0000 Received: (qmail 8109 invoked by uid 22791); 29 Apr 2010 15:21:50 -0000 X-Spam-Check-By: sourceware.org Received: from pool-173-76-55-5.bstnma.fios.verizon.net (HELO cgf.cx) (173.76.55.5) by sourceware.org (qpsmtpd/0.83/v0.83-20-g38e4449) with ESMTP; Thu, 29 Apr 2010 15:21:43 +0000 Received: from ednor.cgf.cx (ednor.casa.cgf.cx [192.168.187.5]) by cgf.cx (Postfix) with ESMTP id 2A62D13C061 for ; Thu, 29 Apr 2010 11:21:42 -0400 (EDT) Received: by ednor.cgf.cx (Postfix, from userid 201) id 24B202B352; Thu, 29 Apr 2010 11:21:42 -0400 (EDT) Date: Thu, 29 Apr 2010 15:24:00 -0000 From: Christopher Faylor To: cygwin@cygwin.com Subject: Re: select() hanging after terminal killed Message-ID: <20100429152142.GA30282@ednor.casa.cgf.cx> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <201004291053.o3TAr15g018361@mail.bln1.bf.nsn-intra.net> <20100429151100.GU1845@calimero.vinschen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100429151100.GU1845@calimero.vinschen.de> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2010-04/txt/msg01023.txt.bz2 On Thu, Apr 29, 2010 at 05:11:00PM +0200, Corinna Vinschen wrote: >On Apr 29 12:53, Thomas Wolff wrote: >> If a terminal gets killed, its tty/pty is not properly closed. >> This is likely to confuse applications and let them hang, as observed >> with mined (thanks Andy for the report) and joe. >> >> On Linux and SunOS, a subsequent read() return 0 (indicating EOF); >> any further read() returns -1, errno indicating EIO. >> Immediate write() may report success a few times, >> further write() returns -1, errno indicating EIO. >> >> On Linux, select() indicates an exception and EIO. >> On SunOS, select() indicates both an exception and input (weird), >> and ENOENT initially, EIO on further attempts. >> >> On Cygwin, the following is observed: >> * EOF is not signalled on read(); rather EIO is indicated right away. >> (Maybe not too bad, an application can handle that as well.) >> * select() with timeout hangs. >> >> Especially the latter can hardly be handled by an application. > >Can you create a simple testcase? Hmm. Since the owner has both sides of the pipe open maybe closing the slave side doesn't trigger select. It's possible that Corinna's changes to tty handling might make this work better. It would be interesting to see how this works in a recent snapshot. cgf -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple