Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go test race conditions on ./pkg/endpoints #73

Closed
vdemeester opened this issue Apr 24, 2019 · 7 comments
Closed

Go test race conditions on ./pkg/endpoints #73

vdemeester opened this issue Apr 24, 2019 · 7 comments
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@vdemeester
Copy link
Member

There is some data race (caught by go test -race) on ./pkg/endpoints.

  • on TestLogWebsocket
{"level":"info","msg":"Adding API for websocket"}
{"level":"debug","msg":"Upgrading connection to websocket..."}
{"level":"debug","msg":"Upgrading connection to websocket..."}
{"level":"debug","msg":"Upgrading connection to websocket..."}
{"level":"debug","msg":"Upgrading connection to websocket..."}
{"level":"debug","msg":"Upgrading connection to websocket..."}
{"level":"debug","msg":"Upgrading connection to websocket..."}
{"level":"debug","msg":"Upgrading connection to websocket..."}
{"level":"debug","msg":"Upgrading connection to websocket..."}
{"level":"debug","msg":"Upgrading connection to websocket..."}
{"level":"debug","msg":"Upgrading connection to websocket..."}
==================
WARNING: DATA RACE
Read at 0x00c00047aee0 by goroutine 86:
  github.com/tektoncd/dashboard/pkg/websocket.poll()
      /go/src/github.com/tektoncd/dashboard/pkg/websocket/websocket.go:73 +0x1ca

Previous write at 0x00c00047aee0 by goroutine 85:
  github.com/tektoncd/dashboard/pkg/websocket.poll.func1()
      /go/src/github.com/tektoncd/dashboard/pkg/websocket/websocket.go:63 +0x46
  github.com/tektoncd/dashboard/vendor/github.com/gorilla/websocket.(*Conn).advanceFrame()
      /go/src/github.com/tektoncd/dashboard/vendor/github.com/gorilla/websocket/conn.go:892 +0xac3
  github.com/tektoncd/dashboard/vendor/github.com/gorilla/websocket.(*Conn).NextReader()
      /go/src/github.com/tektoncd/dashboard/vendor/github.com/gorilla/websocket/conn.go:947 +0x10a
  github.com/tektoncd/dashboard/vendor/github.com/gorilla/websocket.(*Conn).ReadMessage()
      /go/src/github.com/tektoncd/dashboard/vendor/github.com/gorilla/websocket/conn.go:1028 +0x50
  github.com/tektoncd/dashboard/pkg/websocket.readControl()
      /go/src/github.com/tektoncd/dashboard/pkg/websocket/websocket.go:51 +0x50

Goroutine 86 (running) created at:
  github.com/tektoncd/dashboard/pkg/websocket.WriteOnlyWebsocket()
      /go/src/github.com/tektoncd/dashboard/pkg/websocket/websocket.go:45 +0x99
  github.com/tektoncd/dashboard/pkg/endpoints.Resource.establishPipelineLogsWebsocket()
      /go/src/github.com/tektoncd/dashboard/pkg/endpoints/websocket.go:37 +0xa0
  github.com/tektoncd/dashboard/pkg/endpoints.Resource.establishPipelineLogsWebsocket-fm()
      /go/src/github.com/tektoncd/dashboard/pkg/endpoints/websocket.go:32 +0x70
  github.com/tektoncd/dashboard/vendor/github.com/emicklei/go-restful.(*Container).dispatch()
      /go/src/github.com/tektoncd/dashboard/vendor/github.com/emicklei/go-restful/container.go:288 +0x108a
  github.com/tektoncd/dashboard/vendor/github.com/emicklei/go-restful.(*Container).dispatch-fm()
      /go/src/github.com/tektoncd/dashboard/vendor/github.com/emicklei/go-restful/container.go:203 +0x5f
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/go/src/net/http/server.go:1995 +0x51
  net/http.(*ServeMux).ServeHTTP()
      /usr/local/go/src/net/http/server.go:2375 +0x28a
  github.com/tektoncd/dashboard/vendor/github.com/emicklei/go-restful.(*Container).ServeHTTP()
      /go/src/github.com/tektoncd/dashboard/vendor/github.com/emicklei/go-restful/container.go:303 +0x6e
  net/http.serverHandler.ServeHTTP()
      /usr/local/go/src/net/http/server.go:2774 +0xc4
  net/http.(*conn).serve()
      /usr/local/go/src/net/http/server.go:1878 +0x807

Goroutine 85 (running) created at:
  github.com/tektoncd/dashboard/pkg/websocket.WriteOnlyWebsocket()
      /go/src/github.com/tektoncd/dashboard/pkg/websocket/websocket.go:44 +0x77
  github.com/tektoncd/dashboard/pkg/endpoints.Resource.establishPipelineLogsWebsocket()
      /go/src/github.com/tektoncd/dashboard/pkg/endpoints/websocket.go:37 +0xa0
  github.com/tektoncd/dashboard/pkg/endpoints.Resource.establishPipelineLogsWebsocket-fm()
      /go/src/github.com/tektoncd/dashboard/pkg/endpoints/websocket.go:32 +0x70
  github.com/tektoncd/dashboard/vendor/github.com/emicklei/go-restful.(*Container).dispatch()
      /go/src/github.com/tektoncd/dashboard/vendor/github.com/emicklei/go-restful/container.go:288 +0x108a
  github.com/tektoncd/dashboard/vendor/github.com/emicklei/go-restful.(*Container).dispatch-fm()
      /go/src/github.com/tektoncd/dashboard/vendor/github.com/emicklei/go-restful/container.go:203 +0x5f
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/go/src/net/http/server.go:1995 +0x51
  net/http.(*ServeMux).ServeHTTP()
      /usr/local/go/src/net/http/server.go:2375 +0x28a
  github.com/tektoncd/dashboard/vendor/github.com/emicklei/go-restful.(*Container).ServeHTTP()
      /go/src/github.com/tektoncd/dashboard/vendor/github.com/emicklei/go-restful/container.go:303 +0x6e
  net/http.serverHandler.ServeHTTP()
      /usr/local/go/src/net/http/server.go:2774 +0xc4
  net/http.(*conn).serve()
      /usr/local/go/src/net/http/server.go:1878 +0x807
==================
{"level":"error","msg":"websocket connection to client lost: websocket: close 1005 (no status)"}
==================
WARNING: DATA RACE
Write at 0x00c0000b11c0 by goroutine 88:
  github.com/tektoncd/dashboard/pkg/broadcaster.(*Broadcaster).Unsubscribe()
      /go/src/github.com/tektoncd/dashboard/pkg/broadcaster/broadcaster.go:123 +0xd7
  github.com/tektoncd/dashboard/pkg/websocket.readControl()
      /go/src/github.com/tektoncd/dashboard/pkg/websocket/websocket.go:53 +0x121

Previous read at 0x00c0000b11c0 by goroutine 74:
  github.com/tektoncd/dashboard/pkg/websocket.write()
      /go/src/github.com/tektoncd/dashboard/pkg/broadcaster/broadcaster.go:51 +0x53
  github.com/tektoncd/dashboard/pkg/websocket.WriteOnlyWebsocket()
      /go/src/github.com/tektoncd/dashboard/pkg/websocket/websocket.go:46 +0xb1
  github.com/tektoncd/dashboard/pkg/endpoints.Resource.establishPipelineLogsWebsocket()
      /go/src/github.com/tektoncd/dashboard/pkg/endpoints/websocket.go:37 +0xa0
  github.com/tektoncd/dashboard/pkg/endpoints.Resource.establishPipelineLogsWebsocket-fm()
      /go/src/github.com/tektoncd/dashboard/pkg/endpoints/websocket.go:32 +0x70
  github.com/tektoncd/dashboard/vendor/github.com/emicklei/go-restful.(*Container).dispatch()
      /go/src/github.com/tektoncd/dashboard/vendor/github.com/emicklei/go-restful/container.go:288 +0x108a
  github.com/tektoncd/dashboard/vendor/github.com/emicklei/go-restful.(*Container).dispatch-fm()
      /go/src/github.com/tektoncd/dashboard/vendor/github.com/emicklei/go-restful/container.go:203 +0x5f
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/go/src/net/http/server.go:1995 +0x51
  net/http.(*ServeMux).ServeHTTP()
      /usr/local/go/src/net/http/server.go:2375 +0x28a
  github.com/tektoncd/dashboard/vendor/github.com/emicklei/go-restful.(*Container).ServeHTTP()
      /go/src/github.com/tektoncd/dashboard/vendor/github.com/emicklei/go-restful/container.go:303 +0x6e
  net/http.serverHandler.ServeHTTP()
      /usr/local/go/src/net/http/server.go:2774 +0xc4
  net/http.(*conn).serve()
      /usr/local/go/src/net/http/server.go:1878 +0x807

