Closed aynakeya closed 4 months ago
race condition.
panic: concurrent write to websocket connection
Two goroutines are simultaneously writing messages: one from heartBeatLoop and the other from wsLoop during reconnection.
heartBeatLoop
wsLoop
trackback
panic: concurrent write to websocket connection goroutine 179 [running]: github.com/gorilla/websocket.(*messageWriter).flushFrame(0xc005ddec90, 0x1, {0x0?, 0x0?, 0x0?}) C:/Users/vboxuser/go/pkg/mod/github.com/gorilla/websocket@v1.5.0/conn.go:617 +0x4b8 github.com/gorilla/websocket.(*messageWriter).Close(0xc0090494a0?) C:/Users/vboxuser/go/pkg/mod/github.com/gorilla/websocket@v1.5.0/conn.go:731 +0x35 github.com/gorilla/websocket.(*Conn).beginMessage(0xc00741e580, 0xc0090494a0, 0x2) C:/Users/vboxuser/go/pkg/mod/github.com/gorilla/websocket@v1.5.0/conn.go:480 +0x3a github.com/gorilla/websocket.(*Conn).NextWriter(0xc00741e580, 0x2) C:/Users/vboxuser/go/pkg/mod/github.com/gorilla/websocket@v1.5.0/conn.go:520 +0x3f github.com/gorilla/websocket.(*Conn).WriteMessage(0x20c2e75b?, 0x0?, {0xc00aed83c0, 0x125, 0x140}) C:/Users/vboxuser/go/pkg/mod/github.com/gorilla/websocket@v1.5.0/conn.go:773 +0x137 github.com/AynaLivePlayer/blivedm-go/client.(*Client).sendEnterPacket(0xc0001b42c0) C:/Users/vboxuser/go/pkg/mod/github.com/!ayna!live!player/blivedm-go@v0.0.0-20240408074929-6565ab41764b/client/client.go:195 +0x55 github.com/AynaLivePlayer/blivedm-go/client.(*Client).connect(0xc0001b42c0) C:/Users/vboxuser/go/pkg/mod/github.com/!ayna!live!player/blivedm-go@v0.0.0-20240408074929-6565ab41764b/client/client.go:118 +0x2cf github.com/AynaLivePlayer/blivedm-go/client.(*Client).wsLoop(0xc0001b42c0) C:/Users/vboxuser/go/pkg/mod/github.com/!ayna!live!player/blivedm-go@v0.0.0-20240408074929-6565ab41764b/client/client.go:137 +0x1d2 created by github.com/AynaLivePlayer/blivedm-go/client.(*Client).Start in goroutine 51 C:/Users/vboxuser/go/pkg/mod/github.com/!ayna!live!player/blivedm-go@v0.0.0-20240408074929-6565ab41764b/client/client.go:174 +0x78
race condition.
panic: concurrent write to websocket connection
Two goroutines are simultaneously writing messages: one from
heartBeatLoop
and the other fromwsLoop
during reconnection.trackback