Skip to content
This repository was archived by the owner on Apr 16, 2024. It is now read-only.

nonebot v1报错WebSocket API call timeout #3

Closed
SlightDust opened this issue Oct 21, 2023 · 6 comments
Closed

nonebot v1报错WebSocket API call timeout #3

SlightDust opened this issue Oct 21, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@SlightDust
Copy link

[2023-10-22 03:20:01,045 translate] ERROR: <class 'aiocqhttp.exceptions.NetworkError'> occured when translate handling message 1108037682.
[2023-10-22 03:20:01,045 translate] ERROR: WebSocket API call timeout
Traceback (most recent call last):
  File "/usr/lib/python3.9/asyncio/tasks.py", line 492, in wait_for
    fut.result()
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/aiocqhttp/api_impl.py", line 104, in fetch
    return await asyncio.wait_for(future, timeout_sec)
  File "/usr/lib/python3.9/asyncio/tasks.py", line 494, in wait_for
    raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/qqbot/HoshinoBot/hoshino/msghandler.py", line 28, in handle_message
    await service_func.func(bot, event)
  File "/root/qqbot/HoshinoBot/hoshino/modules/translate_HoshinoBot/translate.py", line 29, in translate
    await bot.send(ev, message = f"{source} => {target_lang}\n{text}\n==========\n{translated}")
  File "/usr/local/lib/python3.9/dist-packages/aiocqhttp/__init__.py", line 271, in send
    return await self.send_msg(**params)
  File "/usr/local/lib/python3.9/dist-packages/aiocqhttp/__init__.py", line 238, in call_action
    return await self._api.call_action(action=action, **params)
  File "/usr/local/lib/python3.9/dist-packages/aiocqhttp/api_impl.py", line 178, in call_action
    result = await self._wsr_api.call_action(action, **params)
  File "/usr/local/lib/python3.9/dist-packages/aiocqhttp/api_impl.py", line 153, in call_action
    return _handle_api_result(await
  File "/usr/local/lib/python3.9/dist-packages/aiocqhttp/api_impl.py", line 108, in fetch
    raise NetworkError('WebSocket API call timeout')
aiocqhttp.exceptions.NetworkError: WebSocket API call timeout
[2023-10-22 03:20:01,046 nonebot] INFO: Message 1108037682 is ignored: Handled by Hoshino

消息能正常发出来,kook_onebot端没有error日志,但是onebot那边过一会儿会给这个报错。

@SlightDust
Copy link
Author

版本是最新的release 0.0.10

@SlightDust
Copy link
Author

复现:
在群聊内发来点星奏,bot会正常发送图片
image

但在1分钟后hoshino会报错

[2023-10-22 13:28:48,483 nonebot] INFO: Self: 3802011164, Message -712938619 from 942135547@[:8362499366987951]: '来点星奏'
[2023-10-22 13:28:48,483 chat] INFO: Message -712938619 triggered seina.
[2023-10-22 13:29:48,485 chat] ERROR: <class 'aiocqhttp.exceptions.NetworkError'> occured when seina handling message -712938619.
[2023-10-22 13:29:48,486 chat] ERROR: WebSocket API call timeout
Traceback (most recent call last):
  File "/usr/lib/python3.9/asyncio/tasks.py", line 492, in wait_for
    fut.result()
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/aiocqhttp/api_impl.py", line 104, in fetch
    return await asyncio.wait_for(future, timeout_sec)
  File "/usr/lib/python3.9/asyncio/tasks.py", line 494, in wait_for
    raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/qqbot/HoshinoBot/hoshino/msghandler.py", line 28, in handle_message
    await service_func.func(bot, event)
  File "/root/qqbot/HoshinoBot/hoshino/service.py", line 224, in wrapper
    return await func(bot, event)
  File "/root/qqbot/HoshinoBot/hoshino/modules/groupmaster/chat.py", line 46, in seina
    await bot.send(ev, R.img('星奏.png').cqcode)
  File "/usr/local/lib/python3.9/dist-packages/aiocqhttp/__init__.py", line 271, in send
    return await self.send_msg(**params)
  File "/usr/local/lib/python3.9/dist-packages/aiocqhttp/__init__.py", line 238, in call_action
    return await self._api.call_action(action=action, **params)
  File "/usr/local/lib/python3.9/dist-packages/aiocqhttp/api_impl.py", line 178, in call_action
    result = await self._wsr_api.call_action(action, **params)
  File "/usr/local/lib/python3.9/dist-packages/aiocqhttp/api_impl.py", line 153, in call_action
    return _handle_api_result(await
  File "/usr/local/lib/python3.9/dist-packages/aiocqhttp/api_impl.py", line 108, in fetch
    raise NetworkError('WebSocket API call timeout')
aiocqhttp.exceptions.NetworkError: WebSocket API call timeout
[2023-10-22 13:29:48,486 nonebot] INFO: Message -712938619 is ignored: Handled by Hoshino

@super1207
Copy link
Owner

已经基本确认问题原因,下版本会修复。

(hoshino发送的动作请求中的"echo"字段不是字符串格式,kookonebot没考虑到这个)

@SlightDust
Copy link
Author

泰裤辣!

@super1207 super1207 added the bug Something isn't working label Oct 22, 2023
@super1207
Copy link
Owner

@SlightDust
Copy link
Author

releases/tag/0.0.11 验证OK

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

No branches or pull requests

2 participants