Repository navigation
fix(logging): Core panic 记入日志,并声明桌面端 panic 与崩溃事件 - #49
Merged
Merged
Conversation
- 新增 panic hook(runtime/panic_facts.rs),在展开前记录 app.core.panic_interrupted, 再调用原 hook,保留 stderr 报告;经 helper_failures::install 每进程安装一次。 - 请求分发包在 request_boundary 里:请求内的 panic 不再穿过 C ABI 让宿主 abort, 而是返回 unknown / request_panicked 的失败响应,并带上 method 与 op。 - core_events::record_without_waiting:panic hook 专用,有限次 try_lock 拿不到锁就放弃, 不等待、不再次 panic;trace::try_current 在线程拆除或已借用时返回 None。 - 事件目录新增桌面端要用的 app.runtime.panic_interrupted、app.window.loop_failed、 app.session.previous_interrupted、app.session.close_missing。 - 日志说明与 rust-core-api.md 写明记录方式和失败响应。
- app.json 新增 app.session.crash_capture_failed(WARN,rate 60):stage 为 create、claim、release, 分别对应创建本会话的崩溃文件、认领上一次会话留下的文件、Close 时删除本会话的文件失败;error 为该步骤的错误。 - 重新生成 catalog_generated.rs。 - rust/logging/README.md 补两条:宿主恢复的 Go panic 经 Store.RecordPanic 记为 app.runtime.panic_interrupted(boundary、stack 的写法与 app.window.loop_failed); Go 运行时致命崩溃经 debug.SetCrashOutput 写进 .crash/<会话名>,下次启动记 previous_interrupted 或 close_missing,失败记 crash_capture_failed。
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.
关联 Issue
类型
fix:Core 内的 panic 没有记录,请求分发中的 panic 会穿过 C ABI 让宿主进程 abort;同时声明桌面端记录 Go panic 和崩溃要用的事件。
改动
Core 自己的 panic(
rust/crates/core、rust/crates/diagnostics、rust/crates/request-context)runtime/panic_facts.rs:panic hook 在展开开始前记录app.core.panic_interrupted(ERROR),再调用原 hook,stderr 报告照旧保留。经helper_failures::install每进程只安装一次,新 hook 排在原 hook 前面。boundary:request表示请求分发中的 panic,同时记录method(不符合 token 形状时省略)和当前请求的 op;thread表示 Core 自己起的线程中的 panic。location为文件:行:列,panic为文本载荷,非文本载荷记成固定说明。runtime/dispatcher.rs:请求分发包进request_boundary。请求内的 panic 不再穿过 C ABI 让宿主 abort,而是返回unknown/request_panicked的失败响应,带上 method 和 op。core_events::record_without_waiting:panic hook 专用。hook 可能运行在持有队列锁的线程上,所以只做有限次try_lock,拿不到锁就放弃这条事实,不等待,也不在 hook 里再次 panic(hook 内的 panic 会直接 abort)。trace::try_current:线程拆除中或已被借用时返回None,供 hook 安全读取当前请求的 op。桌面端要用的事件(
rust/logging/events/app.json,已重新生成catalog_generated.rs)app.core.panic_interruptedapp.runtime.panic_interruptedboundary、panic、stackapp.window.loop_failedapp.session.previous_interruptedapp.session.close_missingapp.session.crash_capture_failedstage为create、claim、release文档
rust/logging/README.md写明 Core panic hook、宿主Store.RecordPanic和debug.SetCrashOutput崩溃捕获的记录方式。rust/contracts/rust-core-api.md写明请求内 panic 的失败响应。不在本 PR 范围内
f4f3e93;本 PR 合入后再把固定版本升到 main 上的 commit。sample,不在本 PR 范围内。验证
node scripts/logging/generate-log-events.mjs --checkcargo test -p lithe-diagnosticscargo test -p lithe-coredesktop-go.sh test ./internal/core(含目录门禁TestEveryLoggedEventIsAcceptedByTheKernel),链接本分支