From unknown Sun Jun 22 07:55:07 2025 X-Loop: help-debbugs@gnu.org Subject: bug#18988: select failure with EINTR in guile-2.0.11 Resent-From: Chris Vine Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Fri, 07 Nov 2014 17:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 18988 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: 18988@debbugs.gnu.org X-Debbugs-Original-To: bug-guile@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.14153807119143 (code B ref -1); Fri, 07 Nov 2014 17:19:02 +0000 Received: (at submit) by debbugs.gnu.org; 7 Nov 2014 17:18:31 +0000 Received: from localhost ([127.0.0.1]:53106 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XmnB9-0002NO-05 for submit@debbugs.gnu.org; Fri, 07 Nov 2014 12:18:31 -0500 Received: from eggs.gnu.org ([208.118.235.92]:38266) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XmnB7-0002NH-FA for submit@debbugs.gnu.org; Fri, 07 Nov 2014 12:18:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XmnB0-0006tP-PF for submit@debbugs.gnu.org; Fri, 07 Nov 2014 12:18:29 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:49899) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmnB0-0006tK-NR for submit@debbugs.gnu.org; Fri, 07 Nov 2014 12:18:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39944) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmnAu-0002hH-MX for bug-guile@gnu.org; Fri, 07 Nov 2014 12:18:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XmnAn-0006qx-Kf for bug-guile@gnu.org; Fri, 07 Nov 2014 12:18:16 -0500 Received: from smtpout5.wanadoo.co.uk ([80.12.242.80]:17286 helo=smtpout.wanadoo.co.uk) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmnAn-0006qj-ET for bug-guile@gnu.org; Fri, 07 Nov 2014 12:18:09 -0500 Received: from bother.homenet ([95.146.110.63]) by mwinf5d65 with ME id ChJ61p0091N6uAf03hJ6P3; Fri, 07 Nov 2014 18:18:07 +0100 X-ME-Helo: bother.homenet X-ME-Date: Fri, 07 Nov 2014 18:18:07 +0100 X-ME-IP: 95.146.110.63 Received: from bother.homenet (localhost [127.0.0.1]) by bother.homenet (Postfix) with ESMTP id DE2748B9EE for ; Fri, 7 Nov 2014 17:18:09 +0000 (GMT) Date: Fri, 7 Nov 2014 17:18:09 +0000 From: Chris Vine Message-ID: <20141107171809.5ff33de4@bother.homenet> X-Mailer: Claws Mail 3.10.0 (GTK+ 2.24.24; i686-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) A program of mine using guile-2.0.11 fails whenever a signal occurs while a call to select is blocking, with this error: Backtrace: In ice-9/boot-9.scm: 157: 9 [catch #t # ...] In unknown file: ?: 8 [apply-smob/1 #] In ice-9/boot-9.scm: 63: 7 [call-with-prompt prompt0 ...] In ice-9/eval.scm: 432: 6 [eval # #] In ice-9/boot-9.scm: 2401: 5 [save-module-excursion #] 4052: 4 [#] In unknown file: ?: 3 [load-compiled/vm "/home/chris/.cache/guile/ccache/2.0-LE-4-2.0/home/chris/src/event-loop.scm.go"] In /home/chris/src/./event-loop.scm: 258: 2 [#] 68: 1 [event-loop-run #] In unknown file: ?: 0 [select (5) () () # #] ERROR: In procedure select: ERROR: In procedure select: Interrupted system call According to the mailing list exchange at http://lists.gnu.org/archive/html/guile-rpc-bugs/2014-05/msg00001.html , this was fixed in guile >= 2.0.10. However it is still present (or back as a regression) in guile-2.0.11. The EINTR-safe wrapper mentioned in the mailing list exchange fixes it for me in user code, but it would be nice if it were not necessary and guile handled EINTR itself. From unknown Sun Jun 22 07:55:07 2025 X-Loop: help-debbugs@gnu.org Subject: bug#18988: select failure with EINTR in guile-2.0.11 Resent-From: Chris Vine Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Mon, 17 Nov 2014 18:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18988 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: 18988@debbugs.gnu.org Received: via spool by 18988-submit@debbugs.gnu.org id=B18988.14162478734794 (code B ref 18988); Mon, 17 Nov 2014 18:12:02 +0000 Received: (at 18988) by debbugs.gnu.org; 17 Nov 2014 18:11:13 +0000 Received: from localhost ([127.0.0.1]:36562 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XqQlc-0001FE-Bz for submit@debbugs.gnu.org; Mon, 17 Nov 2014 13:11:12 -0500 Received: from smtpout3.wanadoo.co.uk ([80.12.242.59]:33299 helo=smtpout.wanadoo.co.uk) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XqQlY-0001Et-An for 18988@debbugs.gnu.org; Mon, 17 Nov 2014 13:11:10 -0500 Received: from bother.homenet ([95.146.110.34]) by mwinf5d41 with ME id GiB61p0010kaQNv03iB6my; Mon, 17 Nov 2014 19:11:06 +0100 X-ME-Helo: bother.homenet X-ME-Date: Mon, 17 Nov 2014 19:11:06 +0100 X-ME-IP: 95.146.110.34 Received: from bother.homenet (localhost [127.0.0.1]) by bother.homenet (Postfix) with ESMTP id CBF528B1C7 for <18988@debbugs.gnu.org>; Mon, 17 Nov 2014 18:11:06 +0000 (GMT) Date: Mon, 17 Nov 2014 18:11:06 +0000 From: Chris Vine Message-ID: <20141117181106.7deb8e59@bother.homenet> In-Reply-To: <20141107171809.5ff33de4@bother.homenet> References: <20141107171809.5ff33de4@bother.homenet> X-Mailer: Claws Mail 3.10.0 (GTK+ 2.24.25; i686-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On looking at the code in filesys.c, it is evident that EINTR is not handled by select as described in the documentation, and that there are three solutions to this: 1. To do what the documentation says, and to handle EINTR by returning rather than by throwing a system-error exception ("[select] also returns if interrupted by a signal"). Pros: it probably matches what people have been coding to since that is what is currently (but wrongly) documented as happening; and it still provides an opportunity for a program relying on a timeout to decide what to do if the system call returns prematurely. Cons: It is very difficult for user code to restart the call with an appropriately reduced new timeout period representing the residue of the timeout period - but that is something users of select must expect anyway because a file descriptor becoming ready will have the same effect (and there is always the SA_RESTART flag). 2. To restart with an appropriately reduced timeout representing the residue of the timeout period. Pros: EINTR is handled seamlessly as if by SA_RESTART. Cons: Although linux modifies the timeout argument on returning to indicate the unexpired period of a timeout, I believe the BSDs do not (I have no idea what windows does). For OSs that do not provide this information, there are two sub-choices - behave as in 1 above, or to just restart and accept that the timeout might be much delayed in the presence of interrupts by wrapping the select call with SCM_SYSCALL (in theory, on a long timeout with many interrupts, the timeout may never occur at all). 3. To correct the documentation but leave select throwing an exception on an interrupt occuring, by saying in the documentation that rather than select returning, it throws a system-error exception with errno set to EINTR. On balance I would go for 1 above. I am happy to submit a patch, but won't do so unless I know that that is the behaviour that is wanted. From unknown Sun Jun 22 07:55:07 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Chris Vine Subject: bug#18988: closed (Re: bug#18988: select failure with EINTR in guile-2.0.11) Message-ID: References: <87389dwr01.fsf@gnu.org> <20141107171809.5ff33de4@bother.homenet> X-Gnu-PR-Message: they-closed 18988 X-Gnu-PR-Package: guile Reply-To: 18988@debbugs.gnu.org Date: Thu, 20 Nov 2014 20:35:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1416515702-415-1" This is a multi-part message in MIME format... ------------=_1416515702-415-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #18988: select failure with EINTR in guile-2.0.11 which was filed against the guile package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 18988@debbugs.gnu.org. --=20 18988: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D18988 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1416515702-415-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 18988-done) by debbugs.gnu.org; 20 Nov 2014 20:34:32 +0000 Received: from localhost ([127.0.0.1]:39879 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XrYQx-00005w-7G for submit@debbugs.gnu.org; Thu, 20 Nov 2014 15:34:31 -0500 Received: from hera.aquilenet.fr ([141.255.128.1]:54415) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XrYQv-00005o-8e for 18988-done@debbugs.gnu.org; Thu, 20 Nov 2014 15:34:29 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id A9FFE4028; Thu, 20 Nov 2014 21:34:28 +0100 (CET) Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rkQd8dcMG9YE; Thu, 20 Nov 2014 21:34:28 +0100 (CET) Received: from pluto (reverse-83.fdn.fr [80.67.176.83]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 4CA3E324; Thu, 20 Nov 2014 21:34:28 +0100 (CET) From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Chris Vine Subject: Re: bug#18988: select failure with EINTR in guile-2.0.11 References: <20141107171809.5ff33de4@bother.homenet> <20141117181106.7deb8e59@bother.homenet> Date: Thu, 20 Nov 2014 21:34:22 +0100 In-Reply-To: <20141117181106.7deb8e59@bother.homenet> (Chris Vine's message of "Mon, 17 Nov 2014 18:11:06 +0000") Message-ID: <87389dwr01.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 18988-done Cc: 18988-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) Thanks for the report and analysis. I went ahead and commit d1447c7 clarifies the behavior of =E2=80=98select=E2=80=99 in the presence of inter= ruptions by signals (will be in 2.0.12.) Ludo=E2=80=99. ------------=_1416515702-415-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 7 Nov 2014 17:18:31 +0000 Received: from localhost ([127.0.0.1]:53106 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XmnB9-0002NO-05 for submit@debbugs.gnu.org; Fri, 07 Nov 2014 12:18:31 -0500 Received: from eggs.gnu.org ([208.118.235.92]:38266) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XmnB7-0002NH-FA for submit@debbugs.gnu.org; Fri, 07 Nov 2014 12:18:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XmnB0-0006tP-PF for submit@debbugs.gnu.org; Fri, 07 Nov 2014 12:18:29 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:49899) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmnB0-0006tK-NR for submit@debbugs.gnu.org; Fri, 07 Nov 2014 12:18:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39944) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmnAu-0002hH-MX for bug-guile@gnu.org; Fri, 07 Nov 2014 12:18:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XmnAn-0006qx-Kf for bug-guile@gnu.org; Fri, 07 Nov 2014 12:18:16 -0500 Received: from smtpout5.wanadoo.co.uk ([80.12.242.80]:17286 helo=smtpout.wanadoo.co.uk) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmnAn-0006qj-ET for bug-guile@gnu.org; Fri, 07 Nov 2014 12:18:09 -0500 Received: from bother.homenet ([95.146.110.63]) by mwinf5d65 with ME id ChJ61p0091N6uAf03hJ6P3; Fri, 07 Nov 2014 18:18:07 +0100 X-ME-Helo: bother.homenet X-ME-Date: Fri, 07 Nov 2014 18:18:07 +0100 X-ME-IP: 95.146.110.63 Received: from bother.homenet (localhost [127.0.0.1]) by bother.homenet (Postfix) with ESMTP id DE2748B9EE for ; Fri, 7 Nov 2014 17:18:09 +0000 (GMT) Date: Fri, 7 Nov 2014 17:18:09 +0000 From: Chris Vine To: bug-guile@gnu.org Subject: select failure with EINTR in guile-2.0.11 Message-ID: <20141107171809.5ff33de4@bother.homenet> X-Mailer: Claws Mail 3.10.0 (GTK+ 2.24.24; i686-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) A program of mine using guile-2.0.11 fails whenever a signal occurs while a call to select is blocking, with this error: Backtrace: In ice-9/boot-9.scm: 157: 9 [catch #t # ...] In unknown file: ?: 8 [apply-smob/1 #] In ice-9/boot-9.scm: 63: 7 [call-with-prompt prompt0 ...] In ice-9/eval.scm: 432: 6 [eval # #] In ice-9/boot-9.scm: 2401: 5 [save-module-excursion #] 4052: 4 [#] In unknown file: ?: 3 [load-compiled/vm "/home/chris/.cache/guile/ccache/2.0-LE-4-2.0/home/chris/src/event-loop.scm.go"] In /home/chris/src/./event-loop.scm: 258: 2 [#] 68: 1 [event-loop-run #] In unknown file: ?: 0 [select (5) () () # #] ERROR: In procedure select: ERROR: In procedure select: Interrupted system call According to the mailing list exchange at http://lists.gnu.org/archive/html/guile-rpc-bugs/2014-05/msg00001.html , this was fixed in guile >= 2.0.10. However it is still present (or back as a regression) in guile-2.0.11. The EINTR-safe wrapper mentioned in the mailing list exchange fixes it for me in user code, but it would be nice if it were not necessary and guile handled EINTR itself. ------------=_1416515702-415-1--