Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] bot私聊信息发不出来,并且导致程序崩溃 #25

Closed
erowalker opened this issue May 16, 2024 · 19 comments
Closed

[BUG] bot私聊信息发不出来,并且导致程序崩溃 #25

erowalker opened this issue May 16, 2024 · 19 comments
Labels
bug Something isn't working

Comments

@erowalker
Copy link

erowalker commented May 16, 2024

系统版本

ubuntu

QQNT 版本

QQ_3.2.7_240428_amd64

NapCat 版本

1.3.3

OneBot 客户端

yobot_remix v4.0.2

发生了什么?

对bot私聊触发词后,bot返回的私聊信息发不出去,并且报错崩溃。但同时bot在群聊中能正常发出消息。

如何复现

1.使用反向WebSocket监听对接yobot
2.启用HTTP 事件上报,将yobot的默认页面设置为HTTP 事件上报地址
3.对bot私聊触发词version,或者任何其他触发词

期望的结果?

应在私聊中正常返回bot版本号,并且不崩溃

NapCat 运行日志

发送消息 给私聊 0: Remix-[v4.0.2]

node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "发送超时".] {
  code: 'ERR_UNHANDLED_REJECTION'
}

Node.js v18.18.2

OneBot 客户端运行日志

[2024-05-16 20:40:46 +0000] [498865] [INFO] 127.0.0.1:59248 POST / 1.1 204 0 2352
[2024-05-16 20:40:46 +0000] [498865] [INFO] 127.0.0.1:59248 POST / 1.1 - - 2654
[2024-05-16 20:42:32,147] WARNING in __init__: there is already a reverse websocket api connection, so the event may be handled twice.
[2024-05-16 20:42:32 +0000] [498865] [INFO] 127.0.0.1:40398 POST / 1.1 204 0 1469
[2024-05-16 20:42:32 +0000] [498865] [INFO] 127.0.0.1:40398 POST / 1.1 - - 1855
[2024-05-16 20:42:51,938] WARNING in __init__: there is already a reverse websocket api connection, so the event may be handled twice.
[2024-05-16 20:42:51 +0000] [498865] [INFO] 127.0.0.1:53126 POST / 1.1 204 0 1946
[2024-05-16 20:42:51 +0000] [498865] [INFO] 127.0.0.1:53126 POST / 1.1 - - 2189
[2024-05-16 20:43:49,818] WARNING in __init__: there is already a reverse websocket api connection, so the event may be handled twice.
[2024-05-16 20:43:49 +0000] [498865] [INFO] 127.0.0.1:49944 POST / 1.1 204 0 2704
[2024-05-16 20:43:49 +0000] [498865] [INFO] 127.0.0.1:49944 POST / 1.1 - - 3035
[2024-05-16 20:43:55,191] WARNING in __init__: there is already a reverse websocket api connection, so the event may be handled twice.
[2024-05-16 20:43:55 +0000] [498865] [INFO] 127.0.0.1:36556 POST / 1.1 204 0 1669
[2024-05-16 20:43:55 +0000] [498865] [INFO] 127.0.0.1:36556 POST / 1.1 - - 1896
[2024-05-16 20:44:12,928] WARNING in __init__: there is already a reverse websocket api connection, so the event may be handled twice.
[2024-05-16 20:44:12 +0000] [498865] [INFO] 127.0.0.1:50476 POST / 1.1 204 0 3079
[2024-05-16 20:44:12 +0000] [498865] [INFO] 127.0.0.1:50476 POST / 1.1 - - 4453
[2024-05-16 20:44:18,106] WARNING in __init__: there is already a reverse websocket api connection, so the event may be handled twice.
[2024-05-16 20:44:18 +0000] [498865] [INFO] 127.0.0.1:50486 POST / 1.1 204 0 1854
[2024-05-16 20:44:18 +0000] [498865] [INFO] 127.0.0.1:50486 POST / 1.1 - - 2087
[2024-05-16 20:44:29,397] WARNING in __init__: there is already a reverse websocket api connection, so the event may be handled twice.
[2024-05-16 20:44:29 +0000] [498865] [INFO] 127.0.0.1:35958 POST / 1.1 204 0 1431
[2024-05-16 20:44:29 +0000] [498865] [INFO] 127.0.0.1:35958 POST / 1.1 - - 1696
[2024-05-16 20:45:05 +0000] [498865] [INFO] 127.0.0.1:45758 GET /ws/ 1.1 101 - 700
[2024-05-16 20:45:11,350] WARNING in __init__: there is already a reverse websocket api connection, so the event may be handled twice.
[2024-05-16 20:45:11 +0000] [498865] [INFO] 127.0.0.1:34238 POST / 1.1 204 0 1566
[2024-05-16 20:45:11 +0000] [498865] [INFO] 127.0.0.1:34238 POST / 1.1 - - 1825
[2024-05-16 20:45:23,513] WARNING in __init__: there is already a reverse websocket api connection, so the event may be handled twice.
[2024-05-16 20:45:23 +0000] [498865] [INFO] 127.0.0.1:43874 POST / 1.1 204 0 1905
[2024-05-16 20:45:23 +0000] [498865] [INFO] 127.0.0.1:43874 POST / 1.1 - - 2338
[2024-05-16 20:45:30,985] WARNING in __init__: there is already a reverse websocket api connection, so the event may be handled twice.
[2024-05-16 20:45:30 +0000] [498865] [INFO] 127.0.0.1:46678 POST / 1.1 200 44 1571
[2024-05-16 20:45:30 +0000] [498865] [INFO] 127.0.0.1:46678 POST / 1.1 - - 1824
[2024-05-16 20:45:58 +0000] [498865] [INFO] 127.0.0.1:58502 GET /ws/ 1.1 101 - 870
[2024-05-16 20:48:06,579] WARNING in __init__: there is already a reverse websocket api connection, so the event may be handled twice.
[2024-05-16 20:48:06 +0000] [498865] [INFO] 127.0.0.1:33326 POST / 1.1 204 0 1626
[2024-05-16 20:48:06 +0000] [498865] [INFO] 127.0.0.1:33326 POST / 1.1 - - 1878
[2024-05-16 20:48:06,918] WARNING in __init__: there is already a reverse websocket api connection, so the event may be handled twice.
[2024-05-16 20:48:06 +0000] [498865] [INFO] 127.0.0.1:33326 POST / 1.1 204 0 2486
[2024-05-16 20:48:06 +0000] [498865] [INFO] 127.0.0.1:33326 POST / 1.1 - - 2753
[2024-05-16 20:49:29,951] WARNING in __init__: there is already a reverse websocket api connection, so the event may be handled twice.
[2024-05-16 20:49:29 +0000] [498865] [INFO] 127.0.0.1:34272 POST / 1.1 204 0 1518
[2024-05-16 20:49:29 +0000] [498865] [INFO] 127.0.0.1:34272 POST / 1.1 - - 2175
[2024-05-16 20:49:31,106] WARNING in __init__: there is already a reverse websocket api connection, so the event may be handled twice.
[2024-05-16 20:49:31 +0000] [498865] [INFO] 127.0.0.1:34272 POST / 1.1 204 0 7393
[2024-05-16 20:49:31 +0000] [498865] [INFO] 127.0.0.1:34272 POST / 1.1 - - 7770
[2024-05-16 20:50:29,755] WARNING in __init__: there is already a reverse websocket api connection, so the event may be handled twice.
[2024-05-16 20:50:29 +0000] [498865] [INFO] 127.0.0.1:36970 POST / 1.1 204 0 2240
[2024-05-16 20:50:29 +0000] [498865] [INFO] 127.0.0.1:36970 POST / 1.1 - - 2604
[2024-05-16 20:53:57,216] WARNING in __init__: there is already a reverse websocket api connection, so the event may be handled twice.
[2024-05-16 20:53:57 +0000] [498865] [INFO] 127.0.0.1:50980 POST / 1.1 204 0 2277
[2024-05-16 20:53:57 +0000] [498865] [INFO] 127.0.0.1:50980 POST / 1.1 - - 2925
[2024-05-16 20:54:21,198] WARNING in __init__: there is already a reverse websocket api connection, so the event may be handled twice.
[2024-05-16 20:54:21 +0000] [498865] [INFO] 127.0.0.1:60708 POST / 1.1 204 0 1857
[2024-05-16 20:54:21 +0000] [498865] [INFO] 127.0.0.1:60708 POST / 1.1 - - 2085
@erowalker erowalker added the bug Something isn't working label May 16, 2024
@MliKiowa
Copy link
Member

