Skip to content

优化启动器崩溃处理机制 - #6825

Closed
CiiLu wants to merge 9 commits into
HMCL-dev:mainfrom
CiiLu:y
Closed

CiiLu wants to merge 9 commits into
HMCL-dev:mainfrom
CiiLu:y

Conversation

@CiiLu

@CiiLu CiiLu commented Sep 6, 2026

Copy link
Copy Markdown
Contributor
  1. 移除目前的崩溃分析机制。目前大部分规则已经过期,且正确率极低。且目前如果分析出了原因只会显示仅有原因的 Alert。在崩溃群或用户群遇到这种还得引导用户使用命令行启动 hmcl 或手动寻找日志文件,交流成本极高。
  2. 在崩溃窗口添加导出启动器日志按钮
  3. 多次出现错误时在现有窗口追加内容,避免部分频繁处理的逻辑(如加载游戏版本)出错一次性出现一大堆崩溃窗口。

@github-actions github-actions Bot added the 100+ label Sep 6, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Static analysis found the following issues (max count 10):

/**
* @author huangyuhui
*/
public class CrashWindow extends Stage {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[ERROR] [com.puppycrawl.tools.checkstyle.checks.design.FinalClassCheck]

Class CrashWindow should be declared as final.

}


public void addCrashReport(CrashReport report) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[ERROR] [com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck]

'METHOD_DEF' has more than 1 empty lines before.




public static Path exportLogsAsZip() throws IOException {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[ERROR] [com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck]

'METHOD_DEF' has more than 1 empty lines before.

}


private static String getEntryName(Set<String> entryNames, String name) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[ERROR] [com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck]

'METHOD_DEF' has more than 1 empty lines before.

@Glavo

Glavo commented Sep 6, 2026

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-06T12:23:52.979112Z b6a36d6 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b6a36d69dc

ℹ️ 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".

btnExport.setOnAction(event -> {
exportPane.getChildren().setAll(progressIndicator);
try {
Path path = LauncherLogExporter.exportLogsAsZip();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Run the log export off the JavaFX application thread

When retained logs are large, compressed, or stored on a slow filesystem, this call scans, decompresses, and recompresses up to five files and waits for Logger.exportLogs directly inside the button's JavaFX action handler. The FX pulse therefore cannot render the progress indicator, the crash window remains unresponsive, and subsequent queued crash reports cannot appear until the export finishes. Dispatch the export to Schedulers.io() and return to the JavaFX executor for the dialog and button update, as the settings-page export already does.

Useful? React with 👍 / 👎.

# Conflicts:
#	HMCL/src/main/java/org/jackhuang/hmcl/ui/CrashWindow.java
#	HMCL/src/main/resources/assets/lang/I18N.properties
#	HMCL/src/main/resources/assets/lang/I18N_ar.properties
#	HMCL/src/main/resources/assets/lang/I18N_de.properties
#	HMCL/src/main/resources/assets/lang/I18N_es.properties
#	HMCL/src/main/resources/assets/lang/I18N_ja.properties
#	HMCL/src/main/resources/assets/lang/I18N_lzh.properties
#	HMCL/src/main/resources/assets/lang/I18N_ru.properties
#	HMCL/src/main/resources/assets/lang/I18N_zh_Hans.properties
#	HMCL/src/main/resources/assets/lang/I18N_zh_Hant.properties
@Minecraft269

Copy link
Copy Markdown
Contributor

来自崩溃报错群

在主线中仍然存在着的崩溃分析器已造成误导 我们需要此PR

@Glavo

Glavo commented Sep 25, 2026

Copy link
Copy Markdown
Member

@codex review

@Minecraft269

Copy link
Copy Markdown
Contributor

为什么该PR无法抓到 使用任务管理器强行结束游戏进程 的崩溃事件? 这是预期行为吗?

hmcl-exported-logs-2026-09-25T21-37-17.zip

@Glavo Glavo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本审查建议由 GPT-6 Astra 生成


已将具体审查建议标注在对应代码行。


SettingsManager.shutdown();
LOG.shutdown();
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] 保留启动失败路径的资源清理

删除关闭逻辑后,如果 Launcher.main() 在 JavaFX 初始化前失败,Platform.runLater() 会抛出 Toolkit not initialized,而 Launcher.stop() 也不会执行。非守护日志线程因此一直存活,留下没有窗口、无法自行退出的进程。已通过独立进程复现;补上日志关闭后正常退出。应为无法显示崩溃窗口的启动失败路径保留清理逻辑。

btnExport.setOnAction(event -> {
exportPane.getChildren().setAll(progressIndicator);
try {
Path path = LauncherLogExporter.exportLogsAsZip();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] 将日志导出移至后台线程

按钮回调在 JavaFX UI 线程扫描、解压并重新压缩最多五份历史日志,还会等待 Logger.exportLogs()。日志较大或磁盘较慢时,整个界面冻结,进度指示器无法刷新,后续崩溃报告也无法显示。应沿用设置页的 Schedulers.io() 异步导出方式,再回 UI 线程更新窗口。已有审查指出此问题,当前提交仍未修复。

Iu-yang1 added a commit to Iu-yang1/HMCL-Fix that referenced this pull request Oct 21, 2026
Iu-yang1 added a commit to Iu-yang1/HMCL-Fix that referenced this pull request Oct 21, 2026
Iu-yang1 added a commit to Iu-yang1/HMCL-Fix that referenced this pull request Oct 21, 2026
Iu-yang1 added a commit to Iu-yang1/HMCL-Fix that referenced this pull request Oct 21, 2026
Upstream HMCL HMCL-dev#6194 HMCL-dev#6860 HMCL-dev#6947 HMCL-dev#6747 HMCL-dev#6806 HMCL-dev#6407 HMCL-dev#6869 HMCL-dev#6825. Adapt JFXPopup and mod update logic to preserve existing fork features; retain crash diagnostics. Java CI and Check Codes passed; JAR/EXE/SH/DEB and nonempty credentials verified.
@Glavo Glavo closed this Nov 15, 2026
@zkitefly

Copy link
Copy Markdown
Member

怎么关闭了?

@burningtnt

Copy link
Copy Markdown
Member

为什么关了

@Minecraft269

Copy link
Copy Markdown
Contributor

为什么关了

怎么关闭了?

估计是太久没动静了

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.

5 participants