golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.1k stars 17.68k forks source link

build fails when ipv6 is disabled #1859

Closed gopherbot closed 9 years ago

gopherbot commented 13 years ago

by temotor:

What steps will reproduce the problem?
1. sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
2. cd "$GOROOT"/src
3. ./all.bash

What is the expected output?
1 known bugs; 0 unexpected bugs

ALL TESTS PASSED

What do you see instead?
gopack grc _test/net.a _gotest_.6  _cgo_defun.6 _cgo_import.6 cgo_linux.cgo2.o
cgo_unix.cgo2.o _cgo_export.o
--- FAIL: net.TestFilePacketConn (0.00 seconds)
    Listen failed: dial udp: cannot assign requested address
--- FAIL: net.TestTCPServer (0.00 seconds)
    Test tcp 127.0.0.1 127.0.0.1
    Test tcp [::1] [::1]
    net.Listen("tcp", "[::1]:0") = _, listen tcp [::1]:0: cannot assign requested address
FAIL
gotest: "./6.out -test.short=true -test.timeout=120" failed: exit status 1
make[1]: *** [testshort] Error 2
make[1]: Leaving directory `/home/temoto/src/go/src/pkg/net'
make: *** [net.testshort] Error 1

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

Which operating system are you using?
Linux 2.6.37-12-generic x86_64

Which revision are you using?  (hg identify)
e1e194eb5c8e (release-branch.r57)

Please provide any additional information below.
gopherbot commented 13 years ago

Comment 1 by temotor:

If the issue will be accepted, i'd like to know in which way to fix it and i'll
contribute a patch. Maybe accept failure to bind to [::1]/tcp6 as normal?
bradfitz commented 13 years ago

Comment 2:

I can't reproduce this.  The net tests pass with or without IPv6 (disabling it the same
way you suggest)
What's your output of "ifconfig" when your IPv6 is disabled?

Status changed to WaitingForReply.

gopherbot commented 13 years ago

Comment 3 by temotor:

$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:1e:6a:15:5f:be  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
he-ipv6   Link encap:IPv6-in-IPv4  
          inet6 addr: 2001:470:1f0a:7eb::2/64 Scope:Global
          UP POINTOPOINT RUNNING NOARP  MTU:1480  Metric:1
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
wlan0     Link encap:Ethernet  HWaddr 00:1f:cc:d5:1b:ee  
          inet addr:10.0.4.25  Bcast:10.0.4.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX/TX stats omited.
mikioh commented 13 years ago

Comment 4:

Nice hurricane electric IPv6-overIPv4 tunneling service. I use it with dual-stack 
CPE too. But I've never tried 6-over-4 tunneling host.
So can you try to reproduce this issue with tip? tip includes a patch that fixes 
issue #1769, looks similar issue.
gopherbot commented 13 years ago

Comment 5 by temotor:

With tip it goes timeout.
gopack grc _test/net.a _gotest_.6  _cgo_defun.6 _cgo_import.6 cgo_linux.cgo2.o
cgo_unix.cgo2.o _cgo_export.o
panic: test timed out
runtime.panic+0xac /home/temoto/src/go/src/pkg/runtime/proc.c:1060
    runtime.panic(0x48bcf8, 0xf8400e1500)
testing.alarm+0x47 /home/temoto/src/go/src/pkg/testing/testing.go:266
    testing.alarm()
runtime.goexit /home/temoto/src/go/src/pkg/runtime/proc.c:178
    runtime.goexit()
----- goroutine created by -----
time._func_002+0x23 /home/temoto/src/go/src/pkg/time/sleep.go:69
goroutine 47 [4]:
runtime.gosched+0x5c /home/temoto/src/go/src/pkg/runtime/proc.c:603
    runtime.gosched()
runtime.chanrecv+0x177 /home/temoto/src/go/src/pkg/runtime/chan.c:361
    runtime.chanrecv(0xf8400d7360, 0x2b2333c44db8, 0x0, 0x0, 0x0, ...)
runtime.chanrecv1+0x4a /home/temoto/src/go/src/pkg/runtime/chan.c:424
    runtime.chanrecv1(0xf8400d7360, 0xf8400d55a0)
net.*pollServer·WaitRead+0x49 /home/temoto/src/go/src/pkg/net/fd.go:255
    net.*pollServer·WaitRead(0xf840033a00, 0xf8400d55a0, 0x0, 0x0)
net.*netFD·accept+0x377 /home/temoto/src/go/src/pkg/net/fd.go:605
    net.*netFD·accept(0xf8400d55a0, 0x42370e, 0x0, 0x0, 0x0, ...)
net.*TCPListener·AcceptTCP+0x71 /home/temoto/src/go/src/pkg/net/tcpsock.go:263
    net.*TCPListener·AcceptTCP(0xf8400b0a38, 0xf8400becd0, 0x0, 0x0, 0xf8400dc320, ...)
net.*TCPListener·Accept+0x49 /home/temoto/src/go/src/pkg/net/tcpsock.go:273
    net.*TCPListener·Accept(0xf8400b0a38, 0x0, 0x0, 0x0, 0x0, ...)
net.runServe+0x241 /home/temoto/src/go/src/pkg/net/_obj/cgo_linux.cgo1.go:1473
    net.runServe(0xf8400c0b80, 0x4de79c, 0x3, 0xf8400b07f8, 0x303a00000002, ...)
runtime.goexit /home/temoto/src/go/src/pkg/runtime/proc.c:178
    runtime.goexit()
----- goroutine created by -----
net.doTest+0x286 /home/temoto/src/go/src/pkg/net/_obj/cgo_linux.cgo1.go:1534
goroutine 11 [3]:
runtime.entersyscall+0x78 /home/temoto/src/go/src/pkg/runtime/proc.c:639
    runtime.entersyscall()
syscall.Syscall6+0x5 /home/temoto/src/go/src/pkg/syscall/asm_linux_amd64.s:40
    syscall.Syscall6()
syscall.EpollWait+0x89 /home/temoto/src/go/src/pkg/syscall/zsyscall_linux_amd64.go:200
    syscall.EpollWait(0xf800000006, 0xf840019f30, 0xa0000000a, 0xffffffff, 0xc, ...)
net.*pollster·WaitFD+0x115 /home/temoto/src/go/src/pkg/net/fd_linux.go:130
    net.*pollster·WaitFD(0xf840019f20, 0xf840033a00, 0x0, 0xffffffff, 0x0, ...)
net.*pollServer·Run+0xe0 /home/temoto/src/go/src/pkg/net/fd.go:226
    net.*pollServer·Run(0xf840033a00, 0x0)
runtime.goexit /home/temoto/src/go/src/pkg/runtime/proc.c:178
    runtime.goexit()
----- goroutine created by -----
net.newPollServer+0x328 /home/temoto/src/go/src/pkg/net/newpollserver.go:39
goroutine 34 [4]:
runtime.gosched+0x5c /home/temoto/src/go/src/pkg/runtime/proc.c:603
    runtime.gosched()
runtime.chanrecv+0x177 /home/temoto/src/go/src/pkg/runtime/chan.c:361
    runtime.chanrecv(0xf8400d7480, 0x2b2333c429f0, 0x0, 0x0, 0x0, ...)
runtime.chanrecv1+0x4a /home/temoto/src/go/src/pkg/runtime/chan.c:424
    runtime.chanrecv1(0xf8400d7480, 0xf8400d5640)
net.*pollServer·WaitWrite+0x49 /home/temoto/src/go/src/pkg/net/fd.go:260
    net.*pollServer·WaitWrite(0xf840033a00, 0xf8400d5640, 0xf8400bfe80, 0x2900000073)
net.*netFD·connect+0x75 /home/temoto/src/go/src/pkg/net/fd.go:310
    net.*netFD·connect(0xf8400d5640, 0xf840001c60, 0xf8400bfe80, 0x0, 0x0, ...)
net.socket+0x2a2 /home/temoto/src/go/src/pkg/net/sock.go:51
    net.socket(0x4de79c, 0x3, 0x10000000a, 0xf800000000, 0x0, ...)
net.internetSocket+0x3d0 /home/temoto/src/go/src/pkg/net/ipsock.go:177
    net.internetSocket(0x4de79c, 0xf800000003, 0x0, 0x0, 0xf8400185c0, ...)
net.DialTCP+0x1dd /home/temoto/src/go/src/pkg/net/tcpsock.go:224
    net.DialTCP(0x4de79c, 0x2b2300000003, 0x0, 0xf8400d8b80, 0xf8400d8b80, ...)
net.Dial+0x64d /home/temoto/src/go/src/pkg/net/dial.go:36
    net.Dial(0x4de79c, 0x3, 0xf8400dc160, 0xf80000000b, 0x0, ...)
net.connect+0x787 /home/temoto/src/go/src/pkg/net/_obj/cgo_linux.cgo1.go:1491
    net.connect(0xf8400c0b80, 0x4de79c, 0x3, 0xf8400dc160, 0x303a0000000b, ...)
net.doTest+0x3d4 /home/temoto/src/go/src/pkg/net/_obj/cgo_linux.cgo1.go:1539
    net.doTest(0xf8400c0b80, 0x4de79c, 0x70637400000003, 0xf8400b07f8, 0x2, ...)
net.TestTCPServer+0x1ec /home/temoto/src/go/src/pkg/net/_obj/cgo_linux.cgo1.go:1551
    net.TestTCPServer(0xf8400c0b80, 0xf8400c0ae0)
testing.tRunner+0x2b /home/temoto/src/go/src/pkg/testing/testing.go:152
    testing.tRunner(0xf8400c0b80, 0xf840040258, 0x0, 0x0)
runtime.goexit /home/temoto/src/go/src/pkg/runtime/proc.c:178
    runtime.goexit()
----- goroutine created by -----
testing.RunTests+0x277 /home/temoto/src/go/src/pkg/testing/testing.go:189
goroutine 1 [4]:
runtime.gosched+0x5c /home/temoto/src/go/src/pkg/runtime/proc.c:603
    runtime.gosched()
runtime.chanrecv+0x458 /home/temoto/src/go/src/pkg/runtime/chan.c:329
    runtime.chanrecv(0xf8400be410, 0x2b2333c40ed0, 0x0, 0x0, 0x402865, ...)
runtime.chanrecv1+0x4a /home/temoto/src/go/src/pkg/runtime/chan.c:424
    runtime.chanrecv1(0xf8400be410, 0xf840040258)
testing.RunTests+0x28b /home/temoto/src/go/src/pkg/testing/testing.go:190
    testing.RunTests(0x400c00, 0xf840040000, 0x2000000020, 0x400d9c)
testing.Main+0x4f /home/temoto/src/go/src/pkg/testing/testing.go:163
    testing.Main(0x400c00, 0xf840040000, 0x2000000020, 0xf8400000e8, 0x0, ...)
main.main+0x6d /home/temoto/src/go/src/pkg/net/_testmain.go:60
    main.main()
runtime.mainstart+0xf /home/temoto/src/go/src/pkg/runtime/amd64/asm.s:77
    runtime.mainstart()
runtime.goexit /home/temoto/src/go/src/pkg/runtime/proc.c:178
    runtime.goexit()
----- goroutine created by -----
_rt0_amd64+0x8e /home/temoto/src/go/src/pkg/runtime/amd64/asm.s:64
mikioh commented 13 years ago

Comment 6:

I just realized that both he-ipv6 and lo interfaces on your host still keep IPv6
addresses even you disabled IPv6.
 That's a bit strange to me because my Linux box (2.6.32-31) removes IPv6 addresses immediately when I run  sysctl to disable IPv6.
gopherbot commented 13 years ago

Comment 7 by temotor:

Yes, strange. When i enable IPv6 back, eth0 and he-ipv6 interfaces gain one more inet6
address each.
Can i do anything else to refine problem?
mikioh commented 13 years ago

Comment 8:

Sorry for late response.
Seems like I've reached some conclusion, somehow.
a) Linux kernel 2.6.32, 2.6.38 work well
b) Only 2.6.37 shows some strange behavior
c) Linux 2.6.37-rc2 introduced an interesting patch
<q>
From <http://lwn.net/Articles/415635/>;
Lorenzo Colitti (1): ipv6: addrconf: don't remove address 
state on ifdown if the address is being kept
</q>
I think, I guess, the above patch introduced in 2.6.37 but 
reverted in 2.6.38 because a build on 2.6.38 works fine,
and looks like the patch might be a root culprit of this 
issue.
Hope this helps.
gopherbot commented 13 years ago

Comment 9 by temotor:

Thank you, i will test other kernel versions and report back.
gopherbot commented 13 years ago

Comment 10 by temotor:

Yes, on 2.6.38 it builds with IPv6 both disabled and enabled.
rsc commented 13 years ago

Comment 11:

Great, not our fault.  :-)

Status changed to Retracted.