Goroutine 88 (running) created at:
  github.com/tektoncd/dashboard/pkg/websocket.WriteOnlyWebsocket()
      /go/src/github.com/tektoncd/dashboard/pkg/websocket/websocket.go:44 +0x77
  github.com/tektoncd/dashboard/pkg/endpoints.Resource.establishPipelineLogsWebsocket()
      /go/src/github.com/tektoncd/dashboard/pkg/endpoints/websocket.go:37 +0xa0
  github.com/tektoncd/dashboard/pkg/endpoints.Resource.establishPipelineLogsWebsocket-fm()
      /go/src/github.com/tektoncd/dashboard/pkg/endpoints/websocket.go:32 +0x70
  github.com/tektoncd/dashboard/vendor/github.com/emicklei/go-restful.(*Container).dispatch()
      /go/src/github.com/tektoncd/dashboard/vendor/github.com/emicklei/go-restful/container.go:288 +0x108a
  github.com/tektoncd/dashboard/vendor/github.com/emicklei/go-restful.(*Container).dispatch-fm()
      /go/src/github.com/tektoncd/dashboard/vendor/github.com/emicklei/go-restful/container.go:203 +0x5f
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/go/src/net/http/server.go:1995 +0x51
  net/http.(*ServeMux).ServeHTTP()
      /usr/local/go/src/net/http/server.go:2375 +0x28a
  github.com/tektoncd/dashboard/vendor/github.com/emicklei/go-restful.(*Container).ServeHTTP()
      /go/src/github.com/tektoncd/dashboard/vendor/github.com/emicklei/go-restful/container.go:303 +0x6e
  net/http.serverHandler.ServeHTTP()
      /usr/local/go/src/net/http/server.go:2774 +0xc4
  net/http.(*conn).serve()
      /usr/local/go/src/net/http/server.go:1878 +0x807

Goroutine 74 (running) created at:
  net/http.(*Server).Serve()
      /usr/local/go/src/net/http/server.go:2884 +0x4c4
  net/http/httptest.(*Server).goServe.func1()
      /usr/local/go/src/net/http/httptest/server.go:298 +0xac
