[BUG] Concurrent write of websocket causes msg-gateway gateway panic
OpenIM Server Version
3.8.2-3.8.4都有
Operating System and CPU Architecture
Linux (AMD)
Deployment Method
Source Code Deployment
Bug Description and Steps to Reproduce
我搜到仓库里面之前有一个同样的issue并且fix掉了, 当时是由于漏加了一个锁导致, 但是我现在的源码是3.8.2, 我查了一下, 是有加那个锁的, 所以那个fix不能完全起作用, 应该还有哪些地方可能导致并发写同一个websocket的连接
panic: concurrent write to websocket connection goroutine 515 [running]: github.com/gorilla/websocket.(*messageWriter).flushFrame(0xc00eb35c70, 0x1, {0xc00d5083c9?, 0x0?, 0x0?}) /root/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:632 +0x4b8 github.com/gorilla/websocket.(*Conn).WriteMessage(0xc002386160, 0xc00eb35cd8?, {0xc00d508200, 0x1c9, 0x200}) /root/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:785 +0x126 github.com/openimsdk/open-im-server/v3/internal/msggateway.(*GWebSocket).WriteMessage(0xc0073a8180?, 0xc0013fe2c0?, {0xc00d508200?, 0xc00eb35d30?, 0x4a7c10?}) /repo/open-im-server/internal/msggateway/long_conn.go:88 +0x1c github.com/openimsdk/open-im-server/v3/internal/msggateway.(*Client).writeBinaryMsg(0xc014160410, {0x7d1, {0x0, 0x0}, {0xc014730720, 0x22}, 0x0, {0x0, 0x0}, {0xc009d14240, ...}}) /repo/open-im-server/internal/msggateway/client.go:369 +0x18e github.com/openimsdk/open-im-server/v3/internal/msggateway.(*Client).PushMessage(0xc014160410, {0x19176d8, 0xc018a03ec0}, 0xc003c91080) /repo/open-im-server/internal/msggateway/client.go:325 +0x36b github.com/openimsdk/open-im-server/v3/internal/msggateway.(*Server).pushToUser(0xc0012bcf30, {0x19176d8, 0xc018a03ec0}, {0xc004a05698, 0x14}, 0xc003c91080) /repo/open-im-server/internal/msggateway/hub_server.go:150 +0x3b0 github.com/openimsdk/open-im-server/v3/internal/msggateway.(*Server).SuperGroupOnlineBatchPushOneMsg.func1() /repo/open-im-server/internal/msggateway/hub_server.go:177 +0x45 github.com/openimsdk/tools/mq/memamq.(*MemoryQueue).initialize.func1() /root/go/pkg/mod/github.com/openimsdk/[email protected]/mq/memamq/queue.go:54 +0x75 created by github.com/openimsdk/tools/mq/memamq.(*MemoryQueue).initialize in goroutine 1 /root/go/pkg/mod/github.com/openimsdk/[email protected]/mq/memamq/queue.go:51 +0x65
Screenshots Link
No response
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
OpenIM Server Version
All 3.8.2-3.8.4
Operating System and CPU Architecture
Linux (AMD)
Deployment Method
Source Code Deployment
Bug Description and Steps to Reproduce
I found that there was the same issue in the warehouse and the fix dropped. It was caused by a lock being added, but my current source code is 3.8.2. I checked it and it was added, so that one. Fix does not work completely. What else should be possible to concurrently write connections to the same websocket
panic: concurrent write to websocket connection goroutine 515 [running]: github.com/gorilla/websocket.(*messageWriter).flushFrame(0xc00eb35c70, 0x1, {0xc00d5083c9?, 0x0?, 0x0?}) /root/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:632 +0x4b8 github.com/gorilla/websocket.(*Conn).WriteMessage(0xc002386160, 0xc00eb35cd8?, {0xc00d508200, 0x1c9, 0x200}) /root/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:785 +0x126 github.com/openimsdk/open-im-server/v3/internal/msggateway.(*GWebSocket).WriteMessage(0xc0073a8180?, 0xc0013fe2c0?, {0xc00d508200?, 0xc00eb35d30?, 0x4a7c10?}) /repo/open-im-server/internal/msggateway/long_conn.go:88 +0x1c github.com/openimsdk/open-im-server/v3/internal/msggateway.(*Client).writeBinaryMsg(0xc014160410, {0x7d1, {0x0, 0x0}, {0xc014730720, 0x22}, 0x0, {0x0, 0x0}, {0xc009d14240, ...}}) /repo/open-im-server/internal/msggateway/client.go:369 +0x18e github.com/openimsdk/open-im-server/v3/internal/msggateway.(*Client).PushMessage(0xc014160410, {0x19176d8, 0xc018a03ec0}, 0xc003c91080) /repo/open-im-server/internal/msggateway/client.go:325 +0x36b github.com/openimsdk/open-im-server/v3/internal/msggateway.(*Server).pushToUser(0xc0012bcf30, {0x19176d8, 0xc018a03ec0}, {0xc004a05698, 0x14}, 0xc003c91080) /repo/open-im-server/internal/msggateway/hub_server.go:150 +0x3b0 github.com/openimsdk/open-im-server/v3/internal/msggateway.(*Server).SuperGroupOnlineBatchPushOneMsg.func1() /repo/open-im-server/internal/msggateway/hub_server.go:177 +0x45 github.com/openimsdk/tools/mq/memamq.(*MemoryQueue).initialize.func1() /root/go/pkg/mod/github.com/openimsdk/[email protected]/mq/memamq/queue.go:54 +0x75 created by github.com/openimsdk/tools/mq/memamq.(*MemoryQueue).initialize in goroutine 1 /root/go/pkg/mod/github.com/openimsdk/[email protected]/mq/memamq/queue.go:51 +0x65
Screenshots Link
No response