Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: unit test failure #3057

Closed
alberts opened this issue Feb 17, 2012 · 6 comments

Comments

Projects
None yet
5 participants
@alberts
Copy link
Contributor

commented Feb 17, 2012

What steps will reproduce the problem?
1. run go tests

What do you see instead?

panic: interface conversion: interface is nil, not *net.TCPAddr

goroutine 215 [running]:
net.selfConnect(0xf8401691b0, 0x3, 0x0, 0x0)
go/workspace/go/src/pkg/net/tcpsock_posix.go:263 +0x5f
net.DialTCP(0x54f26c, 0xf800000003, 0x0, 0xf8400c1d00, 0x539f01, ...)
go/workspace/go/src/pkg/net/tcpsock_posix.go:250 +0x24e
net.dialAddr(0x54f26c, 0x70637400000003, 0xf8400b1e10, 0xf, 0xf840046cc0, ...)
go/workspace/go/src/pkg/net/dial.go:102 +0x20b
net._func_001(0xf8400b1e20, 0xf8400b1e30, 0xf84007ad98, 0xf84007ada0, 0x0, ...)
go/workspace/go/src/pkg/net/dial.go:140 +0x177
created by net.DialTimeout
go/workspace/go/src/pkg/net/dial.go:142 +0x17c

Which compiler are you using (5g, 6g, 8g, gccgo)?

6g

Which operating system are you using?

linux

Which revision are you using?  (hg identify)

tip

Please provide any additional information below.

Log attached.

Attachments:

  1. net.txt (41016 bytes)
@dsymonds

This comment has been minimized.

Copy link
Member

commented Feb 18, 2012

Comment 1:

Tracing the problem:
- selfConnect is getting a *netFD with a nil raddr field.
- that fd is coming from internetSocket, which must be returning no error.
From the other end:
- DialTCP checks for raddr==nil, so raddr.toAddr() must be a non-nil sockaddr.
- internetSocket must call raddr.sockaddr (*TCPAddr.sockaddr), which only returns a
non-nil syscall.Sockaddr with nil error (and so ra is non-nil).
- This means that the problem must be socket returning an fd with a nil raddr even if
its ra argument is non-nil.
- That, in turn, means the toAddr func passed to socket (and internetSocket) must be
doing that.
- This fingers sockaddrToTCP, which will return nil if the syscall.Sockaddr is not one
of {*syscall.SockaddrInet4,*syscall.SockaddrInet6}.
- However, ipToSockaddr never returns a different type than those two, except with an
error.
Here the trail runs cold. I can't see what is going wrong without a way to reproduce
this and scattering some logging throughout. All I can think of is that it slipped in
with 002f08814913 (Russ' "net: avoid TCP self-connect"), so assigning it to him for
further diagnosis.

Labels changed: added priority-later, removed priority-triage.

Owner changed to @rsc.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Feb 18, 2012

Comment 2:

Labels changed: added priority-go1, removed priority-later.

@alberts

This comment has been minimized.

Copy link
Contributor Author

commented Feb 19, 2012

Comment 3:

It took a long time, but running the test repeatedly eventually reproduced this.
#!/bin/bash
set -xe
rm -f out err net.test
go test -c net
while true; do
for procs in 1 2 8 10 50 100; do
GOMAXPROCS=$procs time ./net.test -test.v >out 2>err || exit 1
echo $?
done
done
@robpike

This comment has been minimized.

Copy link
Contributor

commented Feb 20, 2012

Comment 4:

I notice that the Linux ARM builder is reproducibly giving the same failure, every time
it seems. for instance,
http://build.golang.org/log/5fd6fdde31381ed018fbaa55af7132cc72fbda8b
goroutine 236 [running]:
net.selfConnect(0x107ab9a0, 0x3, 0x0)
    /mnt/work2/tmp/gobuilder/linux-arm-minux-2c15f43065c1/go/src/pkg/net/tcpsock_posix.go:263 +0x84
net.DialTCP(0x15ad68, 0x3, 0x0, 0x1079c6d0, 0x10732801, ...)
    /mnt/work2/tmp/gobuilder/linux-arm-minux-2c15f43065c1/go/src/pkg/net/tcpsock_posix.go:250 +0x218
net.dialAddr(0x15ad68, 0x3, 0x107805f0, 0xf, 0x10732860, ...)
    /mnt/work2/tmp/gobuilder/linux-arm-minux-2c15f43065c1/go/src/pkg/net/dial.go:102 +0x1fc
net._func_001(0x107838a8, 0x107838b0, 0x107838b8, 0x107838c0, 0x0, ...)
    /mnt/work2/tmp/gobuilder/linux-arm-minux-2c15f43065c1/go/src/pkg/net/dial.go:140 +0x1ac
created by net.DialTimeout
    /mnt/work2/tmp/gobuilder/linux-arm-minux-2c15f43065c1/go/src/pkg/net/dial.go:142 +0x194
@robpike

This comment has been minimized.

Copy link
Contributor

commented Feb 20, 2012

Comment 5:

Labels changed: added go1-must.

@robpike

This comment has been minimized.

Copy link
Contributor

commented Feb 21, 2012

Comment 6:

This issue was closed by revision 152d806.

Status changed to Fixed.

@alberts alberts added fixed labels Feb 21, 2012

@rsc rsc added this to the Go1 milestone Apr 10, 2015

@rsc rsc removed priority-go1 labels Apr 10, 2015

@golang golang locked and limited conversation to collaborators Jun 24, 2016

This issue was closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.