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: i...@airs.com
        ReportedBy: r...@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.

Reply via email to