Mrs4s / go-cqhttp

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

[Bug]: 连续多次发送合并图片消息后主进程停止 #1563

Open RShock opened 2 years ago

RShock commented 2 years ago

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

go-cqhttp 版本

v1.0.0-rc1

运行环境

Ubuntu

运行架构

x86

连接方式

WebSocket (反向)

使用协议

0 | iPad

重现步骤

短期内大量发送合并的图片消息(每个消息最多有20张图片)后,进程停止

期望的结果是什么?

正常发送

实际的结果是什么?

进程停止

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

No response

日志记录(可选)

`
[2022-06-29 23:09:04] [INFO]: 收到群 b站一浪y游戏王md交流4(734292824) 内 THF(3156364160) 的消息: ygo 12 (-975681943)
[2022-06-29 23:09:16] [INFO]: 收到群 b站一浪y游戏王md交流4(734292824) 内 THF(3156364160) 的消息: ygo 十二 (750510940)
panic: id (1) <= evictCount (2)

goroutine 687 [running]:
vendor/golang.org/x/net/http2/hpack.(*headerFieldTable).idToIndex(0xc0006b7b00, 0xc0002079e0)
        vendor/golang.org/x/net/http2/hpack/tables.go:119 +0xd9
vendor/golang.org/x/net/http2/hpack.(*headerFieldTable).search(0xc0006b7b00, {{0xb83cc9, 0xa}, {0xc0002800cb, 0x14}, 0x0})
        vendor/golang.org/x/net/http2/hpack/tables.go:106 +0xe5
vendor/golang.org/x/net/http2/hpack.(*Encoder).searchTable(0xc0006b7b00, {{0xb83cc9, 0xa}, {0xc0002800cb, 0x14}, 0x0})
        vendor/golang.org/x/net/http2/hpack/encode.go:97 +0x88
vendor/golang.org/x/net/http2/hpack.(*Encoder).WriteField(0xc0006b7b00, {{0xb83cc9, 0xa}, {0xc0002800cb, 0x14}, 0x0})
        vendor/golang.org/x/net/http2/hpack/encode.go:62 +0x14a
net/http.(*http2ClientConn).writeHeader(0xb83cc9, {0xb83cc9, 0xc000494968}, {0xc0002800cb, 0x197})
        net/http/h2_bundle.go:8470 +0x149
net/http.(*http2ClientConn).encodeHeaders.func3({0xb83cc9, 0x0}, {0xc0002800cb, 0x18})
        net/http/h2_bundle.go:8404 +0x72
net/http.(*http2ClientConn).encodeHeaders.func1(0xc000494b78)
        net/http/h2_bundle.go:8296 +0x97
net/http.(*http2ClientConn).encodeHeaders(0xc00006ef00, 0xc000243a00, 0x1, {0x0, 0x0}, 0x0)
        net/http/h2_bundle.go:8397 +0x67e
net/http.(*http2clientStream).encodeAndWriteHeaders(0xc0005b6600, 0xc000243a00)
        net/http/h2_bundle.go:7913 +0x30e
net/http.(*http2clientStream).writeRequest(0xc0005b6600, 0xc000243a00)
        net/http/h2_bundle.go:7809 +0x4c9
net/http.(*http2clientStream).doRequest(0x906bed, 0xc000444380)
        net/http/h2_bundle.go:7727 +0x1e
created by net/http.(*http2ClientConn).RoundTrip
        net/http/h2_bundle.go:7656 +0x30f
`

补充说明(可选)

No response

Mrs4s commented 2 years ago

看上去好像是标准库的问题 -> https://github.com/golang/go/issues/43051 我们这边尽量修修

Mrs4s commented 2 years ago

请问发送的图片链接具体是什么, 有没有复现方法

RShock commented 2 years ago

请问发送的图片链接具体是什么, 有没有复现方法

我使用的是 真寻机器人游戏王卡查 插件, 插件返回配置被我设为了20

这个插件的原版在nonebot2里 通过群友高频查询类似 战士/十二/英雄 等会返回20张左右查询结果的词后gocq崩溃,可以复现崩溃

wdvxdr1123 commented 2 years ago

rc1使用go1.17编译, 从issue里看,go团队在1.18开发周期中尝试过修复,请更新到rc3版本(使用go1.18编译)看看是否还有bug。

icarus-ai commented 2 years ago

rc1使用go1.17编译, 从issue里看,go团队在1.18开发周期中尝试过修复,请更新到rc3版本(使用go1.18编译)看看是否还有bug。

有没有可能是x/net 用的2021的某版? golang.org/x/net v0.0.0-20220630215102-69896b714898

wdvxdr1123 commented 2 years ago

@icarus-ai 标准库使用vendor后的net库,与go.mod无关

RShock commented 2 years ago

我现在遇到一个问题,在升级rc3之前,我想先自己再次复现这个BUG。 之前放在群里时,群友只需要10次左右的查询就能快速把进程搞挂(总共2次),导致我错误估计了难度。。通过加循环等方式以更快的速度发图都没有办法复现这个BUG。感觉我自己一个人没办法复现。 我现在把机器人重新丢到了游戏王群里面,希望他们能复现这个BUG,但是他们之前已经玩过这个功能了,现在没兴趣高频触发。。。所以我的验证估计还得等很久 另一次日志也被我抓出来了

panic: id (154) <= evictCount (161)

goroutine 556773 [running]:
vendor/golang.org/x/net/http2/hpack.(*headerFieldTable).idToIndex(0xc000657b80, 0xc001183bf0)
    vendor/golang.org/x/net/http2/hpack/tables.go:119 +0xd9
