github.com/juju/juju/apiserver/logsink_test.(*logsinkSuite).SetUpTest has a Data Race in develop:
http://10.125.0.203:8080/job/RunUnittests-race-amd64/182/testReport/junit/github/com_juju_juju_apiserver_logsink/TestPackage/
WARNING: DATA RACE
Write at 0x00c4200d0210 by goroutine 70:
github.com/juju/juju/apiserver/logsink_test.(*logsinkSuite).SetUpTest.func1()
/workspace/src/github.com/juju/juju/apiserver/logsink/logsink_test.go:68 +0xc1
github.com/juju/juju/apiserver/logsink_test.(*mockLogWriteCloser).Close()
/workspace/src/github.com/juju/juju/apiserver/logsink/logsink_test.go:265 +0x129
github.com/juju/juju/apiserver/logsink.(*logSinkHandler).ServeHTTP.func1()
/workspace/src/github.com/juju/juju/apiserver/logsink/logsink.go:163 +0x5c3
github.com/juju/juju/apiserver/websocket.Serve()
/workspace/src/github.com/juju/juju/apiserver/websocket/websocket.go:64 +0x1b1
github.com/juju/juju/apiserver/logsink.(*logSinkHandler).ServeHTTP()
/workspace/src/github.com/juju/juju/apiserver/logsink/logsink.go:168 +0xba
net/http.serverHandler.ServeHTTP()
/snap/go/1404/src/net/http/server.go:2619 +0xbc
net/http.(*conn).serve()
/snap/go/1404/src/net/http/server.go:1801 +0x83b
Previous write at 0x00c4200d0210 by goroutine 75:
github.com/juju/juju/apiserver/logsink_test.(*logsinkSuite).SetUpTest()
/workspace/src/github.com/juju/juju/apiserver/logsink/logsink_test.go:63 +0x165
runtime.call32()
/snap/go/1404/src/runtime/asm_amd64.s:509 +0x3a
reflect.Value.Call()
/snap/go/1404/src/reflect/value.go:302 +0xc0
gopkg.in/check%2ev1.(*suiteRunner).runFixture.func1()
/workspace/src/gopkg.in/check.v1/check.go:721 +0x184
gopkg.in/check%2ev1.(*suiteRunner).forkCall.func1()
/workspace/src/gopkg.in/check.v1/check.go:666 +0x89
Goroutine 70 (running) created at:
net/http.(*Server).Serve()
/snap/go/1404/src/net/http/server.go:2720 +0x37c
net/http/httptest.(*Server).goServe.func1()
/snap/go/1404/src/net/http/httptest/server.go:280 +0xa2
Goroutine 75 (finished) created at:
gopkg.in/check%2ev1.(*suiteRunner).forkCall()
/workspace/src/gopkg.in/check.v1/check.go:663 +0x430
gopkg.in/check%2ev1.(*suiteRunner).runFunc()
/workspace/src/gopkg.in/check.v1/check.go:673 +0x7e
gopkg.in/check%2ev1.(*suiteRunner).runFixture()
/workspace/src/gopkg.in/check.v1/check.go:717 +0x7e
gopkg.in/check%2ev1.(*suiteRunner).runFixtureWithPanic()
/workspace/src/gopkg.in/check.v1/check.go:735 +0xaa
gopkg.in/check%2ev1.(*suiteRunner).forkTest.func1()
/workspace/src/gopkg.in/check.v1/check.go:760 +0x217
gopkg.in/check%2ev1.(*suiteRunner).forkCall.func1()
/workspace/src/gopkg.in/check.v1/check.go:666 +0x89
==================
OK: 6 passed
testing.go:699: race detected during execution of test
SetUpTest first initializes the lastStack to nil, but wasn't doing so using logsink/ logsink_ test.go logsink/ logsink_ test.go
s.stub. ResetCalls( )
the stackMu. This should be a reasonable fix:
--- a/apiserver/
+++ b/apiserver/
@@ -60,7 +60,9 @@ func (s *logsinkSuite) SetUpTest(c *gc.C) {
s.abort = make(chan struct{})
s.written = make(chan params.LogRecord, 1)
+ s.stackMu.Lock()
s.lastStack = nil
+ s.stackMu.Unlock()
recordStack := func() {
s.stackMu. Lock()
On Wed, Mar 14, 2018 at 4:11 PM, John A Meinel <email address hidden>
wrote:
> Public bug reported: com/juju/ juju/apiserver/ logsink_ test.(* logsinkSuite) .SetUpTest has 10.125. 0.203:8080/ job/RunUnittest s-race- amd64/182/ junit/github/ com_juju_ juju_apiserver_ logsink/ TestPackage/ com/juju/ juju/apiserver/ logsink_ test.(* .SetUpTest. func1() src/github. com/juju/ juju/apiserver/ logsink/ com/juju/ juju/apiserver/ logsink_ test.(* ser).Close( ) src/github. com/juju/ juju/apiserver/ logsink/ com/juju/ juju/apiserver/ logsink. (*logSinkHandle r).ServeHTTP. src/github. com/juju/ juju/apiserver/ logsink/ logsink. go:163 com/juju/ juju/apiserver/ websocket. Serve() src/github. com/juju/ juju/apiserver/ websocket/ com/juju/ juju/apiserver/ logsink. (*logSinkHandle r).ServeHTTP( ) src/github. com/juju/ juju/apiserver/ logsink/ logsink. go:168 serverHandler. ServeHTTP( ) 1404/src/ net/http/ server. go:2619 +0xbc (*conn) .serve( ) 1404/src/ net/http/ server. go:1801 +0x83b com/juju/ juju/apiserver/ logsink_ test.(* logsinkSuite) .SetUpTest( ) src/github. com/juju/ juju/apiserver/ logsink/ 1404/src/ runtime/ asm_amd64. s:509 +0x3a Value.Call( ) 1404/src/ reflect/ value.go: 302 +0xc0 check%2ev1. (*suiteRunner) .runFixture. func1() src/gopkg. in/check. v1/check. go:721 +0x184 check%2ev1. (*suiteRunner) .forkCall. func1() src/gopkg. in/check. v1/check. go:666 +0x89 (*Server) .Serve( ) 1404/src/ net/http/ server. go:2720 +0x37c httptest. (*Server) .goServe. func1() 1404/src/ net/http/ httptest/ server. go:280 +0xa2 check%2ev1. (*suiteRunner) .forkCall( ) src/gopkg. in/check. v1/check. go:663 +0x430 check%2ev1. (*suiteRunner) .runFunc( ) src/gopkg. in/check. v1/check. go:673 +0x7e check%2ev1. (*suiteRunner) .runFixture( ) src/gopkg. in/check. v1/check. go:717 +0x7e check%2ev1. (*suiteRunner) .runFixtureW. ..
>
> github.
> a Data Race in develop:
> http://
> testReport/
>
> WARNING: DATA RACE
> Write at 0x00c4200d0210 by goroutine 70:
> github.
> logsinkSuite)
> /workspace/
> logsink_test.go:68 +0xc1
> github.
> mockLogWriteClo
> /workspace/
> logsink_test.go:265 +0x129
> github.
> func1()
> /workspace/
> +0x5c3
> github.
> /workspace/
> websocket.go:64 +0x1b1
> github.
> /workspace/
> +0xba
> net/http.
> /snap/go/
> net/http.
> /snap/go/
>
> Previous write at 0x00c4200d0210 by goroutine 75:
> github.
> /workspace/
> logsink_test.go:63 +0x165
> runtime.call32()
> /snap/go/
> reflect.
> /snap/go/
> gopkg.in/
> /workspace/
> gopkg.in/
> /workspace/
>
> Goroutine 70 (running) created at:
> net/http.
> /snap/go/
> net/http/
> /snap/go/
>
> Goroutine 75 (finished) created at:
> gopkg.in/
> /workspace/
> gopkg.in/
> /workspace/
> gopkg.in/
> /workspace/
> gopkg.in/