Mrs4s / go-cqhttp

cqhttp的golang实现,轻量、原生跨平台.
GNU Affero General Public License v3.0
10.41k stars 1.63k forks source link

[Bug]: 发送频道消息报错:invalid memory address or nil pointer #2363

Open ConstasJ opened 1 year ago

ConstasJ commented 1 year ago

请确保您已阅读以上注意事项,并勾选下方的确认框。

go-cqhttp 版本

devel(dev分支-5db03c7提交)

运行环境

Linux

运行架构

AMD64

连接方式

WebSocket (正向)

使用协议

1 | Android Phone

重现步骤

  1. 登录一个有QQ频道的QQ账号
  2. 通过WS调用sendGuildMessage
  3. 报错

期望的结果是什么?

应该正常发送消息

实际的结果是什么?

报错: 处置WS命令时发生无法恢复的异常:runtime error: invalid memory address or nil pointer dereference

简单的复现代码/链接(可选)

No response

日志记录(可选)

[2023-08-10 13:07:48] [DEBUG]: WS接收到API调用: send_guild_channel_msg 参数: {"guild_id":"33041391641555788","channel_id":"5489898","message":[{"type":"text","data":{"text":"[生存服 - ConstasJ]\n"}},{"type":"text","data":{"text":"asd"}}]} 
[2023-08-10 13:07:49] [DEBUG]: Protocol -> rev pkt: MsgProxy.SendMsg seq: 2790 
[2023-08-10 13:07:49] [ERROR]: 处置WS命令时发生无法恢复的异常:runtime error: invalid memory address or nil pointer dereference
goroutine 262 [running]:
runtime/debug.Stack()
        runtime/debug/stack.go:24 +0x65
github.com/Mrs4s/go-cqhttp/server.(*wsConn).handleRequest.func1()
        github.com/Mrs4s/go-cqhttp/server/websocket.go:471 +0x46
panic({0xa459a0, 0xf89e60})
        runtime/panic.go:884 +0x213
github.com/Mrs4s/MiraiGo/client.(*GuildService).SendGuildChannelMessage(0xc0003764b0, 0x7562f87badf34c, 0x53c4ea, 0xc0001af9a0)
        github.com/Mrs4s/MiraiGo@v0.0.0-20230801023408-b4cd7e8f2149/client/guild_msg.go:69 +0x47d
github.com/Mrs4s/go-cqhttp/coolq.(*CQBot).SendGuildChannelMessage(0xc0000fc300, 0x2?, 0x62?, 0xc0001af9a0)
        github.com/Mrs4s/go-cqhttp/coolq/bot.go:437 +0x371
github.com/Mrs4s/go-cqhttp/coolq.(*CQBot).CQSendGuildChannelMessage(0xc0000fc300, 0x7562f87badf34c, 0x53c4ea, {0x5, {0xc00016a06d, 0x62}, {0x0, 0x0}, 0x0, 0x6d, ...}, ...)
        github.com/Mrs4s/go-cqhttp/coolq/api.go:826 +0x5ce
github.com/Mrs4s/go-cqhttp/modules/api.(*Caller).call(0xc00006bae0, {0xc00016a00b, 0x16?}, 0xf8bca0, {0xbf3640, 0xc000326dc0})
        github.com/Mrs4s/go-cqhttp/modules/api/api.go:264 +0xadcd
github.com/Mrs4s/go-cqhttp/modules/api.(*Caller).Call(0xc00006bae0, {0xc00016a00b, 0x16}, 0x23?, {0xbf3640, 0xc000326dc0})
        github.com/Mrs4s/go-cqhttp/modules/api/caller.go:35 +0xc5
github.com/Mrs4s/go-cqhttp/server.(*wsConn).handleRequest(0xc0002ae420, 0x0?, {0xc00016a000?, 0x0?, 0xc000312090?})
        github.com/Mrs4s/go-cqhttp/server/websocket.go:480 +0x41c
github.com/Mrs4s/go-cqhttp/server.(*webSocketServer).listenAPI.func2(0xc0003129e0?)
        github.com/Mrs4s/go-cqhttp/server/websocket.go:460 +0x95
created by github.com/Mrs4s/go-cqhttp/server.(*webSocketServer).listenAPI
        github.com/Mrs4s/go-cqhttp/server/websocket.go:458 +0x16a

补充说明(可选)

我严重怀疑是不是因为协议改了……看上去非常像是如此 不过还没有尝试抓包,具体是不是因为协议暗改还不知道

ConstasJ commented 1 year ago

刚打断点调了一下,目前可以确定协议发生变化。 不过具体怎么变的还有待研究

ConstasJ commented 1 year ago

发现该问题可能是因为tx在频道引入某种风控机制(挂上几天之后恢复,然后再次出现) 建议尽快跟进