[Bug go/59506] net FAILs (timeout) on alpha
ubizjak at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Dec 19 19:09:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59506
--- Comment #2 from Uroš Bizjak <ubizjak at gmail dot com> ---
This is the TestSelfConnect testcase (from net/dial_test.go) problem:
--cut here--
// Try to connect to that address repeatedly.
n := 100000
if testing.Short() {
n = 1000
}
switch runtime.GOOS {
case "darwin", "dragonfly", "freebsd", "netbsd", "openbsd", "plan9",
"solaris", "windows":
// Non-Linux systems take a long time to figure
// out that there is nothing listening on localhost.
n = 100
}
for i := 0; i < n; i++ {
c, err := Dial("tcp", addr)
if err == nil {
c.Close()
t.Errorf("#%d: Dial %q succeeded", i, addr)
}
}
--cut here--
The Dial takes approx a second to timeout on alpha (kernel 3.12.2, glibc 2.15),
so the test with 100000 connections timeouts. Changing the number of
repetitions to 100 "fixes" the test, while trying with 1000 still timeouts.
However, I would like to propose following patch to change Dial to DialTimeout
with a millisecond deterministic timeout:
--cut here--
Index: go/net/dial_test.go
===================================================================
--- go/net/dial_test.go (revision 206123)
+++ go/net/dial_test.go (working copy)
@@ -147,7 +147,7 @@
n = 100
}
for i := 0; i < n; i++ {
- c, err := Dial("tcp", addr)
+ c, err := DialTimeout("tcp", addr, time.Millisecond)
if err == nil {
c.Close()
t.Errorf("#%d: Dial %q succeeded", i, addr)
--cut here--
Patched test succeeds without problems (and would probably succeed for other
special-cased OSes too), while I believe it still correctly tests for
selfconnect misfeature [1],[2].
[1] http://golang.org/issue/2690
[2] http://stackoverflow.com/questions/4949858/
More information about the Gcc-bugs
mailing list