==================
{"level":"error","msg":"websocket connection to client lost: websocket: close 1005 (no status)"}
{"level":"error","msg":"websocket connection to client lost: websocket: close 1005 (no status)"}
{"level":"error","msg":"websocket connection to client lost: websocket: close 1005 (no status)"}
{"level":"error","msg":"websocket connection to client lost: websocket: close 1005 (no status)"}
{"level":"error","msg":"websocket connection to client lost: websocket: close 1005 (no status)"}
{"level":"error","msg":"websocket connection to client lost: websocket: close 1005 (no status)"}
{"level":"error","msg":"websocket connection to client lost: websocket: close 1005 (no status)"}
{"level":"error","msg":"websocket connection to client lost: websocket: close 1005 (no status)"}
{"level":"error","msg":"websocket connection to client lost: websocket: close 1005 (no status)"}
websocket_test.go:49: Enter TestLogWebsocket...
websocket_test.go:64: Waiting for clients to terminate...
websocket_test.go:74: Exit TestLogWebsocket
testing.go:809: race detected during execution of test
  • on TestPipelineRunWebsocket
{"level":"info","msg":"Adding API for websocket"}
{"level":"debug","msg":"Into StartPipelineRunController"}
{"level":"info","msg":"PipelineRun Controller Started"}
{"level":"debug","msg":"Upgrading connection to websocket..."}
{"level":"debug","msg":"Upgrading connection to websocket..."}
{"level":"debug","msg":"Upgrading connection to websocket..."}
{"level":"debug","msg":"Upgrading connection to websocket..."}
{"level":"debug","msg":"Upgrading connection to websocket..."}
{"level":"debug","msg":"Upgrading connection to websocket..."}
{"level":"debug","msg":"Upgrading connection to websocket..."}
{"level":"debug","msg":"Upgrading connection to websocket..."}
{"level":"debug","msg":"Upgrading connection to websocket..."}
{"level":"debug","msg":"Upgrading connection to websocket..."}
Creating pipelinerun
{"level":"debug","msg":"In pipelineRunCreated"}
{PipelineRunCreated map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:123456] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
{PipelineRunCreated map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:123456] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
{PipelineRunCreated map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:123456] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
{PipelineRunCreated map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:123456] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
{PipelineRunCreated map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:123456] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
{PipelineRunCreated map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:123456] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
{PipelineRunCreated map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:123456] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
{PipelineRunCreated map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:123456] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
{PipelineRunCreated map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:123456] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
{PipelineRunCreated map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:123456] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
Updating pipelinerun WebsocketPipelinerun
{PipelineRunUpdated map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:654321] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
{PipelineRunUpdated map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:654321] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
{PipelineRunUpdated map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:654321] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
{PipelineRunUpdated map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:654321] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
{PipelineRunUpdated map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:654321] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
{PipelineRunUpdated map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:654321] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
{PipelineRunUpdated map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:654321] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
{PipelineRunUpdated map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:654321] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
{PipelineRunUpdated map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:654321] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
{PipelineRunUpdated map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:654321] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
Deleting pipelinerun: WebsocketPipelinerun
{"level":"debug","msg":"In pipelineRunDeleted"}
{PipelineRunDeleted map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:654321] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
{PipelineRunDeleted map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:654321] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
{PipelineRunDeleted map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:654321] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
{PipelineRunDeleted map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:654321] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
{PipelineRunDeleted map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:654321] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
{PipelineRunDeleted map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:654321] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
{PipelineRunDeleted map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:654321] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
{PipelineRunDeleted map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:654321] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
{PipelineRunDeleted map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:654321] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
{PipelineRunDeleted map[metadata:map[creationTimestamp:<nil> name:WebsocketPipelinerun namespace:ns1 resourceVersion:654321] spec:map[Status: params:<nil> pipelineRef:map[name:] resources:<nil> serviceAccount: trigger:map[type:]] status:map[conditions:<nil>]]}
==================
WARNING: DATA RACE
Read at 0x00000290c598 by goroutine 12:
  github.com/tektoncd/dashboard/pkg/endpoints.TestPipelineRunWebsocket()
      /go/src/github.com/tektoncd/dashboard/pkg/endpoints/websocket_test.go:115 +0x569
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:865 +0x163

Previous write at 0x00000290c598 by goroutine 140:
  github.com/tektoncd/dashboard/pkg/endpoints.clientWebsocket.func1()
      /go/src/github.com/tektoncd/dashboard/pkg/endpoints/websocket_test.go:172 +0x3ff

Goroutine 12 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:916 +0x699
  testing.runTests.func1()
      /usr/local/go/src/testing/testing.go:1157 +0xa8
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:865 +0x163
  testing.runTests()
      /usr/local/go/src/testing/testing.go:1155 +0x523
  testing.(*M).Run()
      /usr/local/go/src/testing/testing.go:1072 +0x2eb
  github.com/tektoncd/dashboard/pkg/endpoints.TestMain()
      /go/src/github.com/tektoncd/dashboard/pkg/endpoints/routes_test.go:82 +0xfba
  main.main()
      _testmain.go:86 +0x222

Goroutine 140 (running) created at:
  github.com/tektoncd/dashboard/pkg/endpoints.clientWebsocket()
      /go/src/github.com/tektoncd/dashboard/pkg/endpoints/websocket_test.go:143 +0x31c
