Bug: 出现异常偶发反向ws未知原因的断连崩溃
操作系统
Windows
Python 版本
3.9.
NoneBot 版本
2.4.0
适配器
onebot v11 2.4.2
协议端
llonebot,napcat,lagrange
描述问题
运行一段时间后不知道什么原因会出现ws超时断开一直重连的情况,在多个插件和适配器中都出现过此类问题,触发条件未知,重启后正常 https://github.com/noneplugin/nonebot-plugin-chatrecorder/issues/64#issue-2709101105 https://github.com/LagrangeDev/Lagrange.Core/issues/685#issue-2663629737
复现步骤
布吉岛qwq
期望的结果
No response
截图或日志
断连期间 nb 的日志呢?
类似这种
2024-12-16 15:07:03.239 | ERROR | apscheduler:run_coroutine_job:36 - Job "change_name (trigger: cron[minute='*/1'], next run at: 2024-12-16 15:08:00 CST)" raised an exception
Traceback (most recent call last):
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\uvicorn\protocols\websockets\websockets_impl.py", line 349, in asgi_send
await self.send(data) # type: ignore[arg-type]
│ │ └ '{"action": "get_group_member_info", "params": {"group_id": 897666173, "user_id": 3767017836, "no_cache": true}, "echo": "376...
│ └ <function WebSocketCommonProtocol.send at 0x00000154C1D26A60>
└ <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x0000015485A1AD60>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\websockets\legacy\protocol.py", line 635, in send
await self.ensure_open()
│ └ <function WebSocketCommonProtocol.ensure_open at 0x00000154C1D26DC0>
└ <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x0000015485A1AD60>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\websockets\legacy\protocol.py", line 944, in ensure_open
raise self.connection_closed_exc()
│ └ <function WebSocketCommonProtocol.connection_closed_exc at 0x00000154C1D26D30>
└ <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x0000015485A1AD60>
websockets.exceptions.ConnectionClosedError: no close frame received or sent
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\starlette\websockets.py", line 88, in send
await self._send(message)
│ │ └ {'type': 'websocket.send', 'text': '{"action": "get_group_member_info", "params": {"group_id": 897666173, "user_id": 37670178...
│ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x0000015486385F70>
└ <starlette.websockets.WebSocket object at 0x0000015485DBCC70>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\starlette\_exception_handler.py", line 50, in sender
await send(message)
│ └ {'type': 'websocket.send', 'text': '{"action": "get_group_member_info", "params": {"group_id": 897666173, "user_id": 37670178...
└ <bound method WebSocketProtocol.asgi_send of <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x0000...
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\uvicorn\protocols\websockets\websockets_impl.py", line 365, in asgi_send
raise ClientDisconnected from exc
└ <class 'uvicorn.protocols.utils.ClientDisconnected'>
uvicorn.protocols.utils.ClientDisconnected
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\n2006\Desktop\bot\Pallas-Bot\bot.py", line 36, in <module>
nonebot.run(app="__mp_main__:app")
│ └ <function run at 0x00000154B2D8FDC0>
└ <module 'nonebot' from 'C:\\Users\\n2006\\miniconda3\\envs\\plsb\\lib\\site-packages\\nonebot\\__init__.py'>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\nonebot\__init__.py", line 335, in run
get_driver().run(*args, **kwargs)
│ │ └ {'app': '__mp_main__:app'}
│ └ ()
└ <function get_driver at 0x00000154B2B65AF0>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\nonebot\drivers\fastapi.py", line 186, in run
uvicorn.run(
│ └ <function run at 0x00000154B31B3940>
└ <module 'uvicorn' from 'C:\\Users\\n2006\\miniconda3\\envs\\plsb\\lib\\site-packages\\uvicorn\\__init__.py'>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\uvicorn\main.py", line 587, in run
server.run()
│ └ <function Server.run at 0x00000154B31B33A0>
└ <uvicorn.server.Server object at 0x00000154F28529A0>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\uvicorn\server.py", line 62, in run
return asyncio.run(self.serve(sockets=sockets))
│ │ │ │ └ None
│ │ │ └ <function Server.serve at 0x00000154B31B3430>
│ │ └ <uvicorn.server.Server object at 0x00000154F28529A0>
│ └ <function run at 0x00000154B09B8040>
└ <module 'asyncio' from 'C:\\Users\\n2006\\miniconda3\\envs\\plsb\\lib\\asyncio\\__init__.py'>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
│ │ └ <coroutine object Server.serve at 0x00000154C20E2D40>
│ └ <function BaseEventLoop.run_until_complete at 0x00000154B228B4C0>
└ <ProactorEventLoop running=True closed=False debug=False>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\asyncio\base_events.py", line 634, in run_until_complete
self.run_forever()
│ └ <function ProactorEventLoop.run_forever at 0x00000154B231B040>
└ <ProactorEventLoop running=True closed=False debug=False>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\asyncio\windows_events.py", line 321, in run_forever
super().run_forever()
File "C:\Users\n2006\miniconda3\envs\plsb\lib\asyncio\base_events.py", line 601, in run_forever
self._run_once()
│ └ <function BaseEventLoop._run_once at 0x00000154B228DF70>
└ <ProactorEventLoop running=True closed=False debug=False>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\asyncio\base_events.py", line 1905, in _run_once
handle._run()
│ └ <function Handle._run at 0x00000154B222B430>
└ <Handle <TaskWakeupMethWrapper object at 0x0000015487A16A90>(<Future finished result=True>)>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\asyncio\events.py", line 80, in _run
self._context.run(self._callback, *self._args)
│ │ │ │ │ └ <member '_args' of 'Handle' objects>
│ │ │ │ └ <Handle <TaskWakeupMethWrapper object at 0x0000015487A16A90>(<Future finished result=True>)>
│ │ │ └ <member '_callback' of 'Handle' objects>
│ │ └ <Handle <TaskWakeupMethWrapper object at 0x0000015487A16A90>(<Future finished result=True>)>
│ └ <member '_context' of 'Handle' objects>
└ <Handle <TaskWakeupMethWrapper object at 0x0000015487A16A90>(<Future finished result=True>)>
> File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\apscheduler\executors\base_py3.py", line 30, in run_coroutine_job
retval = await job.func(*job.args, **job.kwargs)
│ │ │ │ │ └ <member 'kwargs' of 'Job' objects>
│ │ │ │ └ <Job (id=31b1e7ce7d31455f81cd3762bdfc0a3b name=change_name)>
│ │ │ └ <member 'args' of 'Job' objects>
│ │ └ <Job (id=31b1e7ce7d31455f81cd3762bdfc0a3b name=change_name)>
│ └ <member 'func' of 'Job' objects>
└ <Job (id=31b1e7ce7d31455f81cd3762bdfc0a3b name=change_name)>
File "C:\Users\n2006\Desktop\bot\Pallas-Bot\src\plugins\take_name\__init__.py", line 43, in change_name
info = await bot.call_api('get_group_member_info', **{
│ └ <function Bot.call_api at 0x00000154B2BA7EE0>
└ Bot(type='OneBot V11', self_id='2816858130')
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\nonebot\internal\adapter\bot.py", line 122, in call_api
raise exception
└ WebSocketDisconnect()
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\nonebot\internal\adapter\bot.py", line 97, in call_api
result = await self.adapter._call_api(self, api, **data)
│ │ │ │ │ └ {'group_id': 897666173, 'user_id': 3767017836, 'no_cache': True}
│ │ │ │ └ 'get_group_member_info'
│ │ │ └ Bot(type='OneBot V11', self_id='2816858130')
│ │ └ <function Adapter._call_api at 0x00000154B2F37C10>
│ └ Adapter(name='OneBot V11')
└ Bot(type='OneBot V11', self_id='2816858130')
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\nonebot\adapters\onebot\v11\adapter.py", line 145, in _call_api
await websocket.send(json_data)
│ │ └ '{"action": "get_group_member_info", "params": {"group_id": 897666173, "user_id": 3767017836, "no_cache": true}, "echo": "376...
│ └ <function WebSocket.send at 0x00000154B2D2DEE0>
└ FastAPIWebSocket('ws://192.168.152.176:8080/onebot/v11/ws')
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\nonebot\internal\driver\model.py", line 193, in send
await self.send_text(data)
│ │ └ '{"action": "get_group_member_info", "params": {"group_id": 897666173, "user_id": 3767017836, "no_cache": true}, "echo": "376...
│ └ <function FastAPIWebSocket.send_text at 0x00000154B3577280>
└ FastAPIWebSocket('ws://192.168.152.176:8080/onebot/v11/ws')
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\nonebot\drivers\fastapi.py", line 301, in send_text
await self.websocket.send({"type": "websocket.send", "text": data})
│ │ │ └ '{"action": "get_group_member_info", "params": {"group_id": 897666173, "user_id": 3767017836, "no_cache": true}, "echo": "376...
│ │ └ <function WebSocket.send at 0x00000154B34959D0>
│ └ <starlette.websockets.WebSocket object at 0x0000015485DBCC70>
└ FastAPIWebSocket('ws://192.168.152.176:8080/onebot/v11/ws')
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\starlette\websockets.py", line 91, in send
raise WebSocketDisconnect(code=1006)
└ <class 'starlette.websockets.WebSocketDisconnect'>
starlette.websockets.WebSocketDisconnect
从这个报错看上去是你在定时任务里调用了api,然后此时ws已经异常断开了,并不能看出来是什么导致的断开。你的协议端和nb在一台机器上吗?
从这个报错看上去是你在定时任务里调用了api,然后此时ws已经异常断开了,并不能看出来是什么导致的断开。你的协议端和nb在一台机器上吗?
在的,这个应该是反向ws的问题,要不然没法解释chatrecoder插件那个database locked)
database locked是sqlite并发问题,与nb无关,另外ws断连我觉得多半也不是nb这边的问题,因为没收到关闭连接的 frame,也没有 heartbeat 超时,可能是 client 端突然断开。
database locked是sqlite并发问题,与nb无关,另外ws断连我觉得多半也不是nb这边的问题,因为没收到关闭连接的 frame,也没有 heartbeat 超时,可能是 client 端突然断开。
应该不是client端的问题 在出现如上问题时,重启client端无法解决问题,只有重启nb有效 而且这个问题我在llob,nc上都有复现 佬我这边有没有法子做个验证)
重连期间的nb日志呢?nb有收到重连的请求吗?
我好像从来没见到过其他人有这个问题,反向ws运行几年都没遇到过。
重连期间的nb日志呢?nb有收到重连的请求吗?
我好像从来没见到过其他人有这个问题,反向ws运行几年都没遇到过。
这个等两天复现时发上来吧,遇到这个问题有段时间了,最早的截图没留qwq
日志有些多没找到是从哪里触发的,都是发送消息的插件抛出这种相似的报错
2025-01-06 08:18:26.958 | INFO | nonebot:simple_run:846 - Matcher(type='message', module=src.plugins.repeater, lineno=22) running complete
2025-01-06 08:18:26.963 | INFO | nonebot:simple_run:846 - Matcher(type='message', module=src.plugins.repeater, lineno=22) running complete
2025-01-06 08:18:26.994 | INFO | repeater:_:115 - bot [2816858130] ready to send [被叫停了] to group [2154011965]
2025-01-06 08:18:27.004 | INFO | nonebot:simple_run:846 - Matcher(type='message', module=src.plugins.repeater, lineno=22) running complete
2025-01-06 08:18:27.007 | INFO | nonebot:simple_run:846 - Matcher(type='message', module=src.plugins.repeater, lineno=22) running complete
2025-01-06 08:18:27.016 | INFO | nonebot:simple_run:846 - Matcher(type='message', module=src.plugins.repeater, lineno=22) running complete
2025-01-06 08:18:27.021 | INFO | nonebot:simple_run:846 - Matcher(type='message', module=src.plugins.repeater, lineno=22) running complete
2025-01-06 08:18:27.067 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 5...
2025-01-06 08:18:27.068 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 5...
2025-01-06 08:18:27.069 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 5...
2025-01-06 08:18:27.070 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 5...
2025-01-06 08:18:27.182 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 2...
2025-01-06 08:18:27.186 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 2...
2025-01-06 08:18:27.187 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 4...
2025-01-06 08:18:27.280 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 4...
2025-01-06 08:18:27.363 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 4...
2025-01-06 08:18:27.451 | INFO | websockets:handler:264 - connection closed
2025-01-06 08:18:27.453 | ERROR | nonebot_plugin_filehost:__call__:55 - Scope scope={'type': 'websocket', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'scheme': 'ws', 'server': ('192.168.152.176', 8080), 'client': ('192.168.152.176', 49559), 'root_path': '', 'path': '/onebot/v11/ws', 'raw_path': b'/onebot/v11/ws', 'query_string': b'', 'headers': [(b'x-self-id', b'3474854213'), (b'authorization', b'Bearer'), (b'x-client-role', b'Universal'), (b'user-agent', b'OneBot/11'), (b'sec-websocket-version', b'13'), (b'sec-websocket-key', b'eaRel7NVqylcSgCfiuZb+w=='), (b'connection', b'Upgrade'), (b'upgrade', b'websocket'), (b'host', b'192.168.152.176:8080')], 'subprotocols': [], 'state': {}, 'extensions': {'websocket.http.response': {}}, 'app': <fastapi.applications.FastAPI object at 0x00000208248B2F40>} deserialize failed:
Traceback (most recent call last):
File "C:\Users\n2006\Desktop\bot\Pallas-Bot\bot.py", line 36, in <module>
nonebot.run(app="__mp_main__:app")
│ └ <function run at 0x0000020827BDAF70>
└ <module 'nonebot' from 'C:\\Users\\n2006\\miniconda3\\envs\\plsb\\lib\\site-packages\\nonebot\\__init__.py'>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\nonebot\__init__.py", line 337, in run
get_driver().run(*args, **kwargs)
│ │ └ {'app': '__mp_main__:app'}
│ └ ()
└ <function get_driver at 0x000002082711C280>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\nonebot\drivers\fastapi.py", line 188, in run
uvicorn.run(
│ └ <function run at 0x0000020828179A60>
└ <module 'uvicorn' from 'C:\\Users\\n2006\\miniconda3\\envs\\plsb\\lib\\site-packages\\uvicorn\\__init__.py'>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\uvicorn\main.py", line 587, in run
server.run()
│ └ <function Server.run at 0x00000208281794C0>
└ <uvicorn.server.Server object at 0x00000208660E71F0>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\uvicorn\server.py", line 62, in run
return asyncio.run(self.serve(sockets=sockets))
│ │ │ │ └ None
│ │ │ └ <function Server.serve at 0x0000020828179550>
│ │ └ <uvicorn.server.Server object at 0x00000208660E71F0>
│ └ <function run at 0x0000020824F78040>
└ <module 'asyncio' from 'C:\\Users\\n2006\\miniconda3\\envs\\plsb\\lib\\asyncio\\__init__.py'>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
│ │ └ <coroutine object Server.serve at 0x00000208660C2340>
│ └ <function BaseEventLoop.run_until_complete at 0x000002082684B4C0>
└ <ProactorEventLoop running=True closed=False debug=False>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\asyncio\base_events.py", line 634, in run_until_complete
self.run_forever()
│ └ <function ProactorEventLoop.run_forever at 0x00000208268DB040>
└ <ProactorEventLoop running=True closed=False debug=False>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\asyncio\windows_events.py", line 321, in run_forever
super().run_forever()
File "C:\Users\n2006\miniconda3\envs\plsb\lib\asyncio\base_events.py", line 601, in run_forever
self._run_once()
│ └ <function BaseEventLoop._run_once at 0x000002082684DF70>
└ <ProactorEventLoop running=True closed=False debug=False>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\asyncio\base_events.py", line 1905, in _run_once
handle._run()
│ └ <function Handle._run at 0x00000208267EB430>
└ <Handle <TaskStepMethWrapper object at 0x00000208B0DDEFA0>()>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\asyncio\events.py", line 80, in _run
self._context.run(self._callback, *self._args)
│ │ │ │ │ └ <member '_args' of 'Handle' objects>
│ │ │ │ └ <Handle <TaskStepMethWrapper object at 0x00000208B0DDEFA0>()>
│ │ │ └ <member '_callback' of 'Handle' objects>
│ │ └ <Handle <TaskStepMethWrapper object at 0x00000208B0DDEFA0>()>
│ └ <member '_context' of 'Handle' objects>
└ <Handle <TaskStepMethWrapper object at 0x00000208B0DDEFA0>()>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\uvicorn\protocols\websockets\websockets_impl.py", line 255, in run_asgi
result = await self.app(self.scope, self.asgi_receive, self.asgi_send)
│ │ │ │ │ │ │ └ <function WebSocketProtocol.asgi_send at 0x00000208661260D0>
│ │ │ │ │ │ └ <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x0000020876DF0FD0>
│ │ │ │ │ └ <function WebSocketProtocol.asgi_receive at 0x0000020866126160>
│ │ │ │ └ <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x0000020876DF0FD0>
│ │ │ └ {'type': 'websocket', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'scheme': 'ws', 'server': ('1...
│ │ └ <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x0000020876DF0FD0>
│ └ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x00000208660EDD30>
└ <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x0000020876DF0FD0>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in __call__
return await self.app(scope, receive, send)
│ │ │ │ └ <bound method WebSocketProtocol.asgi_send of <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x0000...
│ │ │ └ <bound method WebSocketProtocol.asgi_receive of <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x0...
│ │ └ {'type': 'websocket', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'scheme': 'ws', 'server': ('1...
│ └ <fastapi.applications.FastAPI object at 0x00000208248B2F40>
└ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x00000208660EDD30>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\fastapi\applications.py", line 1054, in __call__
await super().__call__(scope, receive, send)
│ │ └ <bound method WebSocketProtocol.asgi_send of <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x0000...
│ └ <bound method WebSocketProtocol.asgi_receive of <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x0...
└ {'type': 'websocket', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'scheme': 'ws', 'server': ('1...
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\starlette\applications.py", line 123, in __call__
await self.middleware_stack(scope, receive, send)
│ │ │ │ └ <bound method WebSocketProtocol.asgi_send of <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x0000...
│ │ │ └ <bound method WebSocketProtocol.asgi_receive of <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x0...
│ │ └ {'type': 'websocket', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'scheme': 'ws', 'server': ('1...
│ └ <starlette.middleware.errors.ServerErrorMiddleware object at 0x00000208661290A0>
└ <fastapi.applications.FastAPI object at 0x00000208248B2F40>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\starlette\middleware\errors.py", line 151, in __call__
await self.app(scope, receive, send)
│ │ │ │ └ <bound method WebSocketProtocol.asgi_send of <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x0000...
│ │ │ └ <bound method WebSocketProtocol.asgi_receive of <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x0...
│ │ └ {'type': 'websocket', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'scheme': 'ws', 'server': ('1...
│ └ <nonebot_plugin_filehost.HostContextVarMiddleware object at 0x00000208660DDE20>
└ <starlette.middleware.errors.ServerErrorMiddleware object at 0x00000208661290A0>
> File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\nonebot_plugin_filehost\__init__.py", line 52, in __call__
request_info = RequestScopeInfo.parse_obj(scope)
│ │ └ {'type': 'websocket', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'scheme': 'ws', 'server': ('1...
│ └ <classmethod object at 0x0000020827021AF0>
└ <class 'nonebot_plugin_filehost.models.RequestScopeInfo'>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\pydantic\main.py", line 1118, in parse_obj
return cls.model_validate(obj)
│ │ └ {'type': 'websocket', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'scheme': 'ws', 'server': ('1...
│ └ <classmethod object at 0x0000020827021C40>
└ <class 'nonebot_plugin_filehost.models.RequestScopeInfo'>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\pydantic\main.py", line 551, in model_validate
return cls.__pydantic_validator__.validate_python(
│ │ └ <method 'validate_python' of 'pydantic_core._pydantic_core.SchemaValidator' objects>
│ └ SchemaValidator(title="RequestScopeInfo", validator=Model(
│ ModelValidator {
│ revalidate: Never,
│ validator:...
└ <class 'nonebot_plugin_filehost.models.RequestScopeInfo'>
TypeError: validate() takes 2 positional arguments but 3 were given
2025-01-06 08:18:27.476 | INFO | uvicorn:asgi_send:287 - ('192.168.152.176', 49559) - "WebSocket /onebot/v11/ws" [accepted]
2025-01-06 08:18:27.478 | INFO | nonebot:log:336 - OneBot V11 | Bot 3474854213 connected
2025-01-06 08:18:27.479 | WARNING | nonebot:log:336 - OneBot V11 | WebSocket for Bot 2964939203 closed by peer
2025-01-06 08:18:27.490 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 13...
2025-01-06 08:18:27.521 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 10...
2025-01-06 08:18:27.527 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 10...
2025-01-06 08:18:27.541 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 10...
2025-01-06 08:18:27.591 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 8...
2025-01-06 08:18:27.607 | DEBUG | nonebot:handle_event:601 - Checking for matchers completed
2025-01-06 08:18:29.041 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 10...
2025-01-06 08:18:29.119 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 13...
2025-01-06 08:18:29.147 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 13...
2025-01-06 08:18:29.184 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 99...
2025-01-06 08:18:29.198 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 10...
2025-01-06 08:18:29.309 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 10...
2025-01-06 08:18:29.310 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 10...
2025-01-06 08:18:29.310 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 10...
2025-01-06 08:18:29.311 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 10...
2025-01-06 08:18:29.312 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 10...
2025-01-06 08:18:29.328 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 20...
2025-01-06 08:18:29.329 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 20...
2025-01-06 08:18:29.331 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 20...
2025-01-06 08:18:29.337 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 8...
2025-01-06 08:18:29.343 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 8...
2025-01-06 08:18:30.682 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 2...
2025-01-06 08:18:30.685 | INFO | websockets:handler:264 - connection closed
2025-01-06 08:18:30.686 | ERROR | nonebot_plugin_filehost:__call__:55 - Scope scope={'type': 'websocket', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'scheme': 'ws', 'server': ('192.168.152.176', 8080), 'client': ('192.168.152.176', 49560), 'root_path': '', 'path': '/onebot/v11/ws', 'raw_path': b'/onebot/v11/ws', 'query_string': b'', 'headers': [(b'x-self-id', b'2816858130'), (b'authorization', b'Bearer'), (b'x-client-role', b'Universal'), (b'user-agent', b'LLOneBot/4.6.3'), (b'sec-websocket-version', b'13'), (b'sec-websocket-key', b'wjTPb4SSTT3sYN7Mv0P1yw=='), (b'connection', b'Upgrade'), (b'upgrade', b'websocket'), (b'host', b'192.168.152.176:8080')], 'subprotocols': [], 'state': {}, 'extensions': {'websocket.http.response': {}}, 'app': <fastapi.applications.FastAPI object at 0x00000208248B2F40>} deserialize failed:
Traceback (most recent call last):
File "C:\Users\n2006\Desktop\bot\Pallas-Bot\bot.py", line 36, in <module>
nonebot.run(app="__mp_main__:app")
│ └ <function run at 0x0000020827BDAF70>
└ <module 'nonebot' from 'C:\\Users\\n2006\\miniconda3\\envs\\plsb\\lib\\site-packages\\nonebot\\__init__.py'>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\nonebot\__init__.py", line 337, in run
get_driver().run(*args, **kwargs)
│ │ └ {'app': '__mp_main__:app'}
│ └ ()
└ <function get_driver at 0x000002082711C280>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\nonebot\drivers\fastapi.py", line 188, in run
uvicorn.run(
│ └ <function run at 0x0000020828179A60>
└ <module 'uvicorn' from 'C:\\Users\\n2006\\miniconda3\\envs\\plsb\\lib\\site-packages\\uvicorn\\__init__.py'>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\uvicorn\main.py", line 587, in run
server.run()
│ └ <function Server.run at 0x00000208281794C0>
└ <uvicorn.server.Server object at 0x00000208660E71F0>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\uvicorn\server.py", line 62, in run
return asyncio.run(self.serve(sockets=sockets))
│ │ │ │ └ None
│ │ │ └ <function Server.serve at 0x0000020828179550>
│ │ └ <uvicorn.server.Server object at 0x00000208660E71F0>
│ └ <function run at 0x0000020824F78040>
└ <module 'asyncio' from 'C:\\Users\\n2006\\miniconda3\\envs\\plsb\\lib\\asyncio\\__init__.py'>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
│ │ └ <coroutine object Server.serve at 0x00000208660C2340>
│ └ <function BaseEventLoop.run_until_complete at 0x000002082684B4C0>
└ <ProactorEventLoop running=True closed=False debug=False>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\asyncio\base_events.py", line 634, in run_until_complete
self.run_forever()
│ └ <function ProactorEventLoop.run_forever at 0x00000208268DB040>
└ <ProactorEventLoop running=True closed=False debug=False>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\asyncio\windows_events.py", line 321, in run_forever
super().run_forever()
File "C:\Users\n2006\miniconda3\envs\plsb\lib\asyncio\base_events.py", line 601, in run_forever
self._run_once()
│ └ <function BaseEventLoop._run_once at 0x000002082684DF70>
└ <ProactorEventLoop running=True closed=False debug=False>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\asyncio\base_events.py", line 1905, in _run_once
handle._run()
│ └ <function Handle._run at 0x00000208267EB430>
└ <Handle <TaskStepMethWrapper object at 0x0000020877E84F10>()>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\asyncio\events.py", line 80, in _run
self._context.run(self._callback, *self._args)
│ │ │ │ │ └ <member '_args' of 'Handle' objects>
│ │ │ │ └ <Handle <TaskStepMethWrapper object at 0x0000020877E84F10>()>
│ │ │ └ <member '_callback' of 'Handle' objects>
│ │ └ <Handle <TaskStepMethWrapper object at 0x0000020877E84F10>()>
│ └ <member '_context' of 'Handle' objects>
└ <Handle <TaskStepMethWrapper object at 0x0000020877E84F10>()>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\uvicorn\protocols\websockets\websockets_impl.py", line 255, in run_asgi
result = await self.app(self.scope, self.asgi_receive, self.asgi_send)
│ │ │ │ │ │ │ └ <function WebSocketProtocol.asgi_send at 0x00000208661260D0>
│ │ │ │ │ │ └ <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x00000208DEAC0370>
│ │ │ │ │ └ <function WebSocketProtocol.asgi_receive at 0x0000020866126160>
│ │ │ │ └ <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x00000208DEAC0370>
│ │ │ └ {'type': 'websocket', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'scheme': 'ws', 'server': ('1...
│ │ └ <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x00000208DEAC0370>
│ └ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x00000208660EDD30>
└ <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x00000208DEAC0370>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in __call__
return await self.app(scope, receive, send)
│ │ │ │ └ <bound method WebSocketProtocol.asgi_send of <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x0000...
│ │ │ └ <bound method WebSocketProtocol.asgi_receive of <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x0...
│ │ └ {'type': 'websocket', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'scheme': 'ws', 'server': ('1...
│ └ <fastapi.applications.FastAPI object at 0x00000208248B2F40>
└ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x00000208660EDD30>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\fastapi\applications.py", line 1054, in __call__
await super().__call__(scope, receive, send)
│ │ └ <bound method WebSocketProtocol.asgi_send of <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x0000...
│ └ <bound method WebSocketProtocol.asgi_receive of <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x0...
└ {'type': 'websocket', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'scheme': 'ws', 'server': ('1...
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\starlette\applications.py", line 123, in __call__
await self.middleware_stack(scope, receive, send)
│ │ │ │ └ <bound method WebSocketProtocol.asgi_send of <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x0000...
│ │ │ └ <bound method WebSocketProtocol.asgi_receive of <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x0...
│ │ └ {'type': 'websocket', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'scheme': 'ws', 'server': ('1...
│ └ <starlette.middleware.errors.ServerErrorMiddleware object at 0x00000208661290A0>
└ <fastapi.applications.FastAPI object at 0x00000208248B2F40>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\starlette\middleware\errors.py", line 151, in __call__
await self.app(scope, receive, send)
│ │ │ │ └ <bound method WebSocketProtocol.asgi_send of <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x0000...
│ │ │ └ <bound method WebSocketProtocol.asgi_receive of <uvicorn.protocols.websockets.websockets_impl.WebSocketProtocol object at 0x0...
│ │ └ {'type': 'websocket', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'scheme': 'ws', 'server': ('1...
│ └ <nonebot_plugin_filehost.HostContextVarMiddleware object at 0x00000208660DDE20>
└ <starlette.middleware.errors.ServerErrorMiddleware object at 0x00000208661290A0>
> File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\nonebot_plugin_filehost\__init__.py", line 52, in __call__
request_info = RequestScopeInfo.parse_obj(scope)
│ │ └ {'type': 'websocket', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'scheme': 'ws', 'server': ('1...
│ └ <classmethod object at 0x0000020827021AF0>
└ <class 'nonebot_plugin_filehost.models.RequestScopeInfo'>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\pydantic\main.py", line 1118, in parse_obj
return cls.model_validate(obj)
│ │ └ {'type': 'websocket', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'scheme': 'ws', 'server': ('1...
│ └ <classmethod object at 0x0000020827021C40>
└ <class 'nonebot_plugin_filehost.models.RequestScopeInfo'>
File "C:\Users\n2006\miniconda3\envs\plsb\lib\site-packages\pydantic\main.py", line 551, in model_validate
return cls.__pydantic_validator__.validate_python(
│ │ └ <method 'validate_python' of 'pydantic_core._pydantic_core.SchemaValidator' objects>
│ └ SchemaValidator(title="RequestScopeInfo", validator=Model(
│ ModelValidator {
│ revalidate: Never,
│ validator:...
└ <class 'nonebot_plugin_filehost.models.RequestScopeInfo'>
TypeError: validate() takes 2 positional arguments but 3 were given
2025-01-06 08:18:30.708 | INFO | uvicorn:asgi_send:287 - ('192.168.152.176', 49560) - "WebSocket /onebot/v11/ws" [accepted]
2025-01-06 08:18:30.711 | INFO | nonebot:log:336 - OneBot V11 | Bot 2816858130 connected
2025-01-06 08:18:30.712 | WARNING | nonebot:log:336 - OneBot V11 | WebSocket for Bot 3474854213 closed by peer
2025-01-06 08:18:30.721 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 12...
2025-01-06 08:18:30.743 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 12...
2025-01-06 08:18:30.787 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 99...
2025-01-06 08:18:30.901 | INFO | nonebot:simple_run:846 - Matcher(type='message', module=src.plugins.repeater, lineno=22) running complete
2025-01-06 08:18:30.907 | INFO | repeater:_:115 - bot [1545126956] ready to send [[CQ:image,file=ABED2733C61389C] to group [741907046]
2025-01-06 08:18:30.909 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 13...
2025-01-06 08:18:30.949 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 8...
2025-01-06 08:18:30.952 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 13...
2025-01-06 08:18:30.953 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 12...
2025-01-06 08:18:30.992 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 8...
2025-01-06 08:18:31.000 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 5...
2025-01-06 08:18:31.035 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 13...
2025-01-06 08:18:31.040 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 5...
2025-01-06 08:18:31.041 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 5...
2025-01-06 08:18:31.042 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 5...
2025-01-06 08:18:31.043 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 5...
2025-01-06 08:18:31.050 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 13...
2025-01-06 08:18:31.050 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 5...
2025-01-06 08:18:31.057 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 8...
2025-01-06 08:18:31.058 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 8...
2025-01-06 08:18:31.062 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 5...
2025-01-06 08:18:31.068 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 5...
2025-01-06 08:18:31.071 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 50...
2025-01-06 08:18:31.072 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 5...
2025-01-06 08:18:31.074 | DEBUG | nonebot:handle_event:601 - Checking for matchers completed
2025-01-06 08:18:31.079 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 50...
2025-01-06 08:18:31.080 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 50...
2025-01-06 08:18:31.086 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 13...
2025-01-06 08:18:31.087 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 13...
2025-01-06 08:18:31.088 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 13...
2025-01-06 08:18:31.089 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 8...
2025-01-06 08:18:31.109 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 5...
2025-01-06 08:18:31.111 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 12...
2025-01-06 08:18:31.117 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 99...
2025-01-06 08:18:31.117 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 99...
2025-01-06 08:18:31.120 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 12...
2025-01-06 08:18:31.139 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 12...
2025-01-06 08:18:31.139 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 12...
2025-01-06 08:18:31.140 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 12...
2025-01-06 08:18:31.142 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 5...
2025-01-06 08:18:31.147 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 5...
2025-01-06 08:18:31.152 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 5...
2025-01-06 08:18:31.165 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 5...
2025-01-06 08:18:31.168 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 10...
2025-01-06 08:18:31.169 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 10...
2025-01-06 08:18:31.201 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 16...
2025-01-06 08:18:31.203 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 8...
2025-01-06 08:18:31.204 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 8...
2025-01-06 08:18:31.205 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 8...
2025-01-06 08:18:31.207 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 8...
2025-01-06 08:18:31.207 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 8...
2025-01-06 08:18:31.265 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 4...
2025-01-06 08:18:31.353 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 4...
2025-01-06 08:18:31.435 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 4...
2025-01-06 08:18:31.610 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 4...
2025-01-06 08:18:31.697 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 2...
2025-01-06 08:18:31.698 | DEBUG | nonebot:handle_event:573 - Checking for matchers in priority 14...
2025-01-06 08:18:31.700 | INFO | websockets:handler:264 - connection closed
首先有一个问题,看到你的日志里有 websockets 的 connection closed ,这个是正向 ws 连接,同时还有 uvicorn 的 ws accepted,你这是同时使用了正向 ws 和反向 ws ?要不把你的 .env 配置发一下?
另外日志十分混乱,无法判断是什么连接断开了,一个 bot 账号同时只能有一个连接。
env配置文件中并无正向ws相关配置,有没有可能是filehost那个插件发起的(插件缝的有点多)
filehost并不会发起ws,你不如先去掉点插件看看还有没有问题
@aknyzsd 现在还有问题吗?
@aknyzsd 现在还有问题吗?
依然存在且复现原因未知,不过貌似在前端账号较少时触发概率会低不少
如果能复现出稳定原因的话欢迎 reopen