From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: gnutls error handling Date: Sun, 17 Oct 2010 11:22:22 -0400 Message-ID: References: Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1287328957 11293 80.91.229.12 (17 Oct 2010 15:22:37 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 17 Oct 2010 15:22:37 +0000 (UTC) Cc: emacs-devel@gnu.org To: Lars Magne Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 17 17:22:35 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1P7V4F-0005ag-Dm for ged-emacs-devel@m.gmane.org; Sun, 17 Oct 2010 17:22:35 +0200 Original-Received: from localhost ([127.0.0.1]:59728 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P7V4E-0003uT-QD for ged-emacs-devel@m.gmane.org; Sun, 17 Oct 2010 11:22:34 -0400 Original-Received: from [140.186.70.92] (port=42818 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P7V48-0003uI-KW for emacs-devel@gnu.org; Sun, 17 Oct 2010 11:22:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P7V43-0007PG-5o for emacs-devel@gnu.org; Sun, 17 Oct 2010 11:22:28 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]:47815) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P7V43-0007PB-4B for emacs-devel@gnu.org; Sun, 17 Oct 2010 11:22:23 -0400 Original-Received: from eliz by fencepost.gnu.org with local (Exim 4.69) (envelope-from ) id 1P7V42-0003gq-2Q; Sun, 17 Oct 2010 11:22:22 -0400 In-reply-to: (message from Lars Magne Ingebrigtsen on Sun, 17 Oct 2010 15:55:24 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:131778 Archived-At: > From: Lars Magne Ingebrigtsen > Date: Sun, 17 Oct 2010 15:55:24 +0200 > Mail-Copies-To: never > > poll([{fd=4, events=POLLIN}, {fd=3, events=POLLIN}], 2, 0) = 0 (Timeout) > select(15, [3 4 8 10 13], [], NULL, {0, 15591}) = 2 (in [8 10], left {0, 15589}) > read(3, 0xec9b94, 4096) = -1 EAGAIN (Resource temporarily unavailable) > poll([{fd=4, events=POLLIN}, {fd=3, events=POLLIN}], 2, 0) = 0 (Timeout) > select(15, [3 4 8 10 13], [], NULL, {0, 15532}) = 2 (in [8 10], left {0, 15530}) > read(3, 0xec9b94, 4096) = -1 EAGAIN (Resource temporarily unavailable) > > There's always a gnutls socket involved in the select call -- in this > instance it was fd 10. lsof showed the socket to be in the CLOSE_WAIT > state. So my suspicion is that the we're somehow now communicating back > to Emacs that a gnutls socket has closed. Not really a useful answer, but the `select' man page has this piece of wisdom: Under Linux, select() may report a socket file descriptor as "ready for reading", while nevertheless a subsequent read blocks. This could for example happen when data has arrived but upon examination has wrong checksum and is discarded. There may be other circumstances in which a file descriptor is spuriously reported as ready. Thus it may be safer to use O_NONBLOCK on sockets that should not block. Of course, we already use O_NONBLOCK (AFAIK).