Repository navigation
Unsloth Studio logs: collect the backend session log in support reports - #8761
LeoBorcherding wants to merge 1 commit into
Conversation
A native crash of the Studio backend (STATUS_ACCESS_VIOLATION in a GPU runtime) leaves its only stack trace in the per-session disk log that run.py points faulthandler at. The support bundle collected tauri.log, tauri.log.1 and the phase-log groups, but never that file, so the faulting library was unidentifiable from the report. Add a backend-session-log tail to the Log tails section. The path is taken from the `Session log:` line the backend prints on stdout and the backend phase log captures, which stays correct when the studio home is overridden; otherwise fall back to the newest server-*.log under logs/server. Only an existing <...>/server/server-*.log is accepted, so a stray line in captured output cannot aim the collector elsewhere. Collection reuses append_tail_section/read_tail, so the existing line and byte caps, the size/mtime/truncated metadata and the report-wide redaction pass all apply unchanged, and a missing file or directory emits the same graceful unavailable= line plus a collection warning.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 96156e0427
ℹ️ 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".
| fn session_log_from_phase_logs(groups: &[PhaseGroup]) -> Option<PathBuf> { | ||
| for group in groups.iter().filter(|g| g.label.starts_with("backend:")) { | ||
| for path in group.paths.iter().rev() { | ||
| let Ok(tail) = read_tail(path, TAIL_MAX_LINES, TAIL_MAX_BYTES) else { |
There was a problem hiding this comment.
Read the session marker before tailing phase logs
When a backend phase segment grows beyond TAIL_MAX_BYTES (200 KiB) or 1,000 lines, this tail no longer contains the startup-only Session log: line, even though the segment remains retained up to 5 MiB. Resolution then falls back to the globally newest server-*.log; if another CLI/backend session has created or written a log more recently, the support report silently includes that unrelated session instead of the backend represented by this phase group. Read the beginning of the first retained segment for this marker, or persist the parsed path when it is initially captured.
Useful? React with 👍 / 👎.
| if is_session_log_path(&candidate) && candidate.is_file() { | ||
| found = Some(candidate); |
There was a problem hiding this comment.
Keep the trusted startup marker instead of the last match
The real Session log: marker is emitted at backend startup, but this assignment lets every later matching line replace it. If backend output from a dependency, plugin, or user-controlled workload later contains Session log: /some/path/server/server-foo.log, the lexical filename/parent check accepts that unrelated readable file and the support report copies its contents. Return the first valid startup marker rather than the last one, and validate the resolved path against a trusted server-log directory.
Useful? React with 👍 / 👎.
|
Closing this one. #8690 puts the logs in Settings > Debugging, so reaching them no longer depends on the support report, and the report path is much less load-bearing than it was when this was written. Happy to revisit if the report stays in use. |
Why
A native crash of the Studio backend (STATUS_ACCESS_VIOLATION in a GPU runtime) leaves its
only stack trace in the per-session disk log that run.py points faulthandler at. The support
bundle collected tauri.log, tauri.log.1 and the phase-log groups, but never that file, so the
faulting library was unidentifiable from the report.
What
Adds a backend-session-log tail to the Log tails section. The path comes from the
Session log:line the backend prints on stdout and the backend phase log captures, whichstays correct when the studio home is overridden; otherwise it falls back to the newest
server-*.logunderlogs/server. Only an existing<...>/server/server-*.logis accepted,so a stray line in captured output cannot aim the collector elsewhere.
Collection reuses
append_tail_section/read_tail, so the existing line and byte caps, thesize/mtime/truncated metadata and the report-wide redaction pass all apply unchanged. A
missing file or directory emits the same graceful
unavailable=line plus a collectionwarning.
Testing
cargo checkclean. Not exercised against a real native crash.