修复异步任务 OOM 后界面假死并显示错误信息 - #6636
Merged
Merged
Conversation
Member
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
该问题是在复现 #6086 和 #6162 时发现的。#6086 在导出包含大量文件的 MCBBS 整合包时发生 OOM;#6162 在导出 Modrinth 整合包计算文件指纹时发生 OOM。两处 OOM 的原因不同,但都表现为进度窗口停留且没有错误提示。
HMCL 的
AsyncTaskExecutor处理时,如果抛出OutOfMemoryError,原实现会将其交给全局 handler,但不会触发任务失败事件和停止通知,导致进度窗口无法关闭且没有错误提示。此 PR 仅针对
OutOfMemoryError补齐受影响任务的失败事件和执行器停止通知,关闭进度窗口并报错。原始 OOM 仍会交给全局 handler,其他Error的行为保持不变。如果错误对话框也因内存不足而无法创建,仍会结束当前向导,避免界面继续停留。HMCL 当前对 JVM 虚拟机报错缺少统一的处理机制:全局
CrashReport会过滤所有VirtualMachineError(直接返回False,详见#2520),部分不经过AsyncTaskExecutor的异步流程又会将其作为普通错误处理。建议后续单独研究 JVM 虚拟机报错的处理机制,并区分OutOfMemoryError等错误的处理方式。此 PR 仅处理
AsyncTaskExecutor中 OOM 导致的界面假死,