MliKiowa commented May 17, 2024

未能复现成功

@MliKiowa
Copy link
Member

有发送内容和更多数据吗

@erowalker
Copy link
Author

有发送内容和更多数据吗

发送内容是version,发送登录也是会这样(正常情况下应该返回一个登录链接)

@erowalker
Copy link
Author

QQ截图20240517151616
napcat是这样设置的,yobot设置是这样:
"host": "0.0.0.0",
"port": 9222,
"access_token": "xxxxx",
"client_salt": "xxxxx",
"public_address": "http://xxx.xxx:9222/",
"public_basepath": "/",
"web_mode_hint": false,
"super-admin": [
xxxxx
],
"black-list": [],
"white_list_mode": false,
"black-list-group": [],
"white-list-group": [],
"allow_bulk_private": false,
"clan_battle_mode": "web",
"notify_groups": [],
"notify_privates": [],
"preffix_on": false,
"preffix_string": "",
"zht_in": false,
"zht_out": false,
"zht_out_style": "s2t",
"show_icp": false,
"icp_info": "",
"gongan_info": "",
"web_gzip": 0,

@MliKiowa
Copy link
Member

@MliKiowa
Copy link
Member

注意备份配置文件 这个需要重新配置

@erowalker
Copy link
Author

试试 这个版本 https://github.com/NapNeko/NapCatQQ/actions/runs/9124699638

