Skip to content

修复异步任务 OOM 后界面假死并显示错误信息 - #6636

Merged
Glavo merged 2 commits into
HMCL-dev:mainfrom
Hylfrd:fix/asynctaskexecutor-oom
Aug 10, 2026
Merged

修复异步任务 OOM 后界面假死并显示错误信息#6636
Glavo merged 2 commits into
HMCL-dev:mainfrom
Hylfrd:fix/asynctaskexecutor-oom

Conversation

@Hylfrd

@Hylfrd Hylfrd commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

该问题是在复现 #6086#6162 时发现的。#6086 在导出包含大量文件的 MCBBS 整合包时发生 OOM;#6162 在导出 Modrinth 整合包计算文件指纹时发生 OOM。两处 OOM 的原因不同,但都表现为进度窗口停留且没有错误提示。

HMCL 的 AsyncTaskExecutor 处理时,如果抛出 OutOfMemoryError,原实现会将其交给全局 handler,但不会触发任务失败事件和停止通知,导致进度窗口无法关闭且没有错误提示。

此 PR 仅针对 OutOfMemoryError 补齐受影响任务的失败事件和执行器停止通知,关闭进度窗口并报错。原始 OOM 仍会交给全局 handler,其他 Error 的行为保持不变。如果错误对话框也因内存不足而无法创建,仍会结束当前向导,避免界面继续停留。

QQ20260809-220943

HMCL 当前对 JVM 虚拟机报错缺少统一的处理机制:全局 CrashReport 会过滤所有 VirtualMachineError(直接返回False,详见#2520),部分不经过 AsyncTaskExecutor 的异步流程又会将其作为普通错误处理。建议后续单独研究 JVM 虚拟机报错的处理机制,并区分 OutOfMemoryError等错误的处理方式。

此 PR 仅处理 AsyncTaskExecutor 中 OOM 导致的界面假死,

@github-actions github-actions Bot added the 40+ label Aug 9, 2026
@Hylfrd Hylfrd changed the title 修复异步任务发生 OOM 时界面假死,并绘制 OOM 错误窗口 标题改为“修复异步任务 OOM 后界面假死并显示错误信息 Aug 9, 2026
@Hylfrd Hylfrd changed the title 标题改为“修复异步任务 OOM 后界面假死并显示错误信息 修复异步任务 OOM 后界面假死并显示错误信息 Aug 10, 2026
@Glavo

Glavo commented Aug 10, 2026

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 364ef091eb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Glavo
Glavo merged commit a0d1fa8 into HMCL-dev:main Aug 10, 2026
3 checks passed
@Hylfrd
Hylfrd deleted the fix/asynctaskexecutor-oom branch August 12, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants