super1207 / KookOneBot

onebot 11 in kook!!! kook = 开黑啦
MIT License
46 stars 4 forks source link

nonebot v1报错WebSocket API call timeout #3

Closed SlightDust closed 1 year ago

SlightDust commented 1 year ago
[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 commented 1 year ago

版本是最新的release 0.0.10

SlightDust commented 1 year ago

复现: 在群聊内发来点星奏,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 commented 1 year ago

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

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

SlightDust commented 1 year ago

泰裤辣!

super1207 commented 1 year ago

0.0.11 已修复:https://github.com/super1207/KookOneBot/releases/tag/0.0.11

SlightDust commented 1 year ago

releases/tag/0.0.11 验证OK