==================
{"level":"error","msg":"websocket connection to client lost: websocket: close 1005 (no status)"}
{"level":"error","msg":"websocket connection to client lost: websocket: close 1005 (no status)"}
{"level":"error","msg":"websocket connection to client lost: websocket: close 1005 (no status)"}
{"level":"error","msg":"websocket connection to client lost: websocket: close 1005 (no status)"}
{"level":"error","msg":"websocket connection to client lost: websocket: close 1005 (no status)"}
{"level":"error","msg":"websocket connection to client lost: websocket: close 1005 (no status)"}
{"level":"error","msg":"websocket connection to client lost: websocket: close 1005 (no status)"}
{"level":"error","msg":"websocket connection to client lost: websocket: close 1005 (no status)"}
{"level":"error","msg":"websocket connection to client lost: websocket: close 1005 (no status)"}
{"level":"error","msg":"websocket connection to client lost: websocket: close 1005 (no status)"}
websocket_test.go:79: Enter TestPipelineRunWebsocket...
websocket_test.go:117: Waiting for clients to terminate...
websocket_test.go:127: Exit TestPipelineRunWebsocket
testing.go:809: race detected during execution of test

I disabled race detection on the CI for now (to bootstrap it), but this need to be fixed (so that we can re-enable race detections 👼 )

cc @a-roberts

See https://tekton-releases.appspot.com/build/tekton-prow/pr-logs/pull/tektoncd_dashboard/72/pull-tekton-dashboard-tests/1120985522127245312/

@mnuttall mnuttall added the kind/bug Categorizes issue or PR as related to a bug. label Apr 24, 2019
@a-roberts a-roberts self-assigned this Apr 24, 2019
@a-roberts
Copy link
Member

a-roberts commented Apr 24, 2019

I'll take a look at this.

https://github.com/tektoncd/dashboard/blob/master/test/presubmit-tests.sh#L132 will need to be changed once resolved, and the reproduce is noddy, just clone this:

dep ensure -v, go test -race -v ./pkg/...

So surely there's a read on the socket at the same time as we write, here's a snippet from my stacktrace for the first problem:

==================
WARNING: DATA RACE
Read at 0x00c00047e050 by goroutine 103:
  github.com/dashboard/vendor/github.com/tektoncd/dashboard/pkg/websocket.poll()
      /Users/aroberts/go/src/github.com/dashboard/vendor/github.com/tektoncd/dashboard/pkg/websocket/websocket.go:73 +0x1ca

Previous write at 0x00c00047e050 by goroutine 99:
  github.com/dashboard/vendor/github.com/tektoncd/dashboard/pkg/websocket.poll.func1()
      /Users/aroberts/go/src/github.com/dashboard/vendor/github.com/tektoncd/dashboard/pkg/websocket/websocket.go:63 +0x46
  github.com/dashboard/vendor/github.com/gorilla/websocket.(*Conn).advanceFrame()
      /Users/aroberts/go/src/github.com/dashboard/vendor/github.com/gorilla/websocket/conn.go:892 +0xb1c
  github.com/dashboard/vendor/github.com/gorilla/websocket.(*Conn).NextReader()
      /Users/aroberts/go/src/github.com/dashboard/vendor/github.com/gorilla/websocket/conn.go:947 +0x10d
  github.com/dashboard/vendor/github.com/gorilla/websocket.(*Conn).ReadMessage()
      /Users/aroberts/go/src/github.com/dashboard/vendor/github.com/gorilla/websocket/conn.go:1028 +0x3f
  github.com/dashboard/vendor/github.com/tektoncd/dashboard/pkg/websocket.readControl()
      /Users/aroberts/go/src/github.com/dashboard/vendor/github.com/tektoncd/dashboard/pkg/websocket/websocket.go:51 +0x3c

Goroutine 103 (running) created at:
  github.com/dashboard/vendor/github.com/tektoncd/dashboard/pkg/websocket.WriteOnlyWebsocket()
      /Users/aroberts/go/src/github.com/dashboard/vendor/github.com/tektoncd/dashboard/pkg/websocket/websocket.go:45 +0x99
  github.com/dashboard/pkg/endpoints.Resource.establishPipelineLogsWebsocket()
      /Users/aroberts/go/src/github.com/dashboard/pkg/endpoints/websocket.go:37 +0xf8
  github.com/dashboard/pkg/endpoints.Resource.establishPipelineLogsWebsocket-fm()
      /Users/aroberts/go/src/github.com/dashboard/pkg/endpoints/router.go:73 +0x76
  github.com/dashboard/vendor/github.com/emicklei/go-restful.(*Container).dispatch()
      /Users/aroberts/go/src/github.com/dashboard/vendor/github.com/emicklei/go-restful/container.go:288 +0x10d3
  github.com/dashboard/vendor/github.com/emicklei/go-restful.(*Container).dispatch-fm()
      /Users/aroberts/go/src/github.com/dashboard/vendor/github.com/emicklei/go-restful/container.go:120 +0x5f
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/go/src/net/http/server.go:1964 +0x51
  net/http.(*ServeMux).ServeHTTP()
      /usr/local/go/src/net/http/server.go:2361 +0x191
  github.com/dashboard/vendor/github.com/emicklei/go-restful.(*Container).ServeHTTP()
      /Users/aroberts/go/src/github.com/dashboard/vendor/github.com/emicklei/go-restful/container.go:303 +0x6e
  net/http.serverHandler.ServeHTTP()
      /usr/local/go/src/net/http/server.go:2741 +0xc4
  net/http.(*conn).serve()
      /usr/local/go/src/net/http/server.go:1847 +0x80a

