Skip to content

Studio: stop the stall watchdog from killing Xet downloads that are still receiving data - #11594

Merged
danielhanchen merged 5 commits into
unslothai:mainfrom
NilayYadav:studio-download-stall-watchdog
Sep 29, 2026
Merged

danielhanchen merged 5 commits into
unslothai:mainfrom
NilayYadav:studio-download-stall-watchdog

Conversation

@NilayYadav

Copy link
Copy Markdown
Collaborator

On a Mac the stall watchdog was killing Xet downloads that were still transferring. It judges the worker by its resident memory, and macOS compresses idle buffered pages out of that number, so a healthy transfer looked frozen and got killed. Each kill throws away the partial file.

The worker now writes the bytes it receives to a small heartbeat file. When the watchdog fires, the parent checks that file first. If bytes arrived within the stall window it re-arms the watchdog instead of killing the worker. A worker that has really stopped is still killed and retried as before.

The stall log message also said the retry would use HTTP before the retry path had picked a transport. It no longer names one.

@NilayYadav

Copy link
Copy Markdown
Collaborator Author

Review + GitHub Actions / UI evidence

Pinned head: 1f90a3be4f85b93378d79128caf4425a63bdcfa1. No open code findings.

Review

  • Codex, 2 rounds (683f4c0, 1f90a3b): one P1 each, both rejected with source evidence.
    • Round 1 said a re-armed watchdog loses the in-flight partial. It doesn't: start_watchdog only uses baseline_incomplete_blobs when there is no child_pid, and the re-arm always passes one. This holds in unsloth_zoo 2026.8.1 and 2026.9.7.
    • Round 2 said tqdm_class never sees per-file bytes. On huggingface_hub >=1.23, snapshot_download builds its byte-level transfer and reconstruct bars from tqdm_class.
  • Fixed in 1f90a3b:
    • HeartbeatWriter started with _flushed_at = 0.0. That dropped the first flush on any host up for less than the interval, and broke the throttle test on fresh CI VMs (reproduced at monotonic()=1.3s).
    • The spawn test captured unsloth_zoo's own ldconfig Popen call.
  • Tests: the new file passes 10/10, and 378 + 170 related download tests pass.

A/B on GitHub Actions (macos-14). Both sides run the same harness: a real Xet snapshot of unsloth/Qwen3-1.7B (3.46 GB) through Studio's spawn_worker and _start_stall_watchdog, with the zoo watchdog's disk and RSS sensors frozen (the macOS compression symptom) and a 5s stall window.

  • Fix reverted, expected failing run: killed on the first verdict at 11.7s (rc=-9), falls back to HTTP, only 1.7 MB kept.
  • PR head, passing run: 4/4 verdicts overruled by the heartbeat, rc=0, 3,457,084,051 bytes complete in 30.9s.
  • The unfrozen timeline shows the real symptom: the on-disk partial stayed at 1,629,101,656 bytes from t=17.4s to t=20.6s while the heartbeat went 3.03 GB → 3.53 GB.
  • Negative control: a truly hung worker (UNSLOTH_HF_XET_FORCE_STALL=1) is still killed at about 6.5s on both sides and on both OSes.

Studio UI. Chromium 1500x950 on a Modal CPU container, a 30 GB unsloth/Qwen3-14B-GGUF BF16 download, same frozen sensors, 6s window:

  • BEFORE (2036ee0): 2 live Xet workers killed. The byte counter restarts twice (3.29 GB → 6 MB, 4.90 GB → 52 MB) and falls back to HTTP; still 24/30 GB at 240s.
  • AFTER (1f90a3b): 7/7 verdicts overruled, 0 kills; complete over Xet in about 49s.

PR 11594 before/after

Notes

  • On ubuntu the same probe still kills at the 5s window after about 15s. The timeline shows why: the transfer had already finished (partial at its full 3.44 GB, heartbeat flat) and the worker held the full-size .incomplete open for more than 10s while finalizing. The base branch kills there too. No data is arriving, so this is outside what the heartbeat covers, and the 30s default is well above it.
  • Fork CI on 1f90a3b: 39 pass. Chat UI Tests (extra) failed on "Context Length did not persist across reload"; the same job passed on the identical SHA in another run. That is model-config persistence, which this PR does not touch.

@danielhanchen danielhanchen self-assigned this Sep 29, 2026
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 29, 2026
@shimmyshimmer

Copy link
Copy Markdown
Member

Review record for #11594, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#223.

Findings are quoted as posted and attributed to the account that posted them. The reactions shown are the triage recorded on the mirror; none were re-applied here. Commits are named as the mirror's, with this PR's equivalent where one was found.

Round 1: reviewed mirror c40927b41c (this PR's 6841f2c24)

chatgpt-codex-connector[bot] (on the mirror)

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: c40927b41c

No triage reaction was recorded on the mirror

Verdict

The round converged at mirror c40927b41c (this PR's 6841f2c24).

This is the review as it stood at that commit. Anything pushed to this PR afterwards was not part of it.

danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 29, 2026
danielhanchen added a commit to Datta0/unsloth-staging-3 that referenced this pull request Sep 29, 2026
@danielhanchen
danielhanchen merged commit 249e537 into unslothai:main Sep 29, 2026
35 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants