Skip to content

Control plane: stop engine instances wedged across consecutive reclaim sweeps - #53

Merged
micahtyong merged 5 commits into
mainfrom
devin/1789775616-reap-wedged-engines
Sep 29, 2026
Merged

micahtyong merged 5 commits into
mainfrom
devin/1789775616-reap-wedged-engines

Conversation

@micahtyong

@micahtyong micahtyong commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Reclaim trainer instances whose idle models repeatedly fail to unload, so wedged engines eventually release their GPUs. Split out of #39.

Failed reclaim sweeps persist strikes in the engines key store. Strikes are at least three hours apart by default, matching the current backend operation timeout: rapid placement retries must not kill a healthy trainer during a long step. Any successful unload, live model, or new placement clears the strikes.

Before stopping, the engine atomically checks that its models still match the failed unloads and enters draining mode to reject new placements. Engines without the new endpoint are left running. Cancellation failures retain instance records and strikes so cleanup can retry; an already-missing Modal call can be cleaned up.

Safety review

  • Fixed rapid retries counting as independent evidence of a wedge.
  • Fixed new placements racing with a stale reclaim snapshot; strike changes during unload also invalidate that sweep.
  • Fixed cancellation errors discarding tracking for an engine that might still be running.
  • Rebased onto main at aa6e16e, retaining model-creation error handling.

Validation

  • 189 control-plane, engine, Modal platform, and KV tests passed; two SDK tests excluded because they import Linux-only socket options on macOS.
  • Regression coverage includes rapid retries, recovery, live models, new placements during unload, cleared strikes, draining over HTTP, and cancellation retries.
  • Package build and diff whitespace checks passed.
  • Full local suite could not run: missing PyTorch and existing Linux-only socket imports. Linux CI passed: 715 tests passed, one skipped, and package build succeeded. Codegolf CI also passed.

Link to original Devin session: https://modal.devinenterprise.com/sessions/8d6804dd317c41329d77eb2c427dda6f
Requested by: @micahtyong

@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access that start with 'DevinAI' or '@devin'.

  • Disable automatic comment, CI, and merge conflict monitoring

micahtyong and others added 4 commits September 28, 2026 17:55
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The two-strike orphan reaper writes engine_strikes:<instance_id>, a key family the routed Modal store did not know, so every placement that ran a reclaim sweep failed with 'unknown key family'.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@micahtyong
micahtyong force-pushed the devin/1789775616-reap-wedged-engines branch from 689b69d to eee0625 Compare September 29, 2026 00:59
@micahtyong
micahtyong merged commit c3a7f75 into main Sep 29, 2026
2 checks passed
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