From unknown Sat Aug 16 19:22:31 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13018: fport_fill_input should handle EINTR Resent-From: Aidan Gauland Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Wed, 28 Nov 2012 08:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 13018 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: 13018@debbugs.gnu.org X-Debbugs-Original-To: bug-guile@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.13540909027398 (code B ref -1); Wed, 28 Nov 2012 08:22:01 +0000 Received: (at submit) by debbugs.gnu.org; 28 Nov 2012 08:21:42 +0000 Received: from localhost ([127.0.0.1]:42546 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tdctq-0001vG-9r for submit@debbugs.gnu.org; Wed, 28 Nov 2012 03:21:42 -0500 Received: from eggs.gnu.org ([208.118.235.92]:59298) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tdctn-0001v9-Qz for submit@debbugs.gnu.org; Wed, 28 Nov 2012 03:21:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tdcrs-00050m-VO for submit@debbugs.gnu.org; Wed, 28 Nov 2012 03:19:46 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:60903) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tdcrs-00050g-SH for submit@debbugs.gnu.org; Wed, 28 Nov 2012 03:19:40 -0500 Received: from eggs.gnu.org ([208.118.235.92]:50163) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tdcrj-0004XG-FV for bug-guile@gnu.org; Wed, 28 Nov 2012 03:19:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tdcrd-0004zG-OC for bug-guile@gnu.org; Wed, 28 Nov 2012 03:19:31 -0500 Received: from jersey.rurallink.co.nz ([114.134.15.197]:36462 helo=smtp.rurallink.co.nz) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tdcrd-0004rp-D1 for bug-guile@gnu.org; Wed, 28 Nov 2012 03:19:25 -0500 Received: from 114-134-8-154.rurallink.co.nz ([114.134.8.154] helo=dimension8.tehua.net) by smtp.rurallink.co.nz with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1TdcrR-0007Sk-5w for bug-guile@gnu.org; Wed, 28 Nov 2012 21:19:15 +1300 From: Aidan Gauland Date: Wed, 28 Nov 2012 21:19:06 +1300 Message-ID: <87vccqnnr9.fsf@dimension8.tehua.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Rurallink-Authenticated-User: aidalgol@no8wireless.co.nz 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: -3.5 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.3 (----) Guile version: 3.2.0-4-amd64 OS: Debian wheezy GNU/Linux, kernel 3.2.0-4-amd64 In a program that maintains a TCP connection with a polling loop, I have defined a signal handler with the `sigaction' procedure to terminate the connection gracefully. When the trapped signal is received (in this case SIGINT) and the handler called, the following error message is printed (full backtrace omitted): ERROR: In procedure %read-line: ERROR: In procedure fport_fill_input: Interrupted system call I mentioned this on #guile on freenode and mark_weaver informed me that I should be setting the SA_RESTART flag to avoid this problem, but that there is a bug in Guile causing the error. fport_fill_input should handle an EINTR error from 'read', and restart the read if that happens. by default on some systems, signals cause 'read', 'write', and many other system calls to abort and return an EINTR error. basically, at the POSIX level, every call to 'read' has to be within a little loop that takes care of the EINTR problem. In short, I don't fully understand the innards to have an opinion on whether this a bug or users should just set the SA_RESTART flag, bug Mark assures me this is, indeed, a bug. Any disagreement, take it up with him. ;) Regards, Aidan Gauland From unknown Sat Aug 16 19:22:31 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13018: fport_fill_input should handle EINTR Resent-From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Thu, 29 Nov 2012 20:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13018 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: Aidan Gauland Cc: "Mark H. Weaver" , 13018@debbugs.gnu.org Received: via spool by 13018-submit@debbugs.gnu.org id=B13018.13542205147337 (code B ref 13018); Thu, 29 Nov 2012 20:22:01 +0000 Received: (at 13018) by debbugs.gnu.org; 29 Nov 2012 20:21:54 +0000 Received: from localhost ([127.0.0.1]:45624 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TeAcL-0001uF-Vf for submit@debbugs.gnu.org; Thu, 29 Nov 2012 15:21:54 -0500 Received: from xanadu.aquilenet.fr ([88.191.123.111]:42455) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TeAcJ-0001u7-Jc for 13018@debbugs.gnu.org; Thu, 29 Nov 2012 15:21:53 -0500 Received: from localhost (localhost [127.0.0.1]) by xanadu.aquilenet.fr (Postfix) with ESMTP id 0544FAC00; Thu, 29 Nov 2012 21:19:49 +0100 (CET) Received: from xanadu.aquilenet.fr ([127.0.0.1]) by localhost (xanadu.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id htIH-t9iXABe; Thu, 29 Nov 2012 21:19:48 +0100 (CET) Received: from pluto (reverse-83.fdn.fr [80.67.176.83]) by xanadu.aquilenet.fr (Postfix) with ESMTPSA id 6866BABF4; Thu, 29 Nov 2012 21:19:48 +0100 (CET) From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <87vccqnnr9.fsf@dimension8.tehua.net> Date: Thu, 29 Nov 2012 21:19:48 +0100 In-Reply-To: <87vccqnnr9.fsf@dimension8.tehua.net> (Aidan Gauland's message of "Wed, 28 Nov 2012 21:19:06 +1300") Message-ID: <87ehjc5fh7.fsf@gnu.org> User-Agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 1.5 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hi! Aidan Gauland skribis: > fport_fill_input should handle an EINTR error from 'read', > and restart the read if that happens. > > by default on some systems, signals cause 'read', 'write', > and many other system calls to abort and return an EINTR > error. > > basically, at the POSIX level, every call to 'read' has to > be within a little loop that takes care of the EINTR > problem. [...] Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% [score: 0.5000] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 1.5 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hi! Aidan Gauland skribis: > fport_fill_input should handle an EINTR error from 'read', > and restart the read if that happens. > > by default on some systems, signals cause 'read', 'write', > and many other system calls to abort and return an EINTR > error. > > basically, at the POSIX level, every call to 'read' has to > be within a little loop that takes care of the EINTR > problem. [...] Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% [score: 0.4997] Hi! Aidan Gauland skribis: > fport_fill_input should handle an EINTR error from 'read', > and restart the read if that happens. > > by default on some systems, signals cause 'read', 'write', > and many other system calls to abort and return an EINTR > error. > > basically, at the POSIX level, every call to 'read' has to > be within a little loop that takes care of the EINTR > problem. =E2=80=98fport_fill_input=E2=80=99 does this: SCM_SYSCALL (count =3D read (fp->fdes, pt->read_buf, pt->read_buf_size)); and SCM_SYSCALL does that: # ifdef EINTR # if (EINTR > 0) # define SCM_SYSCALL(line) \ do \ { \ errno =3D 0; \ line; \ if (errno =3D=3D EINTR) \ { \ SCM_ASYNC_TICK; \ continue; \ } \ } \ while(0) # endif /* (EINTR > 0) */ # endif /* def EINTR */ On GNU/Linux, I see: $ echo '#include ' | gcc -E -dM - | grep EINTR #define EINTR 4 So AFAICS, the EINTR case is taken care of. Or am I missing something? Do you have a reduced test case? Thanks, Ludo=E2=80=99. From unknown Sat Aug 16 19:22:31 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13018: fport_fill_input should handle EINTR Resent-From: Andy Wingo Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 05 Mar 2013 18:55:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13018 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: Aidan Gauland Cc: 13018@debbugs.gnu.org Received: via spool by 13018-submit@debbugs.gnu.org id=B13018.13625096902165 (code B ref 13018); Tue, 05 Mar 2013 18:55:05 +0000 Received: (at 13018) by debbugs.gnu.org; 5 Mar 2013 18:54:50 +0000 Received: from localhost ([127.0.0.1]:32850 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UCx0j-0000Yq-1P for submit@debbugs.gnu.org; Tue, 05 Mar 2013 13:54:50 -0500 Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:40042 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UCx0b-0000YU-QU for 13018@debbugs.gnu.org; Tue, 05 Mar 2013 13:54:46 -0500 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 18F05BFB7; Tue, 5 Mar 2013 13:54:20 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=Y/pG1mzvYiRyRoQz6wTP1+0PQ3k=; b=jaCpi+ FkQiv02NCYEAeg8tEyhyQFXN3wAT2cbXY6+n6V3d8TfAtvYlRvRd3pbEfR71Nojc DWX7nJF0rsD4+tPUPG9MNVDWnibqrX51h6jtujeyuzMW0g2zHfqP5M0A7Fvc4LPg M019rC9W0WETtf8jrwT8zfy9CbjB/gbd5MXHE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=S5rbkcpqrSf8/lJZKy6LtiY782cMTHoz miJdtO6KsUOtcNkiX849zSoQtyCo8h7tsgyGN310dfNpWeRUu7qNzpCzcJXI5K79 P8L8UhVwnxIwnymSHmC3Wr5+u4Qukc//Ar5VT3IsFh6i9sNa9KIVdd5nWjT8cqXx LBmwzYP4tsk= Received: from a-pb-sasl-quonix.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 11E73BFB6; Tue, 5 Mar 2013 13:54:20 -0500 (EST) Received: from badger (unknown [217.91.84.86]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 8CEFCBFB5; Tue, 5 Mar 2013 13:54:19 -0500 (EST) From: Andy Wingo References: <87vccqnnr9.fsf@dimension8.tehua.net> Date: Tue, 05 Mar 2013 18:57:46 +0100 In-Reply-To: <87vccqnnr9.fsf@dimension8.tehua.net> (Aidan Gauland's message of "Wed, 28 Nov 2012 21:19:06 +1300") Message-ID: <87a9qhsp9h.fsf@pobox.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 163481EA-85C6-11E2-899D-59240E5B5709-02397024!a-pb-sasl-quonix.pobox.com X-Spam-Score: 0.2 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.5 (--) On Wed 28 Nov 2012 09:19, Aidan Gauland writes: > In a program that maintains a TCP connection with a polling loop, I have > defined a signal handler with the `sigaction' procedure to terminate the > connection gracefully. When the trapped signal is received (in this > case SIGINT) and the handler called, the following error message is > printed (full backtrace omitted): > > ERROR: In procedure %read-line: > ERROR: In procedure fport_fill_input: Interrupted system call Any more info here? Andy -- http://wingolog.org/ From unknown Sat Aug 16 19:22:31 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13018: fport_fill_input should handle EINTR Resent-From: Andy Wingo Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Wed, 13 Mar 2013 11:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13018 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Cc: "Mark H. Weaver" , 13018@debbugs.gnu.org, Aidan Gauland Received: via spool by 13018-submit@debbugs.gnu.org id=B13018.136317512617647 (code B ref 13018); Wed, 13 Mar 2013 11:46:02 +0000 Received: (at 13018) by debbugs.gnu.org; 13 Mar 2013 11:45:26 +0000 Received: from localhost ([127.0.0.1]:50480 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UFk7Z-0004aa-ND for submit@debbugs.gnu.org; Wed, 13 Mar 2013 07:45:25 -0400 Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:58078 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UFk7W-0004aP-Qo for 13018@debbugs.gnu.org; Wed, 13 Mar 2013 07:45:23 -0400 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 95790B139; Wed, 13 Mar 2013 07:44:16 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=sasl; bh=v12QpgrJks2P QagTL1Xm4fjv+F4=; b=nUUeIOrB+fl0zL2nkTDF65eMr1sQtdya6bp2cn2rJhim smisDdi5DDPfgR9sQQrthzGO9tIz+RWQWkz5HR5AYe4u33zjU7C95xuw/nhhFBsU pH4ZXSgNTcTXt7XN8waJLwu1JfLl0Itr3BQmKJQGGiU+DC4NWmwM36yS5CZuOgI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=sasl; b=qMSYFz QJhRho5rbDFm10PPjEOlGzuCc57e61nUVvx5kptwYNFoUVxsxEB5/PzfphK/ypg3 t4lPmzeV/unx8T/OMQJciJp2hi8LCyLsbO0yzLgK4b9RJEIYjBaweEJ22nONTeyf +joJRJKmIxloU0fYfFpB7cRNb9QLVObRZ2jgw= Received: from a-pb-sasl-quonix.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 8BA11B138; Wed, 13 Mar 2013 07:44:16 -0400 (EDT) Received: from badger (unknown [88.160.190.192]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id CF2CEB137; Wed, 13 Mar 2013 07:44:15 -0400 (EDT) From: Andy Wingo References: <87vccqnnr9.fsf@dimension8.tehua.net> <87ehjc5fh7.fsf@gnu.org> Date: Wed, 13 Mar 2013 12:44:13 +0100 In-Reply-To: <87ehjc5fh7.fsf@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Thu, 29 Nov 2012 21:19:48 +0100") Message-ID: <87sj3zh6cy.fsf@pobox.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Pobox-Relay-ID: 554B1BBA-8BD3-11E2-A0CC-59240E5B5709-02397024!a-pb-sasl-quonix.pobox.com X-Spam-Score: -1.6 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.3 (----) On Thu 29 Nov 2012 21:19, ludo@gnu.org (Ludovic Court=C3=A8s) writes: > Aidan Gauland skribis: > >> fport_fill_input should handle an EINTR error from 'read', >> and restart the read if that happens. >> >> by default on some systems, signals cause 'read', 'write', >> and many other system calls to abort and return an EINTR >> error. >> >> basically, at the POSIX level, every call to 'read' has to >> be within a little loop that takes care of the EINTR >> problem. > > =E2=80=98fport_fill_input=E2=80=99 does this: > > SCM_SYSCALL (count =3D read (fp->fdes, pt->read_buf, pt->read_buf_size)= ); > > and SCM_SYSCALL does that: > > # ifdef EINTR > # if (EINTR > 0) > # define SCM_SYSCALL(line) \ > do \ > { \ > errno =3D 0; \ > line; \ > if (errno =3D=3D EINTR) \ > { \ > SCM_ASYNC_TICK; \ > continue; \ > } \ > } \ > while(0) > # endif /* (EINTR > 0) */ > # endif /* def EINTR */ I get the feeling the EINTR is coming from somewhere else -- like the ASYNC_TICK. The sigaction could cause a thunk to run there. Aidan, do you have a test case? Andy --=20 http://wingolog.org/ From unknown Sat Aug 16 19:22:31 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13018: fport_fill_input should handle EINTR Resent-From: Aidan Gauland Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Fri, 29 Mar 2013 07:39:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13018 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: Andy Wingo Cc: "Mark H. Weaver" , Ludovic =?UTF-8?Q?Court=C3=A8s?= , 13018@debbugs.gnu.org Received: via spool by 13018-submit@debbugs.gnu.org id=B13018.13645427248424 (code B ref 13018); Fri, 29 Mar 2013 07:39:03 +0000 Received: (at 13018) by debbugs.gnu.org; 29 Mar 2013 07:38:44 +0000 Received: from localhost ([127.0.0.1]:50562 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1ULTtc-0002Bp-4R for submit@debbugs.gnu.org; Fri, 29 Mar 2013 03:38:44 -0400 Received: from jersey.rurallink.co.nz ([114.134.15.197]:49321 helo=smtp.rurallink.co.nz) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1ULTtY-0002Bf-MB for 13018@debbugs.gnu.org; Fri, 29 Mar 2013 03:38:42 -0400 Received: from 114-134-7-65.rurallink.co.nz ([114.134.7.65] helo=dimension8.tehua.net) by smtp.rurallink.co.nz with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1ULTqy-0007aN-67; Fri, 29 Mar 2013 20:36:01 +1300 From: Aidan Gauland References: <87vccqnnr9.fsf@dimension8.tehua.net> <87ehjc5fh7.fsf@gnu.org> <87sj3zh6cy.fsf@pobox.com> Date: Fri, 29 Mar 2013 20:35:53 +1300 In-Reply-To: <87sj3zh6cy.fsf@pobox.com> (Andy Wingo's message of "Wed, 13 Mar 2013 12:44:13 +0100") Message-ID: <87mwtmmzdy.fsf@dimension8.tehua.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Rurallink-Authenticated-User: aidalgol@no8wireless.co.nz X-Spam-Scanned-By: smtp.rurallink.co.nz (2fa1f66907c4fcdc8f57a6e3314b7bc88e091697) X-Spam-Score: -2.2 (--) X-Spam-Score: 0.8 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > Aidan, do you have a test case? I haven't been able to reproduce this with a minimal example, but I can consistently reproduce it with my IRC bot . Replace the last two lines (lines 22 and 23) of run-cbot.scm with... (define bot (make-bot "Cunning_Bot" "Cunning_Bot" "Cunning Bot" "chat.freenode.net" 6667)) (sigaction SIGINT (lambda () (disconnect-bot bot))) (start-bot bot '("#cunningbot")) ...run it (run-cbot.scm), and after it says Setting up IRC connection...done. Joining channels...done. type ^C I get this backtrace: ^CBacktrace: In ice-9/boot-9.scm: 157: 12 [catch #t # ...] In unknown file: ?: 11 [apply-smob/1 #] In ice-9/boot-9.scm: 63: 10 [call-with-prompt prompt0 ...] In ice-9/eval.scm: 421: 9 [eval # #] In ice-9/boot-9.scm: 2131: 8 [save-module-excursion #] 3718: 7 [#] In unknown file: ?: 6 [load-compiled/vm "/home/aidan/.cache/guile/ccache/2.0-LE-8-2.0/home/aidan/src/cunning-bot/run-cbot.scm.go"] In /home/aidan/src/cunning-bot/bot.scm: 260: 5 [start-bot # #] 115: 4 [read-line-irc #] In ice-9/rdelim.scm: 129: 3 [read-line # trim] In unknown file: ?: 2 [%read-line #] In ice-9/boot-9.scm: 184: 1 [throw system-error "fport_fill_input" "~A" ("Interrupted system call") (4)] In /home/aidan/src/cunning-bot/run-cbot.scm: 24: 0 [# 2] /home/aidan/src/cunning-bot/run-cbot.scm:24:2: In procedure #: /home/aidan/src/cunning-bot/run-cbot.scm:24:2: Wrong number of arguments to # Could this be caused by a bug in spells? I wish I could give a simpler test case. :( Regards, Aidan Gauland (Sorry I forgot to group reply the first time.) From unknown Sat Aug 16 19:22:31 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13018: fport_fill_input should handle EINTR Resent-From: Mark H Weaver Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Wed, 03 Jul 2013 19:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13018 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: Aidan Gauland , 13018@debbugs.gnu.org Received: via spool by 13018-submit@debbugs.gnu.org id=B13018.137287886910357 (code B ref 13018); Wed, 03 Jul 2013 19:15:01 +0000 Received: (at 13018) by debbugs.gnu.org; 3 Jul 2013 19:14:29 +0000 Received: from localhost ([127.0.0.1]:55296 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UuSVY-0002gy-Nh for submit@debbugs.gnu.org; Wed, 03 Jul 2013 15:14:29 -0400 Received: from world.peace.net ([96.39.62.75]:44209 ident=hope8) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UuSVV-0002gn-Ug for 13018@debbugs.gnu.org; Wed, 03 Jul 2013 15:14:27 -0400 Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.91.212] helo=tines.lan) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1UuSVO-0002hY-Lc; Wed, 03 Jul 2013 15:14:18 -0400 From: Mark H Weaver References: <87vccqnnr9.fsf@dimension8.tehua.net> <87ehjc5fh7.fsf@gnu.org> <87sj3zh6cy.fsf@pobox.com> Date: Wed, 03 Jul 2013 15:14:10 -0400 In-Reply-To: <87sj3zh6cy.fsf@pobox.com> (Andy Wingo's message of "Wed, 13 Mar 2013 12:44:13 +0100") Message-ID: <87zju3e9rx.fsf@tines.lan> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 (/) We now finally understand the cause of this bug. See below. Andy Wingo writes: > On Thu 29 Nov 2012 21:19, ludo@gnu.org (Ludovic Court=C3=A8s) writes: > >> Aidan Gauland skribis: >> >>> fport_fill_input should handle an EINTR error from 'read', >>> and restart the read if that happens. >>> >>> by default on some systems, signals cause 'read', 'write', >>> and many other system calls to abort and return an EINTR >>> error. >>> >>> basically, at the POSIX level, every call to 'read' has to >>> be within a little loop that takes care of the EINTR >>> problem. >> >> =E2=80=98fport_fill_input=E2=80=99 does this: >> >> SCM_SYSCALL (count =3D read (fp->fdes, pt->read_buf, pt->read_buf_size= )); >> >> and SCM_SYSCALL does that: >> >> # ifdef EINTR >> # if (EINTR > 0) >> # define SCM_SYSCALL(line) \ >> do \ >> { \ >> errno =3D 0; \ >> line; \ >> if (errno =3D=3D EINTR) \ >> { \ >> SCM_ASYNC_TICK; \ >> continue; \ >> } \ >> } \ >> while(0) >> # endif /* (EINTR > 0) */ >> # endif /* def EINTR */ > > I get the feeling the EINTR is coming from somewhere else [...] As Ludovic finally realized, the 'continue' above always exits the loop, because 'continue' jumps to the test, rather than unconditionally jumping to the top of the loop body. This bug was introduced in Guile 2.0.0. We are now discussing how to proceed on guile-devel: http://lists.gnu.org/archive/html/guile-devel/2013-06/msg00050.html http://lists.gnu.org/archive/html/guile-devel/2013-07/msg00002.html Thanks, Mark From unknown Sat Aug 16 19:22:31 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: Aidan Gauland Subject: bug#13018: closed (Re: bug#13018: fport_fill_input should handle EINTR) Message-ID: References: <87txizuaj6.fsf@tines.lan> <87vccqnnr9.fsf@dimension8.tehua.net> X-Gnu-PR-Message: they-closed 13018 X-Gnu-PR-Package: guile Reply-To: 13018@debbugs.gnu.org Date: Thu, 08 Aug 2013 21:41:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1375998062-11482-1" This is a multi-part message in MIME format... ------------=_1375998062-11482-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #13018: fport_fill_input should handle EINTR 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 13018@debbugs.gnu.org. --=20 13018: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D13018 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1375998062-11482-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 13018-done) by debbugs.gnu.org; 8 Aug 2013 21:40:24 +0000 Received: from localhost ([127.0.0.1]:48011 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V7XwV-0002y6-TG for submit@debbugs.gnu.org; Thu, 08 Aug 2013 17:40:24 -0400 Received: from world.peace.net ([96.39.62.75]:50785 ident=hope4) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V7XwT-0002xv-8K for 13018-done@debbugs.gnu.org; Thu, 08 Aug 2013 17:40:21 -0400 Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.91.212] helo=tines.lan) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1V7XwM-0002Ie-39; Thu, 08 Aug 2013 17:40:14 -0400 From: Mark H Weaver To: Aidan Gauland Subject: Re: bug#13018: fport_fill_input should handle EINTR References: <87vccqnnr9.fsf@dimension8.tehua.net> <87ehjc5fh7.fsf@gnu.org> <87sj3zh6cy.fsf@pobox.com> <87zju3e9rx.fsf@tines.lan> Date: Thu, 08 Aug 2013 17:39:57 -0400 In-Reply-To: <87zju3e9rx.fsf@tines.lan> (Mark H. Weaver's message of "Wed, 03 Jul 2013 15:14:10 -0400") Message-ID: <87txizuaj6.fsf@tines.lan> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 13018-done Cc: 13018-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: 0.0 (/) This bug was fixed in fe51c7b3e0a1e93be3bb81dd2d4b18936fe2df3a. Thanks! Mark ------------=_1375998062-11482-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 28 Nov 2012 08:21:42 +0000 Received: from localhost ([127.0.0.1]:42546 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tdctq-0001vG-9r for submit@debbugs.gnu.org; Wed, 28 Nov 2012 03:21:42 -0500 Received: from eggs.gnu.org ([208.118.235.92]:59298) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tdctn-0001v9-Qz for submit@debbugs.gnu.org; Wed, 28 Nov 2012 03:21:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tdcrs-00050m-VO for submit@debbugs.gnu.org; Wed, 28 Nov 2012 03:19:46 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:60903) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tdcrs-00050g-SH for submit@debbugs.gnu.org; Wed, 28 Nov 2012 03:19:40 -0500 Received: from eggs.gnu.org ([208.118.235.92]:50163) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tdcrj-0004XG-FV for bug-guile@gnu.org; Wed, 28 Nov 2012 03:19:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tdcrd-0004zG-OC for bug-guile@gnu.org; Wed, 28 Nov 2012 03:19:31 -0500 Received: from jersey.rurallink.co.nz ([114.134.15.197]:36462 helo=smtp.rurallink.co.nz) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tdcrd-0004rp-D1 for bug-guile@gnu.org; Wed, 28 Nov 2012 03:19:25 -0500 Received: from 114-134-8-154.rurallink.co.nz ([114.134.8.154] helo=dimension8.tehua.net) by smtp.rurallink.co.nz with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1TdcrR-0007Sk-5w for bug-guile@gnu.org; Wed, 28 Nov 2012 21:19:15 +1300 From: Aidan Gauland To: bug-guile@gnu.org Subject: fport_fill_input should handle EINTR Date: Wed, 28 Nov 2012 21:19:06 +1300 Message-ID: <87vccqnnr9.fsf@dimension8.tehua.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Rurallink-Authenticated-User: aidalgol@no8wireless.co.nz 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: -3.5 (---) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.3 (----) Guile version: 3.2.0-4-amd64 OS: Debian wheezy GNU/Linux, kernel 3.2.0-4-amd64 In a program that maintains a TCP connection with a polling loop, I have defined a signal handler with the `sigaction' procedure to terminate the connection gracefully. When the trapped signal is received (in this case SIGINT) and the handler called, the following error message is printed (full backtrace omitted): ERROR: In procedure %read-line: ERROR: In procedure fport_fill_input: Interrupted system call I mentioned this on #guile on freenode and mark_weaver informed me that I should be setting the SA_RESTART flag to avoid this problem, but that there is a bug in Guile causing the error. fport_fill_input should handle an EINTR error from 'read', and restart the read if that happens. by default on some systems, signals cause 'read', 'write', and many other system calls to abort and return an EINTR error. basically, at the POSIX level, every call to 'read' has to be within a little loop that takes care of the EINTR problem. In short, I don't fully understand the innards to have an opinion on whether this a bug or users should just set the SA_RESTART flag, bug Mark assures me this is, indeed, a bug. Any disagreement, take it up with him. ;) Regards, Aidan Gauland ------------=_1375998062-11482-1--