Goroutine 99 (running) created at:
  github.com/dashboard/vendor/github.com/tektoncd/dashboard/pkg/websocket.WriteOnlyWebsocket()
      /Users/aroberts/go/src/github.com/dashboard/vendor/github.com/tektoncd/dashboard/pkg/websocket/websocket.go:44 +0x77
  github.com/dashboard/pkg/endpoints.Resource.establishPipelineLogsWebsocket()
      /Users/aroberts/go/src/github.com/dashboard/pkg/endpoints/websocket.go:37 +0xf8
  github.com/dashboard/pkg/endpoints.Resource.establishPipelineLogsWebsocket-fm()
      /Users/aroberts/go/src/github.com/dashboard/pkg/endpoints/router.go:73 +0x76
  github.com/dashboard/vendor/github.com/emicklei/go-restful.(*Container).dispatch()
      /Users/aroberts/go/src/github.com/dashboard/vendor/github.com/emicklei/go-restful/container.go:288 +0x10d3
  github.com/dashboard/vendor/github.com/emicklei/go-restful.(*Container).dispatch-fm()
      /Users/aroberts/go/src/github.com/dashboard/vendor/github.com/emicklei/go-restful/container.go:120 +0x5f
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/go/src/net/http/server.go:1964 +0x51
  net/http.(*ServeMux).ServeHTTP()
      /usr/local/go/src/net/http/server.go:2361 +0x191
  github.com/dashboard/vendor/github.com/emicklei/go-restful.(*Container).ServeHTTP()
      /Users/aroberts/go/src/github.com/dashboard/vendor/github.com/emicklei/go-restful/container.go:303 +0x6e
  net/http.serverHandler.ServeHTTP()
      /usr/local/go/src/net/http/server.go:2741 +0xc4
  net/http.(*conn).serve()
      /usr/local/go/src/net/http/server.go:1847 +0x80a
==================

@a-roberts
Copy link
Member

Let's see if I can assign OK now, Vincent wrote most of this code so we're going to buddy up (and if it doesn't work I get to search the repos for me saying this and retrospectively assign him)

/assign @vtereso

@tekton-robot
Copy link
Contributor

@a-roberts: GitHub didn't allow me to assign the following users: vtereso.

Note that only tektoncd members and repo collaborators can be assigned.
For more information please see the contributor guide

In response to this:

Let's see if I can assign OK now, Vincent wrote most of this code so we're going to buddy up (and if it doesn't work I get to search the repos for me saying this and retrospectively assign him)

/assign @vtereso

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@a-roberts
Copy link
Member

/assign vtereso

@a-roberts
Copy link
Member

@vtereso produced a fix for this y'day and I've tidied things up, added more comments, merged with master and resolved an import problem. I've also added the -race check back in.

https://github.com/tektoncd/dashboard/compare/master...a-roberts:websocketRacev2?expand=1 here's the code on my branch and here's the original: https://github.com/vtereso/dashboard/tree/websocketRace.

I'm going to wait until Vincent is back online and then he can replace the contents of his branch with mine, squash commits and get the PR in so he can get the credit. Thanks @vtereso!

@vtereso vtereso mentioned this issue Apr 26, 2019
@vdemeester
Copy link
Member Author

#94 is in, we can close this one !
/close

@tekton-robot
Copy link
Contributor

@vdemeester: Closing this issue.

In response to this:

#94 is in, we can close this one !
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

5 participants