vendor/golang.org/x/net/http2/hpack.(*headerFieldTable).search(0xc000657b80, {{0xb83cc9, 0xa}, {0xc0006770cb, 0x14}, 0x0})
    vendor/golang.org/x/net/http2/hpack/tables.go:106 +0xe5
vendor/golang.org/x/net/http2/hpack.(*Encoder).searchTable(0xc000657b80, {{0xb83cc9, 0xa}, {0xc0006770cb, 0x14}, 0x0})
    vendor/golang.org/x/net/http2/hpack/encode.go:97 +0x88
vendor/golang.org/x/net/http2/hpack.(*Encoder).WriteField(0xc000657b80, {{0xb83cc9, 0xa}, {0xc0006770cb, 0x14}, 0x0})
    vendor/golang.org/x/net/http2/hpack/encode.go:62 +0x14a
net/http.(*http2ClientConn).writeHeader(0xb83cc9, {0xb83cc9, 0x0}, {0xc0006770cb, 0x0})
    net/http/h2_bundle.go:8470 +0x149
net/http.(*http2ClientConn).encodeHeaders.func3({0xb83cc9, 0x0}, {0xc0006770cb, 0x18})
    net/http/h2_bundle.go:8404 +0x72
net/http.(*http2ClientConn).encodeHeaders.func1(0xc000932b78)
    net/http/h2_bundle.go:8296 +0x97
net/http.(*http2ClientConn).encodeHeaders(0xc00006fb00, 0xc000123d00, 0x1, {0x0, 0x0}, 0x0)
    net/http/h2_bundle.go:8397 +0x67e
net/http.(*http2clientStream).encodeAndWriteHeaders(0xc000b4c780, 0xc000123d00)
    net/http/h2_bundle.go:7913 +0x30e
net/http.(*http2clientStream).writeRequest(0xc000b4c780, 0xc000123d00)
    net/http/h2_bundle.go:7809 +0x4c9
net/http.(*http2clientStream).doRequest(0x906bed, 0xc0009cdf88)
    net/http/h2_bundle.go:7727 +0x1e
created by net/http.(*http2ClientConn).RoundTrip
    net/http/h2_bundle.go:7656 +0x30f
CrazyBoyM commented 1 year ago
panic: id (41) <= evictCount (43)

goroutine 44862 [running]:
vendor/golang.org/x/net/http2/hpack.(*headerFieldTable).idToIndex(0xc000551800, 0xc001f3a660?)
    vendor/golang.org/x/net/http2/hpack/tables.go:119 +0xce
vendor/golang.org/x/net/http2/hpack.(*headerFieldTable).search(0xc000551800, {{0xaba15c, 0xa}, {0xc00118de4b, 0x10}, 0x0})
    vendor/golang.org/x/net/http2/hpack/tables.go:106 +0xe5
vendor/golang.org/x/net/http2/hpack.(*Encoder).searchTable(0xc000551800, {{0xaba15c, 0xa}, {0xc00118de4b, 0x10}, 0x0})
    vendor/golang.org/x/net/http2/hpack/encode.go:97 +0x88
vendor/golang.org/x/net/http2/hpack.(*Encoder).WriteField(0xc000551800, {{0xaba15c, 0xa}, {0xc00118de4b, 0x10}, 0x0})
    vendor/golang.org/x/net/http2/hpack/encode.go:62 +0x14a
net/http.(*http2ClientConn).writeHeader(0xaba15c?, {0xaba15c?, 0x49?}, {0xc00118de4b?, 0x6?})
    net/http/h2_bundle.go:8650 +0x12b
net/http.(*http2ClientConn).encodeHeaders.func3({0xaba15c?, 0x0?}, {0xc00118de4b, 0x10})
    net/http/h2_bundle.go:8584 +0x72
net/http.(*http2ClientConn).encodeHeaders.func1(0xc0005d5b60)
    net/http/h2_bundle.go:8476 +0x97
net/http.(*http2ClientConn).encodeHeaders(0xc00292cd80, 0xc002413100, 0x1, {0x0, 0x0}, 0x0)
    net/http/h2_bundle.go:8577 +0x61e
net/http.(*http2clientStream).encodeAndWriteHeaders(0xc00245e180, 0xc002413100)
    net/http/h2_bundle.go:8085 +0x305
net/http.(*http2clientStream).writeRequest(0xc00245e180, 0xc002413100)
    net/http/h2_bundle.go:7981 +0x4a5
net/http.(*http2clientStream).doRequest(0x8d7caa?, 0xc0007983c0?)
    net/http/h2_bundle.go:7899 +0x1e
created by net/http.(*http2ClientConn).RoundTrip
    net/http/h2_bundle.go:7828 +0x30a

我遇到一个类似的问题,是最近加入“图片 + 消息 + 图片”这种消息内容后在大量人使用的情况下会出现,而且一个下午出现了3次以上。

RShock commented 1 year ago

我觉得你复现的概率更高。可以尝试更新版本后再看看

wdvxdr1123 commented 1 year ago

可以尝试使用: https://github.com/Mrs4s/go-cqhttp/actions/runs/3242794315

下载媒体资源时禁用了http2, 理论上修复了

CrazyBoyM commented 1 year ago

可以尝试使用: https://github.com/Mrs4s/go-cqhttp/actions/runs/3242794315

下载媒体资源时禁用了http2, 理论上修复了

抱歉我并不是一个go开发者,尝试自己拉取该代码构建失败233。有actions发布的文件嘛

wdvxdr1123 commented 1 year ago

@CrazyBoyM 链接下方有构建好的文件

CrazyBoyM commented 1 year ago

@CrazyBoyM 链接下方有构建好的文件

抱歉之前网不好加载github页面总是不显示全,已经在使用新的测试版了。非常感谢!

qiangdadi commented 1 year ago

我也发生了类似的问题,请问不禁用http2是否可以解决?