Skip to content

Studio: include the backend session log in the support diagnostics report - #8877

Open
LeoBorcherding wants to merge 1 commit into
unslothai:mainfrom
LeoBorcherding:fix-windows-rocm-vram-probe-isolation
Open

Studio: include the backend session log in the support diagnostics report#8877
LeoBorcherding wants to merge 1 commit into
unslothai:mainfrom
LeoBorcherding:fix-windows-rocm-vram-probe-isolation

Conversation

@LeoBorcherding

Copy link
Copy Markdown
Collaborator

Context: the Windows ROCm / Strix Halo crash reported on Reddit (same host as #8853). This does not fix that crash — it makes the next report of it diagnosable.

Problem

The Python backend aims faulthandler at ~/.unsloth/studio/logs/server/ (studio/backend/run.py:1850), so when the GPU runtime aborts, the Python stack naming the call that died is written there and in no other file Studio keeps.

The support report's == Log tails == section collected tauri.log, tauri.log.1 and the phase logs, and never that directory. A hard native crash therefore arrives as exit code: 3 with nothing about what the process was doing, while the one file that answers it sits on the user's disk unasked-for. That is exactly how the linked report played out: seven minutes of healthy polling, the model dropdown's request fan-out all returning 200, then Backend stdout stream ended with status: exit code: 3 with no traceback and no [stderr] line.

Change

Tail the two newest server-*.log alongside the existing sections, labelled source=backend-session-log. Two files, so a crash and the restart that followed it both land in one report. An absent directory reports backend_session_logs=unavailable rather than erroring — a --no-torch host, or one with UNSLOTH_STUDIO_NO_FILE_LOG=1, simply has none.

They get a smaller budget than the other tails (64 KiB / 400 lines vs 200 KiB / 1000). enforce_report_limit truncates the end of the body, so bytes spent in a section inserted here come straight out of the phase logs below it. A faulthandler dump is a few KB at the end of the file, which is the half read_tail returns, so the smaller cap loses nothing that matters.

append_tail_section keeps its signature and delegates to a _capped variant; no existing call site changes behaviour.

Testing

Four new tests in diagnostics::report::tests:

  • newest-first ordering and the two-file cap
  • only server-*.log is collected (tauri.log, server-notes.txt ignored)
  • absent directory yields empty, no panic
  • the section stays inside its smaller budget while retaining the trailing faulthandler stack

Both behaviours mutation-tested: flipping the sort to ascending, and raising SERVER_LOG_TAIL_MAX_BYTES to TAIL_MAX_BYTES, each fail the suite.

cargo test --bins: 367 passed. cargo fmt --check is clean on the changed file (the tree has pre-existing diffs elsewhere, left alone).

Privacy: the new tails go through the same redact_text pass as every other section; report_redacts_footer_collection_warning_paths covers home-path masking.

…port

The Python backend aims faulthandler at ~/.unsloth/studio/logs/server/, so a
native abort in the GPU runtime writes its stack there and in no other file
Studio keeps. The report collected tauri.log and the phase logs but never that
directory, so a hard crash arrived as an exit code with nothing about the call
that died.

Tail the two newest server-*.log alongside the existing sections. Their budget is
smaller than the other tails on purpose: enforce_report_limit chops the end of
the body, so bytes spent here would come out of the phase logs, and a faulthandler
dump is a few KB at the end of the file, which is the half read_tail returns.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant