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

重连机制失效? #64

Open
PCD-01 opened this issue Jun 26, 2024 · 2 comments
Open

重连机制失效? #64

PCD-01 opened this issue Jun 26, 2024 · 2 comments

Comments

@PCD-01
Copy link

PCD-01 commented Jun 26, 2024

错误信息在下一条comment(隐私信息已隐藏),在断网后重连无法正常接收到kook方向的信息
`import nonebot
from nonebot.adapters.kaiheila import adapter as KaiheilaAdapter

nonebot.init()

driver = nonebot.get_driver()
driver.register_adapter(KaiheilaAdapter)

nonebot.load_plugin("Bot")

if name == "main":
nonebot.run()`
以上为引入adapter的源代码

@PCD-01
Copy link
Author

PCD-01 commented Jun 26, 2024

Jun 26 05:59:12 nb[804586]: 06-26 05:59:12 [ERROR] nonebot | Kaiheila | Error while process data from websocketwss://ws.kaiheila.cn/gateway?compress=0&token=. Trying to reconnect...
Jun 26 05:59:12 nb[804586]: Traceback (most recent call last):
Jun 26 05:59:12 nb[804586]: File "/Bot/.venv/lib/python3.11/site-packages/websockets/legacy/protocol.py", line 1301, in close_connection
Jun 26 05:59:12 nb[804586]: await self.transfer_data_task
Jun 26 05:59:12 nb[804586]: File "/Bot/.venv/lib/python3.11/site-packages/websockets/legacy/protocol.py", line 963, in transfer_data
Jun 26 05:59:12 nb[804586]: message = await self.read_message()
Jun 26 05:59:12 nb[804586]: File "/Bot/.venv/lib/python3.11/site-packages/websockets/legacy/protocol.py", line 1033, in read_message
Jun 26 05:59:12 nb[804586]: frame = await self.read_data_frame(max_size=self.max_size)
Jun 26 05:59:12 nb[804586]: File "/Bot/.venv/lib/python3.11/site-packages/websockets/legacy/protocol.py", line 1108, in read_data_frame
Jun 26 05:59:12 nb[804586]: frame = await self.read_frame(max_size)
Jun 26 05:59:12 nb[804586]: File "/Bot/.venv/lib/python3.11/site-packages/websockets/legacy/protocol.py", line 1165, in read_frame
Jun 26 05:59:12 nb[804586]: frame = await Frame.read(
Jun 26 05:59:12 nb[804586]: File "/Bot/.venv/lib/python3.11/site-packages/websockets/legacy/framing.py", line 68, in read
Jun 26 05:59:12 nb[804586]: data = await reader(2)
Jun 26 05:59:12 nb[804586]: File "/usr/lib/python3.11/asyncio/streams.py", line 728, in readexactly
Jun 26 05:59:12 nb[804586]: await self._wait_for_data('readexactly')
Jun 26 05:59:12 nb[804586]: File "/usr/lib/python3.11/asyncio/streams.py", line 522, in _wait_for_data
Jun 26 05:59:12 nb[804586]: await self._waiter
Jun 26 05:59:12 nb[804586]: asyncio.exceptions.CancelledError
Jun 26 05:59:12 nb[804586]: The above exception was the direct cause of the following exception:
Jun 26 05:59:12 nb[804586]: Traceback (most recent call last):
Jun 26 05:59:12 nb[804586]: File "/Bot/.venv/lib/python3.11/site-packages/nonebot/drivers/websockets.py", line 51, in decorator
Jun 26 05:59:12 nb[804586]: return await func(args, **kwargs)
Jun 26 05:59:12 nb[804586]: File "/Bot/.venv/lib/python3.11/site-packages/nonebot/drivers/websockets.py", line 102, in receive
Jun 26 05:59:12 nb[804586]: return await self.websocket.recv()
Jun 26 05:59:12 nb[804586]: File "/Bot/.venv/lib/python3.11/site-packages/websockets/legacy/protocol.py", line 568, in recv
Jun 26 05:59:12 nb[804586]: await self.ensure_open()
Jun 26 05:59:12 nb[804586]: File "/Bot/.venv/lib/python3.11/site-packages/websockets/legacy/protocol.py", line 948, in ensure_open
Jun 26 05:59:12 nb[804586]: raise self.connection_closed_exc()
Jun 26 05:59:12 nb[804586]: websockets.exceptions.ConnectionClosedError: sent 1011 (internal error) keepalive ping timeout; no close frame received
Jun 26 05:59:12 nb[804586]: During handling of the above exception, another exception occurred:
Jun 26 05:59:12 nb[804586]: Traceback (most recent call last):
Jun 26 05:59:12 nb[804586]: File "", line 15, in
Jun 26 05:59:12 nb[804586]: File "/Bot/.venv/lib/python3.11/site-packages/nonebot/init.py", line 334, in run
Jun 26 05:59:12 nb[804586]: get_driver().run(args, **kwargs)
Jun 26 05:59:12 nb[804586]: File "/Bot/.venv/lib/python3.11/site-packages/nonebot/drivers/none.py", line 56, in run
Jun 26 05:59:12 nb[804586]: loop.run_until_complete(self._serve())
Jun 26 05:59:12 nb[804586]: File "/usr/lib/python3.11/asyncio/base_events.py", line 640, in run_until_complete
Jun 26 05:59:12 nb[804586]: self.run_forever()
Jun 26 05:59:12 nb[804586]: File "/usr/lib/python3.11/asyncio/base_events.py", line 607, in run_forever
Jun 26 05:59:12 nb[804586]: self._run_once()
Jun 26 05:59:12 nb[804586]: File "/usr/lib/python3.11/asyncio/base_events.py", line 1922, in _run_once
Jun 26 05:59:12 nb[804586]: handle._run()
Jun 26 05:59:12 nb[804586]: File "/usr/lib/python3.11/asyncio/events.py", line 80, in _run
Jun 26 05:59:12 nb[804586]: self._context.run(self._callback, self._args)
Jun 26 05:59:12 nb[804586]: > File "/Bot/.venv/lib/python3.11/site-packages/nonebot/adapters/kaiheila/adapter.py", line 258, in _forward_ws
Jun 26 05:59:12 nb[804586]: data = await ws.receive()
Jun 26 05:59:12 nb[804586]: File "/Bot/.venv/lib/python3.11/site-packages/nonebot/drivers/websockets.py", line 53, in decorator
Jun 26 05:59:12 nb[804586]: raise WebSocketClosed(e.code, e.reason)
Jun 26 05:59:12 nb[804586]: nonebot.exception.WebSocketClosed: WebSocketClosed(code=1006)
Jun 26 05:59:15 nb[804586]: 06-26 05:59:15 [DEBUG] nonebot | Kaiheila | Calling API gateway/index
Jun 26 05:59:15 nb[804586]: 06-26 05:59:15 [DEBUG] nonebot | Kaiheila | API result {'code': 0, 'message': '操作成功', 'data': {'url': 'wss://ws.kaiheila.cn/gateway?compress=0&token='}}
Jun 26 05:59:15 nb[804586]: 06-26 05:59:15 [DEBUG] nonebot | Kaiheila | WebSocket Connection to wss://ws.kaiheila.cn/gateway?compress=0&token= established
Jun 26 05:59:15 nb[804586]: 06-26 05:59:15 [DEBUG] nonebot | Kaiheila | Calling API user/me
Jun 26 05:59:15 nb[804586]: 06-26 05:59:15 [DEBUG] nonebot | Kaiheila | API result {'code': 0, 'message': '操作成功', 'data': {'id': '', 'username': '', 'identify_num': '', 'online': True, 'os': 'Websocket', 'status': 0, 'avatar': 'https://img.kaiheila.cn/assets/2024-05/.jpg?x-oss-process=style/icon', 'vip_avatar': 'https://img.kaiheila.cn/assets/2024-05/.jpg?x-oss-process=style/icon', 'banner': '', 'nickname': '', 'roles': [], 'is_vip': False, 'vip_amp': False, 'bot': True, 'nameplate': [], 'bot_status': 0, 'tag_info': {'color': '#0096FF', 'bg_color': '#0096FF33', 'text': '机器人'}, 'mobile_verified': True, 'is_sys': False, 'client_id': '', 'verified': False, 'mobile_prefix': '86', 'mobile': '
*', 'privacy_game_activity': 0, 'privacy_music_activity': 0, 'enable_desktop_notification': True, 'audio_setting': '', 'auto_exit_audio_channel': False, 'created_guild': False, 'experience_improve': True, 'friend_setting': {'all': True}, 'chat_setting': '1', 'invited_count': 0, 'need_guide': False, 'accompaniment': True, 'mobile_not_notify': False, 'mobile_notify_setting': 2, 'new_join': [], 'i18n': False, 'cert_name': '', 'cert_code': '', 'audit': {'audit_username': '', 'audit_desc': '', 'audit_avatar': '', 'audit_banner': '', 'audit_username_status': 0, 'audit_desc_status': 0, 'audit_avatar_status': 0, 'audit_banner_status': 0}, 'has_new_policy': False}}
Jun 26 05:59:15 nb[804586]: 06-26 05:59:15 [INFO] nonebot | Kaiheila | Bot connected

@PCD-01
Copy link
Author

PCD-01 commented Jun 26, 2024

adapter版本已经是最新版本,在出现这个bug后无法自动恢复正常(表现为无法收到任何消息)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant