GNU bug report logs - #18988
select failure with EINTR in guile-2.0.11

Previous Next

Package: guile;

Reported by: Chris Vine <chris <at> cvine.freeserve.co.uk>

Date: Fri, 7 Nov 2014 17:19:02 UTC

Severity: normal

Done: ludo <at> gnu.org (Ludovic Courtès)

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18988 in the body.
You can then email your comments to 18988 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#18988; Package guile. (Fri, 07 Nov 2014 17:19:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chris Vine <chris <at> cvine.freeserve.co.uk>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Fri, 07 Nov 2014 17:19:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Chris Vine <chris <at> cvine.freeserve.co.uk>
To: bug-guile <at> gnu.org
Subject: select failure with EINTR in guile-2.0.11
Date: Fri, 7 Nov 2014 17:18:09 +0000
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 #<catch-closure 820f0a0> ...]
  In unknown file:
     ?: 8 [apply-smob/1 #<catch-closure 820f0a0>]
  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 #<procedure 821fd00 at ice-9/boot-9.scm:4045:3 ()>]
  4052: 4 [#<procedure 821fd00 at ice-9/boot-9.scm:4045:3 ()>]
  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 [#<procedure 8767350 ()>]
    68: 1 [event-loop-run #<r6rs:record:event-loop>]
  In unknown file:
     ?: 0 [select (5) () () #<undefined> #<undefined>]

  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.




Information forwarded to bug-guile <at> gnu.org:
bug#18988; Package guile. (Mon, 17 Nov 2014 18:12:02 GMT) Full text and rfc822 format available.

Message #8 received at 18988 <at> debbugs.gnu.org (full text, mbox):

From: Chris Vine <chris <at> cvine.freeserve.co.uk>
To: 18988 <at> debbugs.gnu.org
Subject: Re: select failure with EINTR in guile-2.0.11
Date: Mon, 17 Nov 2014 18:11:06 +0000
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.




Reply sent to ludo <at> gnu.org (Ludovic Courtès):
You have taken responsibility. (Thu, 20 Nov 2014 20:35:01 GMT) Full text and rfc822 format available.

Notification sent to Chris Vine <chris <at> cvine.freeserve.co.uk>:
bug acknowledged by developer. (Thu, 20 Nov 2014 20:35:02 GMT) Full text and rfc822 format available.

Message #13 received at 18988-done <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Chris Vine <chris <at> cvine.freeserve.co.uk>
Cc: 18988-done <at> debbugs.gnu.org
Subject: Re: bug#18988: select failure with EINTR in guile-2.0.11
Date: Thu, 20 Nov 2014 21:34:22 +0100
Thanks for the report and analysis.  I went ahead and commit d1447c7
clarifies the behavior of ‘select’ in the presence of interruptions by
signals (will be in 2.0.12.)

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 19 Dec 2014 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 129 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.