Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
event: fix yet another data race in event monitoring
This is the race I detected locally: ================== WARNING: DATA RACE Write at 0x00c4203cda88 by goroutine 55: github.com/fsouza/go-dockerclient.(*eventMonitoringState).closeListeners() /Users/fsouza/src/github.com/fsouza/go-dockerclient/event.go:150 +0xdc github.com/fsouza/go-dockerclient.(*eventMonitoringState).disableEventMonitoring() /Users/fsouza/src/github.com/fsouza/go-dockerclient/event.go:179 +0x91 github.com/fsouza/go-dockerclient.(*eventMonitoringState).monitorEvents() /Users/fsouza/src/github.com/fsouza/go-dockerclient/event.go:209 +0x23d Previous read at 0x00c4203cda88 by goroutine 58: github.com/fsouza/go-dockerclient.(*Client).RemoveEventListener() /Users/fsouza/src/github.com/fsouza/go-dockerclient/event.go:112 +0xc7 github.com/fsouza/go-dockerclient.testEventListeners.func2() /Users/fsouza/src/github.com/fsouza/go-dockerclient/event_test.go:235 +0x5b github.com/fsouza/go-dockerclient.testEventListeners() /Users/fsouza/src/github.com/fsouza/go-dockerclient/event_test.go:258 +0x191b github.com/fsouza/go-dockerclient.TestTLSEventListeners() /Users/fsouza/src/github.com/fsouza/go-dockerclient/event_test.go:50 +0xa6 testing.tRunner() /Users/fsouza/.gimme/versions/go1.7beta2.darwin.amd64/src/testing/testing.go:610 +0xc9 Goroutine 55 (running) created at: github.com/fsouza/go-dockerclient.(*eventMonitoringState).enableEventMonitoring() /Users/fsouza/src/github.com/fsouza/go-dockerclient/event.go:170 +0x1cf github.com/fsouza/go-dockerclient.(*Client).AddEventListener() /Users/fsouza/src/github.com/fsouza/go-dockerclient/event.go:94 +0x116 github.com/fsouza/go-dockerclient.testEventListeners() /Users/fsouza/src/github.com/fsouza/go-dockerclient/event_test.go:240 +0x16bd github.com/fsouza/go-dockerclient.TestTLSEventListeners() /Users/fsouza/src/github.com/fsouza/go-dockerclient/event_test.go:50 +0xa6 testing.tRunner() /Users/fsouza/.gimme/versions/go1.7beta2.darwin.amd64/src/testing/testing.go:610 +0xc9 Goroutine 58 (running) created at: testing.(*T).Run() /Users/fsouza/.gimme/versions/go1.7beta2.darwin.amd64/src/testing/testing.go:646 +0x52f testing.RunTests.func1() /Users/fsouza/.gimme/versions/go1.7beta2.darwin.amd64/src/testing/testing.go:793 +0xb9 testing.tRunner() /Users/fsouza/.gimme/versions/go1.7beta2.darwin.amd64/src/testing/testing.go:610 +0xc9 testing.RunTests() /Users/fsouza/.gimme/versions/go1.7beta2.darwin.amd64/src/testing/testing.go:799 +0x4b5 testing.(*M).Run() /Users/fsouza/.gimme/versions/go1.7beta2.darwin.amd64/src/testing/testing.go:743 +0x12f main.main() github.com/fsouza/go-dockerclient/_test/_testmain.go:456 +0x1b4 ==================
- Loading branch information