Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bugfix(client): Fix the panic due to concurrent writing (#180)
The bug: panic: concurrent write to websocket connection goroutine 66624 [running]: github.com/gorilla/websocket.(*messageWriter).flushFrame(0xc001ad7ef0, 0x1, {0x0?, 0x0?, 0x0?}) /home/streampanel/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:617 +0x4b8 github.com/gorilla/websocket.(*messageWriter).Close(0xc001e12f60?) /home/streampanel/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:731 +0x35 github.com/gorilla/websocket.(*Conn).beginMessage(0xc001e034a0, 0xc001e12f60, 0x8) /home/streampanel/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:480 +0x3a github.com/gorilla/websocket.(*Conn).NextWriter(0xc001e034a0, 0x8) /home/streampanel/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:520 +0x3f github.com/gorilla/websocket.(*Conn).WriteMessage(0x37d2cb0?, 0x1e5f71c?, {0xc000945490, 0x5, 0x5}) /home/streampanel/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:773 +0x137 github.com/andreykaipov/goobs.(*Client).Disconnect(0xc001c26fc0) /home/streampanel/go/pkg/mod/github.com/xaionaro-go/[email protected]/client.go:123 +0xe5 The documentation of github.com/gorilla/websocket explicitly forbids concurrent writing and reading. See section "Concurrency" in: https://pkg.go.dev/github.com/gorilla/websocket#hdr-Concurrency
- Loading branch information