仍然出现这个问题
node:internal/process/promises:288
triggerUncaughtException(err, true /* fromPromise */);
^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "发送超时".] {
code: 'ERR_UNHANDLED_REJECTION'
}

Node.js v18.18.2

另外这个版本似乎webui有问题?在webui点添加按钮没反应,只能直接编辑json文件

@erowalker
Copy link
Author

另外还注意到一个情况就是刚登录成功时会出现下边的报错:

登录成功!
[BuglyManager.cpp][UploadBugly][107]!!!in UploadBugly.
[NativeCrashHandler.cpp][getCrashDetailBeanFromRecord][52]!!!! in NativeCrashHandler getCrashDetailBeanFromRecord, open file error!!!,dumpFilePath:/root/.config/QQ/crash_files/rqd_record.eup.
[NativeCrashHandler.cpp][uploadCrashEvent][331]get null crashDetailBean, return!

不知道跟这个有没有关系。

另外同时开启反向WebSocket监听和HTTP 事件上报后会出现在群里报刀后台会上报2次的问题,但关上反向ws又会导致在web端操作无法回报到群里,不知道有没有什么解决办法

@MliKiowa
Copy link
Member

这个版本webui变动了东西

@linyuchen
Copy link
Member

看一下logs文件夹下的日志文件,里面有详细的发送日志

@MliKiowa
Copy link
Member

MliKiowa commented May 17, 2024

测一下新版本 https://github.com/NapNeko/NapCatQQ/actions/runs/9129426163 应该没有问题了

@erowalker
Copy link
Author

erowalker commented May 17, 2024

测一下新版本 https://github.com/NapNeko/NapCatQQ/actions/runs/9129426163 应该没有问题了

新版本不崩溃了,但还是会出现
新消息事件HTTP上报返回快速操作失败 {}
的错误信息然后消息发不出去,另外bot在群里的回复也发不出去了,但是从web端操作返回的反向Websocket消息倒是正常,log文件我把无关的消息删掉附上了
2024-05-17_14-25-41.193.log

@MliKiowa
Copy link
Member

MliKiowa commented May 17, 2024

测一下新版本 https://github.com/NapNeko/NapCatQQ/actions/runs/9129426163 应该没有问题了

新版本不崩溃了,但还是会出现 新消息事件HTTP上报返回快速操作失败 {} 的错误信息然后消息发不出去,另外bot在群里的回复也发不出去了,但是从web端操作返回的反向Websocket消息倒是正常,log文件我把无关的消息删掉附上了 2024-05-17_14-25-41.193.log

https://github.com/NapNeko/NapCatQQ/actions/runs/9129426163 这个最新版 给一下日志 这都是2点钟老版本的日志了 现在看到用了不支持的api

@erowalker
Copy link
Author

测一下新版本 https://github.com/NapNeko/NapCatQQ/actions/runs/9129426163 应该没有问题了

新版本不崩溃了,但还是会出现 新消息事件HTTP上报返回快速操作失败 {} 的错误信息然后消息发不出去,另外bot在群里的回复也发不出去了,但是从web端操作返回的反向Websocket消息倒是正常,log文件我把无关的消息删掉附上了 2024-05-17_14-25-41.193.log

https://github.com/NapNeko/NapCatQQ/actions/runs/9129426163 这个最新版 给一下日志 这都是2点钟老版本的日志了 现在看到用了不支持的api

哦不好意思,上次试的时候好像下成旧版本了。新版本测试后发现同时开启http上报和反向ws的话群消息和私聊消息都能正常上报也可以正常返回消息,但是从web端查看时发现上报了2次(群内发一次报刀结果实际报了2刀同样的)但是只返回了一次反向ws消息。(见log1)
log1_2024-05-17_18-47-11.516.log
如果关掉http上报只开反向ws监听的话,从日志来看似乎是成功上报了(web端也有正常的反馈),但是收到的反向ws消息没有成功发送,原因好像是不支持的api(见log2)
log2_2024-05-17_19-03-50.141.log

@MliKiowa
Copy link
Member

ws那里使用了不受支持的api

@erowalker
Copy link
Author

erowalker commented May 18, 2024

ws那里使用了不受支持的api

https://github.com/nonebot/aiocqhttp/blob/master/aiocqhttp/api_impl.py
这个bot用的应该是这个aiocqhttp的api,请问有办法兼容吗?

@MliKiowa
Copy link
Member

可以

@MliKiowa
Copy link
Member

@erowalker
Copy link
Author

https://github.com/NapNeko/NapCatQQ/actions/runs/9138016931 你试试这个版本

ws消息上报和反向ws消息发送都正常了,感谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants