generated from yanyongyu/python-poetry-template
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Description
系统环境
Linux johnrichard-Inspiron-5391 6.8.0-40-generic #40-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 5 10:34:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux问题描述
原先我是在我自己项目里遇到了这个问题,Amrita,有一个运行了六个小时都没有结束的Action,后面我团队的Member反馈自己在本地进行开发时也出现了程序无法退出的问题,我已排除了是我项目CLI的问题,因为创建一个NoneBot2项目并添加依赖nonebot-plugin-orm[default],使用任意会操作数据库的指令都将导致程序无法退出,下面是我用py-spy的dump
dump
Thread 0x7B2B1EFF8740 (active): "MainThread"
_shutdown (threading.py:1567)
Locals:
tlock: <_thread.lock at 0x7b2b1e04da80>
locks: [<_thread.lock at 0x7b2b0e443e80>]
lock: <_thread.lock at 0x7b2b0e443e80>
Thread 0x7B2B1C2006C0 (active): "loguru-writer-5"
_recv (multiprocessing/connection.py:379)
Arguments:
self: <Connection at 0x7b2b1c4850c0>
size: 4
read: <builtin_function_or_method at 0x7b2b1eff2160>
Locals:
buf: <_io.BytesIO at 0x7b2b1c2e84f0>
handle: 5
remaining: 4
_recv_bytes (multiprocessing/connection.py:414)
Arguments:
self: <Connection at 0x7b2b1c4850c0>
maxsize: None
recv_bytes (multiprocessing/connection.py:216)
Arguments:
self: <Connection at 0x7b2b1c4850c0>
maxlength: None
get (multiprocessing/queues.py:365)
Arguments:
self: <SimpleQueue at 0x7b2b1c485210>
_queued_writer (loguru/_handler.py:300)
Arguments:
self: <Handler at 0x7b2b1c484c40>
Locals:
message: "01-01 13:54:39 [WARNING] nonebot | Legacy project format found! Upgrade with `nb upgrade-format`.\n"
queue: <SimpleQueue at 0x7b2b1c485210>
lock: <_thread.lock at 0x7b2b1c4b9ec0>
run (threading.py:953)
Arguments:
self: <Thread at 0x7b2b1c4862f0>
_bootstrap_inner (threading.py:1016)
Arguments:
self: <Thread at 0x7b2b1c4862f0>
_bootstrap (threading.py:973)
Arguments:
self: <Thread at 0x7b2b1c4862f0>
Thread 0x7B2B0E2006C0 (active): "Thread-1 (_connection_worker_thread)"
_connection_worker_thread (aiosqlite/core.py:59)
Arguments:
tx: <_queue.SimpleQueue at 0x7b2b0e45d490>
Locals:
future: <_asyncio.Future at 0x7b2b0e5ec510>
function: <functools.partial at 0x7b2b0e4ee110>
result: None
run (threading.py:953)
Arguments:
self: <Thread at 0x7b2b0e430910>
_bootstrap_inner (threading.py:1016)
Arguments:
self: <Thread at 0x7b2b0e430910>
_bootstrap (threading.py:973)
Arguments:
self: <Thread at 0x7b2b0e430910>
(amrita) root@johnrichard-Inspiron-5391:/home/johnrichard/LiteSuggarDEV/Amrita# uv run py-spy dump --pid 23353 --locals
warning: The `tool.uv.dev-dependencies` field (used in `pyproject.toml`) is deprecated and will be removed in a future release; use `dependency-groups.dev` instead
Process 23353: /home/johnrichard/LiteSuggarDEV/Amrita/.venv/bin/python3 /home/johnrichard/LiteSuggarDEV/Amrita/.venv/bin/amrita orm check
Python v3.10.16 (/home/johnrichard/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/bin/python3.10)
Thread 0x7B2B1EFF8740 (active): "MainThread"
_shutdown (threading.py:1567)
Locals:
tlock: <_thread.lock at 0x7b2b1e04da80>
locks: [<_thread.lock at 0x7b2b0e443e80>]
lock: <_thread.lock at 0x7b2b0e443e80>
Thread 0x7B2B1C2006C0 (active): "loguru-writer-5"
_recv (multiprocessing/connection.py:379)
Arguments:
self: <Connection at 0x7b2b1c4850c0>
size: 4
read: <builtin_function_or_method at 0x7b2b1eff2160>
Locals:
buf: <_io.BytesIO at 0x7b2b1c2e84f0>
handle: 5
remaining: 4
_recv_bytes (multiprocessing/connection.py:414)
Arguments:
self: <Connection at 0x7b2b1c4850c0>
maxsize: None
recv_bytes (multiprocessing/connection.py:216)
Arguments:
self: <Connection at 0x7b2b1c4850c0>
maxlength: None
get (multiprocessing/queues.py:365)
Arguments:
self: <SimpleQueue at 0x7b2b1c485210>
_queued_writer (loguru/_handler.py:300)
Arguments:
self: <Handler at 0x7b2b1c484c40>
Locals:
message: "01-01 13:54:39 [WARNING] nonebot | Legacy project format found! Upgrade with `nb upgrade-format`.\n"
queue: <SimpleQueue at 0x7b2b1c485210>
lock: <_thread.lock at 0x7b2b1c4b9ec0>
run (threading.py:953)
Arguments:
self: <Thread at 0x7b2b1c4862f0>
_bootstrap_inner (threading.py:1016)
Arguments:
self: <Thread at 0x7b2b1c4862f0>
_bootstrap (threading.py:973)
Arguments:
self: <Thread at 0x7b2b1c4862f0>
Thread 0x7B2B0E2006C0 (active): "Thread-1 (_connection_worker_thread)"
_connection_worker_thread (aiosqlite/core.py:59)
Arguments:
tx: <_queue.SimpleQueue at 0x7b2b0e45d490>
Locals:
future: <_asyncio.Future at 0x7b2b0e5ec510>
function: <functools.partial at 0x7b2b0e4ee110>
result: None
run (threading.py:953)
Arguments:
self: <Thread at 0x7b2b0e430910>
_bootstrap_inner (threading.py:1016)
Arguments:
self: <Thread at 0x7b2b0e430910>
_bootstrap (threading.py:973)
Arguments:
self: <Thread at 0x7b2b0e430910>控制台截图
复现步骤
# 创建NoneBot2项目
...
# 安装orm插件
nb plugin install nonebot-plugin-orm
# 安装default extra(省略添加其他内容到项目依赖的过程
uv add nonebot-plugin-orm[default]
# 运行
uv run nb orm upgrade
# 此处已经完成了数据库迁移操作,但是程序没有退出项目依赖版本
aiosqlite==0.22.1
alembic==1.17.2
annotated-doc==0.0.4
annotated-types==0.7.0
anyio==4.12.0
click==8.3.1
exceptiongroup==1.3.1
fastapi==0.128.0
greenlet==3.3.0
h11==0.16.0
httptools==0.7.1
idna==3.11
loguru==0.7.3
Mako==1.3.10
MarkupSafe==3.0.3
msgpack==1.1.2
multidict==6.7.0
nonebot-adapter-onebot==2.4.6
nonebot-plugin-localstore==0.7.4
nonebot-plugin-orm==0.8.2
nonebot2==2.4.4
nonestorage==0.1.0
propcache==0.4.1
pydantic==2.12.5
pydantic_core==2.41.5
pygtrie==2.5.0
python-dotenv==1.2.1
PyYAML==6.0.3
SQLAlchemy==2.0.45
starlette==0.50.0
typing-inspection==0.4.2
typing_extensions==4.15.0
uvicorn==0.40.0
uvloop==0.22.1
watchfiles==1.1.1
websockets==15.0.1
yarl==1.22.0Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels