Repository navigation
fix(station): keep paused commands paused until the memory has eased - #10416
Merged
Merged
Conversation
On a swapless machine MemoryWatch let a paused 7.6 GB command go on while the memory was still pressed (the queue's head after the one before it ended, or one look that read normal), and the machine stalled within seconds, before the next look could stop anything. What is paused now goes on only after EASED_LOOKS looks in a row without pressure, never while critical. When every big command is paused and the memory stays high, the largest is stopped after SETTLE_MS instead of let go on, since a paused one frees nothing. Under pressure the watch looks every 2 s instead of 5 s. Changelog: 修复:内存吃紧时,station 不再过早恢复被暂停的大命令,避免整机卡死被重启。 Changelog-parts: station Co-authored-by: zuozijian <zuozijian@cue.surf> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Node-Station-Only: MemoryWatch's pause queue (SIGSTOP/SIGCONT of agents' commands under memory pressure) exists only in station/src/jobs/memory.ts; pion/station-host has no counterpart that pauses or resumes commands
Review: one look's ease cleared how long every big command had been paused, so high and normal taking turns kept them paused for good; and the stop for it could follow a critical stop seconds later. Keep the wait through a single eased look, count only a read normal as eased, and stop only SETTLE_MS after the last stop. Co-authored-by: Heyang Zhou <heyang@cue.surf> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Node-Station-Only: MemoryWatch's pause queue (SIGSTOP/SIGCONT of agents' commands under memory pressure) exists only in station/src/jobs/memory.ts; pion/station-host has no counterpart that pauses or resumes commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A station VM on a swapless machine restarted twice. MemoryWatch paused a 7.6 GB agent command under
highpressure and let it go on 10 s later, either as the queue's head once the earlier 3.3 GB command ended (#queue, which resumed the head while the memory was still pressed, evencritical), or on a single look that readnormal(#resumeEarliest, no hysteresis). The logs cannot tell which: both printgoes on. Within 5 s, before the nextPRESSED_MSlook, the machine thrashed on page cache and stalled until its supervisor restarted it for missed heartbeats.What
EASED_LOOKS(2) looks in a row without pressure.#queuenever resumes while every big command is paused. Undercriticalthe existing stop path stops the largest. Underhigh, afterSETTLE_MSthe largest is stopped and its agent told, since a paused command frees nothing and the next one can then go on. This replaces resuming into the pressure; without it the queue would wait forever.PRESSED_MS5 s → 2 s: a swapless machine goes fromhighto stalled in seconds. Reads come from/proc(fix(station): detect swapless anon pressure and read Linux /proc directly in MemoryWatch #9669), so this is cheap.No Pion counterpart:
pion/station-hostdoes not pause or resume commands (Node-Station-Onlytrailer).The machine side (MGLRU
min_ttl_msso the kernel OOM-kills instead of stalling) is AFK-surf/monoid-machine#164 and losfair/l4h#277.Tested
station/test/memory-watch.test.ts(36 pass): the queue test now needs two eased looks; a new pair covers every big command paused undercritical(stopped at once, never told it goes on) and underhigh(nothing at once, stopped afterSETTLE_MS).tsgo --noEmit.Model: Claude Opus 5.5 (design reviewed with Gemini 4 Neon). Frameworks: node:test with Effect TestClock.
🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.