[Bug go/59506] net FAILs (timeout) on alpha

2013-12-27 Thread ian at airs dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59506

Ian Lance Taylor ian at airs dot com changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2013-12-27
 Ever confirmed|0   |1

--- Comment #3 from Ian Lance Taylor ian at airs dot com ---
Thanks for the suggestion.

https://codereview.appspot.com/39200044


[Bug go/59506] net FAILs (timeout) on alpha

2013-12-27 Thread ian at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59506

--- Comment #4 from ian at gcc dot gnu.org ian at gcc dot gnu.org ---
Author: ian
Date: Fri Dec 27 21:42:26 2013
New Revision: 206224

URL: http://gcc.gnu.org/viewcvs?rev=206224root=gccview=rev
Log:
PR go/59506

net: use DialTimeout in TestSelfConnect

Backported from master repository.

This avoids problems with systems that take a long time to
find out nothing is listening, while still testing for the
self-connect misfeature since a self-connect should be fast.
With this we may be able to remove the test for non-Linux
systems.

Tested (on GNU/Linux) by editing selfConnect in
tcpsock_posix.go to always return false and verifying that
TestSelfConnect then fails with and without this change.

Idea from Uros Bizjak.

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


[Bug go/59506] net FAILs (timeout) on alpha

2013-12-27 Thread ian at airs dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59506

Ian Lance Taylor ian at airs dot com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #5 from Ian Lance Taylor ian at airs dot com ---
Fixed, I hope.


[Bug go/59506] net FAILs (timeout) on alpha

2013-12-19 Thread ubizjak at gmail dot com
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 := 10
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 10 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/

[Bug go/59506] net FAILs (timeout) on alpha

2013-12-14 Thread ubizjak at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59506

--- Comment #1 from Uroš Bizjak ubizjak at gmail dot com ---
Created attachment 31438
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=31438action=edit
strace -f output

Some ~30 seconds of strace dump.