public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug go/48019] New: Need to handle EINTR in libgo testsuite
@ 2011-03-07 14:20 ro at gcc dot gnu.org
  2011-03-09  6:32 ` [Bug go/48019] " ian at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: ro at gcc dot gnu.org @ 2011-03-07 14:20 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48019

           Summary: Need to handle EINTR in libgo testsuite
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: go
        AssignedTo: ian@airs.com
        ReportedBy: ro@gcc.gnu.org
              Host: i386-pc-solaris2.11
            Target: i386-pc-solaris2.11
             Build: i386-pc-solaris2.11


Several libgo tests randomly fail with unhandled EINTR on Solaris 2:

--- FAIL: net.TestTCPServer
    Test tcp 0.0.0.0 127.0.0.1
    Test tcp  127.0.0.1
    Test tcp [::] [::ffff:127.0.0.1]
    Test tcp [::] 127.0.0.1
    net.Dial("tcp", "", "127.0.0.1:41117") = _, dial tcp 127.0.0.1:41117:
Interrupted system call

--- FAIL: http.TestServeFile
    http://127.0.0.1:56313/ServeFile send: dial tcp 127.0.0.1:56313:
Interrupted system call

/vol/gcc/src/hg/trunk/solaris/libgo/runtime/thread.c:36: libgo assertion
failure

The last can be handled like this:

diff -r 350a6b184ae7 libgo/runtime/thread.c
--- a/libgo/runtime/thread.c    Mon Mar 07 00:16:29 2011 +0100
+++ b/libgo/runtime/thread.c    Mon Mar 07 08:37:04 2011 +0100
@@ -1,7 +1,8 @@
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010, 2011 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.

+#include <errno.h>
 #include "runtime.h"
 #include "go-assert.h"

@@ -32,8 +33,16 @@
 static void
 runtime_lock_full(Lock *l)
 {
-    if(sem_wait(&l->sem) != 0)
+    int i;
+
+        for(;;) {
+          i = sem_wait(&l->sem);
+            if (i >= 0)
+            break;
+        if (i < 0 && errno == EINTR)
+                  continue;
         runtime_throw("sem_wait failed");
+    }
 }

 void

but I've yet to find out where the other unhandled EINTRs occur.  Running the
affected tests under truss distorts the timing so much the failures don't occur
anymore.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug go/48019] Need to handle EINTR in libgo testsuite
  2011-03-07 14:20 [Bug go/48019] New: Need to handle EINTR in libgo testsuite ro at gcc dot gnu.org
@ 2011-03-09  6:32 ` ian at gcc dot gnu.org
  2011-03-09  6:57 ` ian at airs dot com
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ian at gcc dot gnu.org @ 2011-03-09  6:32 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48019

--- Comment #1 from ian at gcc dot gnu.org <ian at gcc dot gnu.org> 2011-03-09 06:31:46 UTC ---
Author: ian
Date: Wed Mar  9 06:31:37 2011
New Revision: 170810

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=170810
Log:
    PR go/48019
Ignore EINTR in runtime_lock_full.

Modified:
    trunk/libgo/runtime/thread.c


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug go/48019] Need to handle EINTR in libgo testsuite
  2011-03-07 14:20 [Bug go/48019] New: Need to handle EINTR in libgo testsuite ro at gcc dot gnu.org
  2011-03-09  6:32 ` [Bug go/48019] " ian at gcc dot gnu.org
  2011-03-09  6:57 ` ian at airs dot com
@ 2011-03-09  6:57 ` ian at gcc dot gnu.org
  2011-03-09 18:21 ` ian at airs dot com
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ian at gcc dot gnu.org @ 2011-03-09  6:57 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48019

--- Comment #2 from ian at gcc dot gnu.org <ian at gcc dot gnu.org> 2011-03-09 06:57:08 UTC ---
Author: ian
Date: Wed Mar  9 06:57:04 2011
New Revision: 170811

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=170811
Log:
    PR go/48019
Ignore EINTR in socket connect.

Modified:
    trunk/libgo/go/net/sock.go


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug go/48019] Need to handle EINTR in libgo testsuite
  2011-03-07 14:20 [Bug go/48019] New: Need to handle EINTR in libgo testsuite ro at gcc dot gnu.org
  2011-03-09  6:32 ` [Bug go/48019] " ian at gcc dot gnu.org
@ 2011-03-09  6:57 ` ian at airs dot com
  2011-03-09  6:57 ` ian at gcc dot gnu.org
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ian at airs dot com @ 2011-03-09  6:57 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48019

Ian Lance Taylor <ian at airs dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED

--- Comment #3 from Ian Lance Taylor <ian at airs dot com> 2011-03-09 06:57:44 UTC ---
This should be fixed now.

Thanks.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug go/48019] Need to handle EINTR in libgo testsuite
  2011-03-07 14:20 [Bug go/48019] New: Need to handle EINTR in libgo testsuite ro at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-03-09  6:57 ` ian at gcc dot gnu.org
@ 2011-03-09 18:21 ` ian at airs dot com
  2011-03-09 18:30 ` ro at CeBiTec dot Uni-Bielefeld.DE
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ian at airs dot com @ 2011-03-09 18:21 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48019

--- Comment #4 from Ian Lance Taylor <ian at airs dot com> 2011-03-09 18:21:44 UTC ---
Come to think of it, the code sets SA_RESTART when it calls sigaction.  Is
SA_RESTART defined on Solaris?  Do I have to #define any special macros to get
it to be defined?


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug go/48019] Need to handle EINTR in libgo testsuite
  2011-03-07 14:20 [Bug go/48019] New: Need to handle EINTR in libgo testsuite ro at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2011-03-09 18:21 ` ian at airs dot com
@ 2011-03-09 18:30 ` ro at CeBiTec dot Uni-Bielefeld.DE
  2011-03-09 19:31 ` ian at airs dot com
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ro at CeBiTec dot Uni-Bielefeld.DE @ 2011-03-09 18:30 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48019

--- Comment #5 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> 2011-03-09 18:30:12 UTC ---
> --- Comment #4 from Ian Lance Taylor <ian at airs dot com> 2011-03-09 18:21:44 UTC ---
> Come to think of it, the code sets SA_RESTART when it calls sigaction.  Is
> SA_RESTART defined on Solaris?  Do I have to #define any special macros to get
> it to be defined?

It is defined, given the following conditions:

#if defined(__EXTENSIONS__) || defined(_KERNEL) || \
        (!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \
        defined(_XPG4_2)

I.e. it is missing in a strict ANSI C/non-XPG 4.2+ environment.

    Rainer


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug go/48019] Need to handle EINTR in libgo testsuite
  2011-03-07 14:20 [Bug go/48019] New: Need to handle EINTR in libgo testsuite ro at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2011-03-09 18:30 ` ro at CeBiTec dot Uni-Bielefeld.DE
@ 2011-03-09 19:31 ` ian at airs dot com
  2011-03-16 20:33 ` ian at airs dot com
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ian at airs dot com @ 2011-03-09 19:31 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48019

--- Comment #6 from Ian Lance Taylor <ian at airs dot com> 2011-03-09 19:30:54 UTC ---
Thanks, so it sounds like SA_RESTART should be defined when compiling libgo. 
The relevant file is libgo/runtime/go-go.c.

The Solaris man page that I found on the web suggests that even when SA_RESTART
is set, the connect and accept calls are not restarted.  That is, it lists the
set of calls which are restarted, and that list does not include connect and
accept.  Can you confirm or deny this behaviour?


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug go/48019] Need to handle EINTR in libgo testsuite
  2011-03-07 14:20 [Bug go/48019] New: Need to handle EINTR in libgo testsuite ro at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2011-03-09 19:31 ` ian at airs dot com
@ 2011-03-16 20:33 ` ian at airs dot com
  2011-03-16 20:35 ` ian at airs dot com
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ian at airs dot com @ 2011-03-16 20:33 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48019

--- Comment #7 from Ian Lance Taylor <ian at airs dot com> 2011-03-16 20:32:38 UTC ---
I don't have access to a Solaris system.  I would be very interested in hearing
whether connect and accept calls are restarted after a signal handler installed
with SA_RESTART, or whether they return EINTR.  The current code in libgo seems
likely to be wrong, and I'd like to fix it.  I will attach a program; can you
run it on a Solaris system?


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug go/48019] Need to handle EINTR in libgo testsuite
  2011-03-07 14:20 [Bug go/48019] New: Need to handle EINTR in libgo testsuite ro at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2011-03-16 20:33 ` ian at airs dot com
@ 2011-03-16 20:35 ` ian at airs dot com
  2011-03-16 23:08 ` gseanmcg at gmail dot com
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ian at airs dot com @ 2011-03-16 20:35 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48019

--- Comment #8 from Ian Lance Taylor <ian at airs dot com> 2011-03-16 20:33:31 UTC ---
Created attachment 23683
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23683
test

On GNU/Linux this program prints

connect: Connection timed out


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug go/48019] Need to handle EINTR in libgo testsuite
  2011-03-07 14:20 [Bug go/48019] New: Need to handle EINTR in libgo testsuite ro at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2011-03-16 20:35 ` ian at airs dot com
@ 2011-03-16 23:08 ` gseanmcg at gmail dot com
  2011-03-17  3:14 ` ian at airs dot com
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: gseanmcg at gmail dot com @ 2011-03-16 23:08 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48019

Sean McGovern <gseanmcg at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gseanmcg at gmail dot com

--- Comment #9 from Sean McGovern <gseanmcg at gmail dot com> 2011-03-16 23:05:56 UTC ---
Added sys/types.h and sys/socket.h to get AF_INET and SOCK_STREAM.

$ gcc -o foo2 foo2.c -lsocket
$ ./foo2
connect: Interrupted system call


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug go/48019] Need to handle EINTR in libgo testsuite
  2011-03-07 14:20 [Bug go/48019] New: Need to handle EINTR in libgo testsuite ro at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2011-03-16 23:08 ` gseanmcg at gmail dot com
@ 2011-03-17  3:14 ` ian at airs dot com
  2011-03-18 17:27 ` ro at CeBiTec dot Uni-Bielefeld.DE
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ian at airs dot com @ 2011-03-17  3:14 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48019

Ian Lance Taylor <ian at airs dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |ASSIGNED
   Last reconfirmed|                            |2011.03.17 02:58:56
         Resolution|FIXED                       |
     Ever Confirmed|0                           |1

--- Comment #10 from Ian Lance Taylor <ian at airs dot com> 2011-03-17 02:58:56 UTC ---
Thanks.  It looks like the Solaris connect call does not honor SA_RESTART for
some reason.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug go/48019] Need to handle EINTR in libgo testsuite
  2011-03-07 14:20 [Bug go/48019] New: Need to handle EINTR in libgo testsuite ro at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2011-03-17  3:14 ` ian at airs dot com
@ 2011-03-18 17:27 ` ro at CeBiTec dot Uni-Bielefeld.DE
  2011-03-30 21:26 ` ian at airs dot com
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ro at CeBiTec dot Uni-Bielefeld.DE @ 2011-03-18 17:27 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48019

--- Comment #11 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> 2011-03-18 17:21:42 UTC ---
> --- Comment #10 from Ian Lance Taylor <ian at airs dot com> 2011-03-17 02:58:56 UTC ---
> Thanks.  It looks like the Solaris connect call does not honor SA_RESTART for
> some reason.

It's not only Solaris, though:

Tru64 UNIX V5.1B:

connect: Interrupted system call

but:

IRIX 6.5:

connect: Connection timed out

    Rainer


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug go/48019] Need to handle EINTR in libgo testsuite
  2011-03-07 14:20 [Bug go/48019] New: Need to handle EINTR in libgo testsuite ro at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2011-03-18 17:27 ` ro at CeBiTec dot Uni-Bielefeld.DE
@ 2011-03-30 21:26 ` ian at airs dot com
  2011-03-31 16:11 ` ro at CeBiTec dot Uni-Bielefeld.DE
  2011-03-31 23:55 ` ian at airs dot com
  13 siblings, 0 replies; 15+ messages in thread
From: ian at airs dot com @ 2011-03-30 21:26 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48019

--- Comment #12 from Ian Lance Taylor <ian at airs dot com> 2011-03-30 21:05:39 UTC ---
Created attachment 23825
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23825
accept testcase

OK, so now we know that connect ignores SA_RESTART, but I forgot to ask about
accept.  Can you try this program as well?

On GNU/Linux it prints "accept succeeded".

Thanks.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug go/48019] Need to handle EINTR in libgo testsuite
  2011-03-07 14:20 [Bug go/48019] New: Need to handle EINTR in libgo testsuite ro at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2011-03-30 21:26 ` ian at airs dot com
@ 2011-03-31 16:11 ` ro at CeBiTec dot Uni-Bielefeld.DE
  2011-03-31 23:55 ` ian at airs dot com
  13 siblings, 0 replies; 15+ messages in thread
From: ro at CeBiTec dot Uni-Bielefeld.DE @ 2011-03-31 16:11 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48019

--- Comment #13 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> 2011-03-31 16:00:53 UTC ---
> OK, so now we know that connect ignores SA_RESTART, but I forgot to ask about
> accept.  Can you try this program as well?
>
> On GNU/Linux it prints "accept succeeded".

Sure: on Solaris 8/x86 and Solaris 11/SPARC, I get

accept: Interrupted system call

On IRIX 6.5 and Tru64 UNIX V5.1, I get

accept succeeded

    Rainer


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug go/48019] Need to handle EINTR in libgo testsuite
  2011-03-07 14:20 [Bug go/48019] New: Need to handle EINTR in libgo testsuite ro at gcc dot gnu.org
                   ` (12 preceding siblings ...)
  2011-03-31 16:11 ` ro at CeBiTec dot Uni-Bielefeld.DE
@ 2011-03-31 23:55 ` ian at airs dot com
  13 siblings, 0 replies; 15+ messages in thread
From: ian at airs dot com @ 2011-03-31 23:55 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48019

Ian Lance Taylor <ian at airs dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #14 from Ian Lance Taylor <ian at airs dot com> 2011-03-31 22:25:09 UTC ---
Thanks for running the tests.  Now that I look at the current library, the
connect and accept system calls are only ever run on a nonblocking socket, so
they will never wait (this was not true before).  So I think this problem
should be all fixed with the current libgo sources.  Let me know if you
discover otherwise.


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2011-03-31 22:25 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-07 14:20 [Bug go/48019] New: Need to handle EINTR in libgo testsuite ro at gcc dot gnu.org
2011-03-09  6:32 ` [Bug go/48019] " ian at gcc dot gnu.org
2011-03-09  6:57 ` ian at airs dot com
2011-03-09  6:57 ` ian at gcc dot gnu.org
2011-03-09 18:21 ` ian at airs dot com
2011-03-09 18:30 ` ro at CeBiTec dot Uni-Bielefeld.DE
2011-03-09 19:31 ` ian at airs dot com
2011-03-16 20:33 ` ian at airs dot com
2011-03-16 20:35 ` ian at airs dot com
2011-03-16 23:08 ` gseanmcg at gmail dot com
2011-03-17  3:14 ` ian at airs dot com
2011-03-18 17:27 ` ro at CeBiTec dot Uni-Bielefeld.DE
2011-03-30 21:26 ` ian at airs dot com
2011-03-31 16:11 ` ro at CeBiTec dot Uni-Bielefeld.DE
2011-03-31 23:55 ` ian at airs dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).