Skip to content

sync/atomic: generalCAS64 broken #6440

Closed
@quarnster

Description

@quarnster
Before filing a bug, please check whether it has been fixed since the
latest release. Search the issue tracker and check that you're running the
latest version of Go:

Run "go version" and compare against
http://golang.org/doc/devel/release.html  If a newer version of Go exists,
install it and retry what you did to reproduce the problem.

Thanks.

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. Save http://play.golang.org/p/lqkYmdbrx2 as hellonet.go
2. GOARM=5 CGO_ENABLED=0 go build hellonet.go (cross compilation or compiling directly
on target makes no difference)
4. ./hellonet
5. Connect to the target's tcpsocket 6060 any way you want

What is the expected output?

Something like an immediate print of "2013/09/21 12:10:11 &{{0x102500f0}}"
and hellonet exiting as soon as a client connects.

What do you see instead?

The client connects to the socket and absolutely nothing happens. I've gotten SIGSEGVs a
couple of times but don't know how long that took as I left it running while I did
something else:

SIGSEGV: segmentation violation
PC=0x20870

scaninterfacedata(0x2, 0x40050f60, 0x1)
    /Users/quarnster/code/3rdparty/go/src/pkg/runtime/mgc0.c:1351 +0x48
scanbitvector(0x40050f60, 0x131070, 0x198901)
    /Users/quarnster/code/3rdparty/go/src/pkg/runtime/mgc0.c:1384 +0x118
addframeroots(0xbe910a60, 0x0)
    /Users/quarnster/code/3rdparty/go/src/pkg/runtime/mgc0.c:1420 +0x1c0
runtime.gentraceback(0x1d034, 0x40050df4, 0x16708, 0x105010a0, 0x0, ...)
    /Users/quarnster/code/3rdparty/go/src/pkg/runtime/traceback_arm.c:132 +0x408
addstackroots(0x105010a0)
    /Users/quarnster/code/3rdparty/go/src/pkg/runtime/mgc0.c:1475 +0xcc
addroots()
    /Users/quarnster/code/3rdparty/go/src/pkg/runtime/mgc0.c:1556 +0x1f8
gc(0x40161fb0)
    /Users/quarnster/code/3rdparty/go/src/pkg/runtime/mgc0.c:2098 +0x19c
mgc(0x10501820)
    /Users/quarnster/code/3rdparty/go/src/pkg/runtime/mgc0.c:2049 +0x30
runtime.mcall(0x1e6e90)
    /Users/quarnster/code/3rdparty/go/src/pkg/runtime/asm_arm.s:165 +0x38

goroutine 3 [garbage collection]:
runtime.gc(0x1)
    /Users/quarnster/code/3rdparty/go/src/pkg/runtime/mgc0.c:2020 +0x1a0 fp=0x40161fb8
forcegchelper(0x4005ff9c)
    /Users/quarnster/code/3rdparty/go/src/pkg/runtime/mheap.c:385 +0x2c fp=0x40161fc0
runtime.goexit()
    /Users/quarnster/code/3rdparty/go/src/pkg/runtime/proc.c:1386 fp=0x40161fc0
created by runtime.MHeap_Scavenger
    /Users/quarnster/code/3rdparty/go/src/pkg/runtime/mheap.c:439

goroutine 1 [runnable]:
sync/atomic.loadUint64(0x1054b080, 0x0, 0x0)
    /Users/quarnster/code/3rdparty/go/src/pkg/sync/atomic/64bit_arm.go:10 +0x84
net.(*fdMutex).RWLock(0x1054b080, 0x1e6901, 0x4000d100)
    /Users/quarnster/code/3rdparty/go/src/pkg/net/fd_mutex.go:121 +0xb8
net.(*netFD).readLock(0x1054b080, 0x0, 0x0)
    /Users/quarnster/code/3rdparty/go/src/pkg/net/fd_unix.go:122 +0x4c
net.(*netFD).accept(0x1054b080, 0x12bdc4, 0x0, 0x0, 0x0)
    /Users/quarnster/code/3rdparty/go/src/pkg/net/fd_unix.go:368 +0x6c
net.(*TCPListener).AcceptTCP(0x10500170, 0x10543008, 0x0, 0x0)
    /Users/quarnster/code/3rdparty/go/src/pkg/net/tcpsock_posix.go:233 +0x70
net.(*TCPListener).Accept(0x10500170, 0x0, 0x0, 0x0, 0x0)
    /Users/quarnster/code/3rdparty/go/src/pkg/net/tcpsock_posix.go:243 +0x4c
main.main()
    /Users/quarnster/code/go/hellonet.go:14 +0x154

trap    0xe
error   0x5
oldmask 0x0
r0      0xbe9109d0
r1      0xe59fb030
r2      0x412
r3      0x40cac
r4      0x40050f60
r5      0x1
r6      0x412
r7      0x28
r8      0x16708
r9      0x1e89c0
r10     0x1e6e78
fp      0x1e6e6c
ip      0x1d034
sp      0xbe9109cc
lr      0x209fc
pc      0x20870
cpsr    0x60000010
fault   0xe59fb030


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

5g, either on the native linux/armv5tel or cross building.

Which operating system are you using?

Linux/armv5tel 2.6.32.12 synology_88f6281_411j

Which version are you using?  (run 'go version')

go version devel +125bf33c1905 Sat Sep 21 17:53:44 2013 +1000 linux/arm.

The same test works just fine with hg tag go1.1.2.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions