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] 发送图文消息时总是失败(非本地图片) #569

Open
Elan114514 opened this issue Nov 26, 2024 · 0 comments
Open

[BUG] 发送图文消息时总是失败(非本地图片) #569

Elan114514 opened this issue Nov 26, 2024 · 0 comments
Labels
bug Something isn't working bug? suspend

Comments

@Elan114514
Copy link

Elan114514 commented Nov 26, 2024

系统版本

Windows Server 2016

QQNT 版本

9.9.16-29927

NapCat 版本

4.1.21

OneBot 客户端

Nonebot2 2.3.2

发生了什么?

使用非本地图片发送图文消息时,总是抛出超时错误,最终也没能成功发出消息,能稳定复现。
示例:使用 http://q1.qlogo.cn/g?b=qq&nk=3846099892&s=640 提供的qq用户头像和一段较长的文本(200余字)构建图文消息
不知是否和图片尺寸有关系?
使用本地图片时似乎没有这个问题
后续通过代码向不同的网络图源自行get图片,几乎是立即响应并下载,应该不是网络问题
验证发现将网络图片下载到本地后再以图文发送,能一定程度提高成功率
但以url构建图片消息段时基本稳定复现此超时错误
后续尝试对未能发出的消息的raw_message中携带的图片url进行get,均可正确响应,图片url是有效的
自写的插件此前一直正常使用,已确认插件代码不存在拼接图文消息时的语法错误或错误的传参

如何复现

1.构建一条由网络请求得到的图片(未下载到本地,以url构建图片消息段,如 http://q1.qlogo.cn/g?b=qq&nk=3846099892&s=640 )和80余字文本拼接而成的图文消息
2.发送失败,抛出超时错误
3.排除了插件代码编写错误的可能后,稳定复现了该错误

期望的结果?

能够正常发送图文消息

NapCat 运行日志

发生错误 ConnectTimeoutError: Connect Timeout Error
    at onConnectTimeout (node:internal/deps/undici/undici:6635:28)
    at node:internal/deps/undici/undici:6587:50
    at Immediate._onImmediate (node:internal/deps/undici/undici:6617:37)
    at process.processImmediate (node:internal/timers:478:21)

OneBot 客户端运行日志

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\multiprocessing\spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\multiprocessing\spawn.py", line 129, in _main
    return self._bootstrap(parent_sentinel)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\multiprocessing\process.py", line 314, in _bootstrap
    self.run()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\multiprocessing\process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "E:\Python\py310\lib\site-packages\nonebot_plugin_reboot\reloader.py", line 27, in _run
    _nb_run(*args, **kwargs)
  File "E:\Python\py310\lib\site-packages\nonebot\__init__.py", line 335, in run
    get_driver().run(*args, **kwargs)
  File "E:\Python\py310\lib\site-packages\nonebot\drivers\fastapi.py", line 186, in run
    uvicorn.run(
  File "E:\Python\py310\lib\site-packages\uvicorn\main.py", line 587, in run
    server.run()
  File "E:\Python\py310\lib\site-packages\uvicorn\server.py", line 62, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\asyncio\windows_events.py", line 321, in run_forever
    super().run_forever()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 603, in run_forever
    self._run_once()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 1909, in _run_once
    handle._run()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "E:\Python\py310\lib\site-packages\nonebot\message.py", line 476, in check_and_run_matcher
    await _run_matcher(
> File "E:\Python\py310\lib\site-packages\nonebot\message.py", line 428, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "E:\Python\py310\lib\site-packages\nonebot\internal\matcher\matcher.py", line 850, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "E:\Python\py310\lib\site-packages\nonebot\internal\matcher\matcher.py", line 825, in simple_run
    await handler(
  File "E:\Python\py310\lib\site-packages\nonebot\dependencies\__init__.py", line 94, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
  File "E:\pockybot\pockybot\src\plugins\nonebot_plugin_fishing\__init__.py", line 2881, in _
    await view_status.finish(status_info + MessageSegment.image(ava))
  File "E:\Python\py310\lib\site-packages\nonebot\internal\matcher\matcher.py", line 582, in finish
    await cls.send(message, **kwargs)
  File "E:\Python\py310\lib\site-packages\nonebot\internal\matcher\matcher.py", line 566, in send
    return await bot.send(event=event, message=_message, **kwargs)
  File "E:\Python\py310\lib\site-packages\nonebot_plugin_blockwords\hook\bot.py", line 44, in send_hook
    return await send(event, err.message, **kwargs)
  File "E:\Python\py310\lib\site-packages\nonebot\adapters\onebot\v11\bot.py", line 228, in send
    return await self.__class__.send_handler(self, event, message, **kwargs)
  File "E:\Python\py310\lib\site-packages\nonebot\adapters\onebot\v11\bot.py", line 181, in send
    return await bot.send_msg(**params)
  File "E:\Python\py310\lib\site-packages\nonebot\internal\adapter\bot.py", line 122, in call_api
    raise exception
  File "E:\Python\py310\lib\site-packages\nonebot\internal\adapter\bot.py", line 97, in call_api
    result = await self.adapter._call_api(self, api, **data)
  File "E:\Python\py310\lib\site-packages\nonebot\adapters\onebot\v11\adapter.py", line 147, in _call_api
    return handle_api_result(await self._result_store.fetch(seq, timeout))
  File "E:\Python\py310\lib\site-packages\nonebot\adapters\onebot\v11\utils.py", line 58, in handle_api_result
    raise ActionFailed(**result)
nonebot.adapters.onebot.v11.exception.ActionFailed: ActionFailed(status='failed', retcode=1200, data=None, message='Connect Timeout Error', wording='Connect Timeout Error', echo='13116')
@Elan114514 Elan114514 added the bug Something isn't working label Nov 26, 2024
@pk5ls20 pk5ls20 added the bug? label Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working bug? suspend
Projects
None yet
Development

No branches or pull requests

3 participants