fix(miles-pipeline): honor R11-F1 ledger contract on failed releases - #33
Conversation
Two fixes in the same leak family as #14: 1. shutdown_hard cleared both ledger flags unconditionally even when a notify_release_gpus RPC failed, contradicting the documented R11-F1 contract ('shutdown_hard will retry the release if the flag stays True'). A second shutdown_hard/dispose call would skip the retry and leak the server-side allocation. Flags now flip per-cluster and only after a successful release. 2. Init-phase release failures (phase A step 7, phase B step 8) only logged a warning and fell through. On a pool sized for one role at a time, phase B's request_gpus (no timeout by design) would then block forever on GPUs this pipeline still holds. Both sites now raise; initialize_pipeline's except path runs shutdown_hard, which retries the release. Tests: behavioral shutdown_hard flag-retention/retry (ray stubbed, same pattern as test_scheduler_apply_plan_invariants) + AST fail-fast asserts (same pattern as test_miles_pipeline_after_training_cleanup).
|
Cross-checked this against our smoke-test history, since at first glance it seemed odd that none of the 4x5090 dual smokes ever surfaced either bug. Conclusion: both bugs are real contract violations, but their trigger conditions are extremely narrow — they live exclusively on failure paths our current runs never exercise. Bug 1 (shutdown_hard clearing ledger flags) needs all of the following to line up:
On a single-node Ray cluster, Bug 2 (init-phase release fall-through) only fires when the phase A step7 / phase B step8 release RPC itself fails. Every smoke so far released successfully, so the silent-deadlock branch (warn → next no-timeout None of this argues against the PR — it explains why runtime testing couldn't have caught it, which is exactly the class of bug this review pass exists for. The exposure becomes real in multi-node deployments (network blips, scheduler overload, actor restart windows), the success path is behavior-identical, and the failure branches now match the documented R11-F1 contract. |
|
LGTM. The fix matches the ledger contract and correctly converts the init-time silent deadlock into an explicit failure. |
What
Two fixes in the same scheduler-ledger leak family as #14, found during the F1-F12 code review (findings F8-SHUTDOWN-FLAGS and F8-INIT-RELEASE-HANG).
1.
shutdown_hardcleared ledger flags even when the release RPC failed_notify_release_cluster_gpus's docstring documents the R11-F1 contract: "shutdown_hard will retry the release if the flag stays True". Butshutdown_harditself cleared both_actor_train_allocated/_actor_infer_allocatedunconditionally after the release loop — a transient RPC failure meant a secondshutdown_hard/disposecall skipped the retry and the scheduler ledger leaked the allocation (peer pipelines starve).Now: flags flip per-cluster, and only after a successful release; failures keep the flag set for retry.
2. Init-phase release failures fell through instead of failing fast
Phase A step 7 (release
actor_trainbefore requestingactor_infer) and phase B step 8 (release INITactor_inferbefore the GENERATION re-request) only logged a warning on failure and continued. On a pool sized for one role at a time (the exact scenario the P1-7 comment describes), the nextrequest_gpus— which blocks without timeout by design — would wait forever on GPUs this same pipeline still holds: a silent deadlock instead of an error.Now: both sites raise;
initialize_pipeline's except path runsshutdown_hard, which retries the release.Tests
tests/test_miles_pipeline_shutdown_ledger.pyshutdown_hardretries only the leaked cluster (ray stubbed via thesys.modulespattern fromtest_scheduler_apply_plan_invariants.py)test_miles_pipeline_after_training_cleanup.pyfrom fix(rlix): always resume generation after finalize #14)