AstrBot icon indicating copy to clipboard operation
AstrBot copied to clipboard

[Bug]QQ短时间发送非同一消息的十五张以上图片时会超时未发送

Open NyaCo opened this issue 9 months ago • 2 comments

What happened / 发生了什么

OneBot v11 在短时间(大约是1-2分钟)内连续发送非合并的十五张(不含)以上图片,第16张以后的图片均会超时不发送

Reproduce / 如何复现?

在gscore中订阅15个以上群的图片推送 (或者只要是一次发送15张以上独立消息的图片)

AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器

windows 2022 server gitclone直接部署 AstrBot v4.15.0 NapCat v4.15.18 GsCore v0.9.1 astrbot_plugin_gscore_adapter v0.4.3 以上更换任意新老版本均是如此问题

OS

Windows

Logs / 报错日志

[11:05:19] [Core] [ERRO] [v4.15.0] [astrbot_plugin_gscore_adapter.main:275]: <ActionFailed status='failed', retcode=1200, data=None, message='Timeout: NTEvent serviceAndMethod:NodeIKernelMsgService/sendMsg ListenerName:NodeIKernelMsgListener/onMsgInfoListUpdate EventRet:\n{\n "result": 0,\n "errMsg": ""\n}\n', wording='Timeout: NTEvent serviceAndMethod:NodeIKernelMsgService/sendMsg ListenerName:NodeIKernelMsgListener/onMsgInfoListUpdate EventRet:\n{\n "result": 0,\n "errMsg": ""\n}\n', echo={'seq': 1300}, stream='normal-action'> Traceback (most recent call last): File "C:\Users\Administrator\AstrBot\data\plugins\astrbot_plugin_gscore_adapter\main.py", line 273, in recv_msg await self.bot_send_msg(msg.content, session, bid) File "C:\Users\Administrator\AstrBot\data\plugins\astrbot_plugin_gscore_adapter\main.py", line 357, in bot_send_msg await self.context.send_message(session, messages) File "C:\Users\Administrator\AstrBot\astrbot\core\star\context.py", line 449, in send_message await platform.send_by_session(session, message_chain) File "C:\Users\Administrator\AstrBot\astrbot\core\platform\sources\aiocqhttp\aiocqhttp_platform_adapter.py", line 118, in send_by_session await AiocqhttpMessageEvent.send_message( File "C:\Users\Administrator\AstrBot\astrbot\core\platform\sources\aiocqhttp\aiocqhttp_message_event.py", line 119, in send_message await cls._dispatch_send(bot, event, is_group, session_id, ret) File "C:\Users\Administrator\AstrBot\astrbot\core\platform\sources\aiocqhttp\aiocqhttp_message_event.py", line 82, in dispatch_send await bot.send_group_msg(group_id=session_id_int, message=messages) File "C:\Users\Administrator\AstrBot.venv\Lib\site-packages\aiocqhttp_init.py", line 236, in call_action return await self._api.call_action(action=action, **params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AstrBot.venv\Lib\site-packages\aiocqhttp\api_impl.py", line 178, in call_action result = await self._wsr_api.call_action(action, **params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AstrBot.venv\Lib\site-packages\aiocqhttp\api_impl.py", line 153, in call_action return _handle_api_result(await ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AstrBot.venv\Lib\site-packages\aiocqhttp\api_impl.py", line 38, in _handle_api_result raise ActionFailed(result=result) aiocqhttp.exceptions.ActionFailed: <ActionFailed status='failed', retcode=1200, data=None, message='Timeout: NTEvent serviceAndMethod:NodeIKernelMsgService/sendMsg ListenerName:NodeIKernelMsgListener/onMsgInfoListUpdate EventRet:\n{\n "result": 0,\n "errMsg": ""\n}\n', wording='Timeout: NTEvent serviceAndMethod:NodeIKernelMsgService/sendMsg ListenerName:NodeIKernelMsgListener/onMsgInfoListUpdate EventRet:\n{\n "result": 0,\n "errMsg": ""\n}\n', echo={'seq': 1300}, stream='normal-action'>

Are you willing to submit a PR? / 你愿意提交 PR 吗?

  • [ ] Yes!

Code of Conduct

NyaCo avatar Feb 11 '26 03:02 NyaCo

Hi @NyaCo! I'm Dosu and I’m helping the AstrBot team.

你的问题本质是短时间内发送大量图片消息时,消息发送流程被限流/阻塞,最终触发底层(NapCat/go-cqhttp)超时,报 retcode=1200 和 NTEvent 超时。以下是分析和建议:


1. AstrBot 限流机制与配置

AstrBot 默认每个会话(如每个群)60秒内最多允许30条消息(可在 platform_settings.rate_limit 配置),超出后会 stall(等待)或丢弃消息,导致后续消息排队、超时未发出。你可以适当提升该参数,例如:

"platform_settings": {
  "rate_limit": {
    "count": 60,
    "time": 60,
    "strategy": "stall"
  }
}

(实际配置路径/data/cmd_config.json,或参考rate limit代码实现)


2. aiocqhttp 适配器消息节奏

aiocqhttp 发送 Node/Nodes/File 等消息段时,每条之间有 0.5 秒 sleep,防止过快触发平台风控。单条消息超时(默认180秒)会抛出 retcode=1200,底层实际是 go-cqhttp/NapCat 的 send_group_msg 阻塞超时代码参考。


3. 常见诱因与历史经验

  • 多个 issue(如#1814、#193、#246)反馈类似图片消息超时、ActionFailed: retcode=1200、WebSocket API call timeout,常见诱因包括网络慢、参数异常、平台风控、NapCat/QQ客户端异常等。
  • 有用户通过重装QQ、升级NapCat、合并消息(如使用合并转发/forward)等方式缓解或解决。

4. 优化建议

  • 合并图片为转发消息:如用 Nodes/forward 合并多张图片,减少单条消息数量,能极大降低超时概率(部分平台对合并转发有更高限额)。
  • 调整限流参数:如上所述,适当提升 rate_limit,或将 strategy 设为 discard,避免长时间 stall 导致后续消息超时。
  • 优化图片处理流程:确保图片本地/网络I/O、base64转换、文件服务注册等环节不卡顿,必要时可用更快的磁盘/网络。
  • 检查系统资源:Windows Server 下磁盘、网络、CPU 占用高时也会影响消息处理速度。
  • 避免单次推送过多独立图片:如确需高频推送,建议分批、分时段发送。

5. Windows+NapCat 常见经验

  • 有用户反馈重装QQ客户端、升级NapCat后恢复正常,建议尝试。
  • 避免一次性推送大量独立图片,优先合并消息或分批。

如需进一步排查,可开启 debug 日志,观察具体哪一步耗时或失败。若需代码/配置片段,可补充说明。

To reply, just mention @dosu.


Docs are dead. Just use Dosu.

Leave Feedback Ask Dosu about AstrBot Share Dosu with your team

dosubot[bot] avatar Feb 11 '26 03:02 dosubot[bot]

这个更可能是 napcat 或者 QQ 的限制,而不是 AstrBot 的限制

Soulter avatar Feb 13 '26 16:02 Soulter