RockChinQ / QChatGPT

😎高稳定性、🧩支持扩展、🦄多模态的 ChatGPT QQ / QQ频道 / One Bot 机器人🤖 | 支持 OpenAI GPT、Claude、Gemini Pro、DeepSeek、Moonshot(Kimi)、gpt4free、One API、Ollama 的 QQ / QQ频道 / OneBot 机器人 / Agent 平台
https://q.rkcn.top
GNU Affero General Public License v3.0
4.32k stars 332 forks source link

[Bug]: RuntimeError: set_wakeup_fd only works in main thread of the main interpreter #426

Closed yumuzhihan closed 1 year ago

yumuzhihan commented 1 year ago

部署方式

手动部署

系统环境

Ubuntu 22.04 64位

Python环境

Python 3.10.6

异常情况

配置好config.py后,运行python3 main.py,出现[ERROR] : 捕捉到未知异常:set_wakeup_fd only works in main thread of the main interpreter, 请前往 https://github.com/RockChinQ/QChatGPT/issues 查找或提issue

报错信息

`root@QBot:~/QChatBot/QChatGPT# python3 main.py [2023-04-22 18:40:08.836] main.py (73) - [INFO] : 检查config模块完整性. [2023-04-22 18:40:08.837] main.py (101) - [INFO] : 检查tips模块完整性. 正在更新依赖库,请等待... 这个操作不是必须的,如果不想更新,请在config.py中将upgrade_dependencies设置为False WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip. Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue. To avoid this problem you can invoke Python with '-m pip' instead of running pip directly. Looking in indexes: https://pypi.douban.com/simple/ Requirement already satisfied: openai in /usr/local/lib/python3.10/dist-packages (0.27.4) Requirement already satisfied: Pillow in /usr/local/lib/python3.10/dist-packages (9.5.0) Requirement already satisfied: requests>=2.20 in /usr/local/lib/python3.10/dist-packages (from openai) (2.28.2) Requirement already satisfied: tqdm in /usr/local/lib/python3.10/dist-packages (from openai) (4.65.0) Requirement already satisfied: aiohttp in /usr/local/lib/python3.10/dist-packages (from openai) (3.8.4) Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests>=2.20->openai) (3.0.1) Requirement already satisfied: idna<4,>=2.5 in /usr/lib/python3/dist-packages (from requests>=2.20->openai) (3.3) Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests>=2.20->openai) (1.26.14) Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests>=2.20->openai) (2022.12.7) Requirement already satisfied: attrs>=17.3.0 in /usr/lib/python3/dist-packages (from aiohttp->openai) (21.2.0) Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai) (6.0.4) Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai) (4.0.2) Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai) (1.9.1) Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai) (1.3.3) Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai) (1.3.1) WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv Database initialized. [2023-04-22 18:40:11.141] keymgr.py (61) - [INFO] : 使用api-key:default [2023-04-22 18:40:11.142] manager.py (30) - [INFO] : 文字总使用量:0 [2023-04-22 18:40:11.145] manager.py (206) - [INFO] : 加载禁用列表: person: [2854196310], group: [204785790, 691226829] [2023-04-22 18:40:11.145] host.py (90) - [INFO] : 加载插件 [2023-04-22 18:40:11.147] host.py (107) - [INFO] : 初始化插件 [2023-04-22 18:40:11.213] main.py (246) - [ERROR] : 捕捉到未知异常:set_wakeup_fd only works in main thread of the main interpreter, 请前往 https://github.com/RockChinQ/QChatGPT/issues 查找或提issue Exception in thread Thread-2 (run_bot_wrapper): Traceback (most recent call last): File "/usr/lib/python3.10/asyncio/unix_events.py", line 105, in add_signal_handler signal.set_wakeup_fd(self._csock.fileno()) ValueError: set_wakeup_fd only works in main thread of the main interpreter

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/usr/lib/python3.10/threading.py", line 953, in run self._target(*self._args, self._kwargs) File "/root/QChatBot/QChatGPT/main.py", line 249, in run_bot_wrapper raise e File "/root/QChatBot/QChatGPT/main.py", line 211, in run_bot_wrapper qqbot.adapter.run_sync() File "/root/QChatBot/QChatGPT/pkg/qqbot/sources/yirimirai.py", line 112, in run_sync self.bot.run() File "/usr/local/lib/python3.10/dist-packages/mirai/bot.py", line 197, in run MiraiRunner(self).run(host, port, asgi_server, kwargs) File "/usr/local/lib/python3.10/dist-packages/mirai/bot.py", line 255, in run if not asgi_serve( File "/usr/local/lib/python3.10/dist-packages/mirai/asgi.py", line 211, in asgi_serve asyncio.run(serve(app, config), debug=True) File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete return future.result() File "/usr/local/lib/python3.10/dist-packages/hypercorn/asyncio/init.py", line 49, in serve await worker_serve( File "/usr/local/lib/python3.10/dist-packages/hypercorn/asyncio/run.py", line 67, in worker_serve loop.add_signal_handler(getattr(signal, signal_name), _signal_handler) File "/usr/lib/python3.10/asyncio/unix_events.py", line 107, in add_signal_handler raise RuntimeError(str(exc)) RuntimeError: set_wakeup_fd only works in main thread of the main interpreter`

RockChinQ commented 1 year ago

273