sasha-s / go-deadlock

Online deadlock detection in go (golang)
Apache License 2.0
1.04k stars 76 forks source link

tests fail on linux/x86_64 with go 1.9 #3

Closed decathorpe closed 7 years ago

decathorpe commented 7 years ago

When running "go test" with go 1.9 (linux/x86_64, other architectures seem to work), the following failure occurs:

+ go test -compiler gc -ldflags '' github.com/sasha-s/go-deadlock
POTENTIAL DEADLOCK: Inconsistent locking. saw this ordering in one goroutine:
happened before
deadlock_test.go:44 go-deadlock.TestNoDeadlocks.func2.1 { a.RLock() } <<<<<
deadlock_test.go:55 go-deadlock.TestNoDeadlocks.func2 { }() }
happened after
deadlock_test.go:47 go-deadlock.TestNoDeadlocks.func2.1.1 { b.Lock() } <<<<<
deadlock_test.go:54 go-deadlock.TestNoDeadlocks.func2.1 { }() }
deadlock_test.go:55 go-deadlock.TestNoDeadlocks.func2 { }() }
in another goroutine: happened before
deadlock_test.go:47 go-deadlock.TestNoDeadlocks.func2.1.1 { b.Lock() } <<<<<
deadlock_test.go:54 go-deadlock.TestNoDeadlocks.func2.1 { }() }
deadlock_test.go:55 go-deadlock.TestNoDeadlocks.func2 { }() }
happend after
deadlock_test.go:44 go-deadlock.TestNoDeadlocks.func2.1 { a.RLock() } <<<<<
deadlock_test.go:55 go-deadlock.TestNoDeadlocks.func2 { }() }
Other goroutines holding locks:
goroutine 0 lock 0xc420014118
deadlock_test.go:47 go-deadlock.TestNoDeadlocks.func2.1.1 { b.Lock() } <<<<<
deadlock_test.go:54 go-deadlock.TestNoDeadlocks.func2.1 { }() }
deadlock_test.go:55 go-deadlock.TestNoDeadlocks.func2 { }() }
goroutine 0 lock 0xc4200160e0
deadlock_test.go:50 go-deadlock.TestNoDeadlocks.func2.1.1.1 { c.Lock() } <<<<<
deadlock_test.go:53 go-deadlock.TestNoDeadlocks.func2.1.1 { }() }
deadlock_test.go:54 go-deadlock.TestNoDeadlocks.func2.1 { }() }
deadlock_test.go:55 go-deadlock.TestNoDeadlocks.func2 { }() }
FAIL    github.com/sasha-s/go-deadlock  0.003s
sasha-s commented 7 years ago

Could not reproduce it with go1.9rc1 linux/amd64, Xenial/docker/Mac.

....
2017/08/05 19:15:02 ****************
PASS
ok      github.com/sasha-s/go-deadlock  0.987s

What versions are you using?

sasha-s commented 7 years ago

Added 1.9rc1 to travis-ci. Works. https://travis-ci.org/sasha-s/go-deadlock/jobs/261375190

decathorpe commented 7 years ago

That's strange, because both fedora builds of the package failed on x86_64 (and armhfp) since go was updated to version 1.9beta2.

If it helps, full build logs for the builds with failed tests are available at:

sasha-s commented 7 years ago

It seems the goroutine id detection https://github.com/petermattis/goid is broken in 1.9beta2. I am inclined to wait till 1.9 lands -- maybe it would just work out of the box. Or I'll fix it.

decathorpe commented 7 years ago

I just ran the tests again atop the latest git master of petemattis/goid (which should fix problems with go 1.9), and it works now ... Thanks for pointing me in the right direction, and sorry for the "Issue noise" :+1: