Skip to content

修复:WebUI环境检查因Asyncio Windows兼容性而失败并且无任何错误提示#901

Open
Jaryan-luck wants to merge 2 commits into
NanmiCoder:mainfrom
Jaryan-luck:main
Open

修复:WebUI环境检查因Asyncio Windows兼容性而失败并且无任何错误提示#901
Jaryan-luck wants to merge 2 commits into
NanmiCoder:mainfrom
Jaryan-luck:main

Conversation

@Jaryan-luck
Copy link
Copy Markdown

修复:环境检查因Asyncio Windows兼容性而失败并且无任何错误提示:)

问题

在Windows下使用WebUI时,环境检查功能卡在“Environment check error”且界面上没有任何具体的错误提示

原因分析

调用 GET /api/env/check 时,check_environment抛出不带任何描述信息的异常NotImplementedError(),返回的json中 error 字段为空,导致前端提示“环境检查失败”看不到任何具体信息。

Uvicorn在默认情况下使用WindowsSelectorEventLoopPolicy
这个事件循环对子进程和控制台的支持并不完善,
当使用SelectorEventLoop事件循环时,asyncio.create_subprocess_exec 会抛 NotImplementedError

解决方案

Windows环境下环境检测使用线程池执行同步子进程
返回错误消息的格式改成了:异常类型:详细描述,不会一点提示都没有😀

测试用例

Windows:
修复前:前端检测环境报错Environment check error,可能无详细信息;
修复后:环境检查成功执行,并返回正常输出,或至少给出明确错误提示(NotImplemented:Unknown)。

修复Asyncio Windows兼容性
@Jaryan-luck Jaryan-luck requested a review from NanmiCoder as a code owner May 20, 2026 15:02
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant