Repository navigation
Give each Podman session its own memory limit - #96
Merged
Merged
Conversation
All sessions share one budget in codebox.slice, with nothing per session. A runaway process in one session (a vitest run left behind by `| head`) grew to 45G, the slice reached MemoryHigh, and systemd-oomd answered the sustained pressure by killing whole containers: an idle session of another project first, then the runaway one. Each session now gets `podman run --memory`, from the new CODEBOX_MEMORY_SESSION_MAX (default half of CODEBOX_MEMORY_MAX, so below MemoryHigh; `infinity` for none). The runaway reaches its own limit first and the kernel OOM-kills it inside its container. A percentage is resolved against /proc/meminfo, as podman takes none. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.
What
Every Podman session now gets its own hard memory limit (
podman run --memory), inside the sharedcodebox.slicebudget.CODEBOX_MEMORY_SESSION_MAX. Default: half ofCODEBOX_MEMORY_MAX(half ofCODEBOX_MEMORY_HIGHwhen that one is set explicitly), so it sits belowMemoryHigh.infinityremoves it./proc/meminfoat launch, becausepodman run --memorytakes none.--no-memory-limitandCODEBOX_MEMORY_MAX=offskip both. The Apptainer backend is unchanged.Memory budget: codebox.slice (max 80%, high 72%, swap 2G; shared by all sessions; 40% per session).This changes the default behavior: with the defaults, a session that could use the whole budget before is now limited to half of it (40% of RAM).
Why
On 2026-11-26 a test run left behind in the background of one ompbox session (
vitest run | head -40) grew to 45G. The slice reachedMemoryHigh(46080M), the kernel throttled it, andsystemd-oomd(Fedora default: kill at 80% memory pressure for 20s on user slices) killed whole containers: first an idle session of another project (275M in use), 15 seconds later the runaway one.The shared budget protects the desktop, but not the sessions from each other. With a per-session limit below
MemoryHigh, the runaway process reaches its own limit first and the kernel OOM-kills it inside its container.Verification
tests/render-test.sh: all scenarios pass. Golden files re-recorded: every Podman scenario gains a--memory=line. New scenarios:memory-session(explicit value),memory-session-off(infinity),!memory-invalid-session. The test fixes RAM at 64 GiB throughCODEBOX_MEMINFOso the goldens do not depend on the machine.shellcheckon the documented file list: clean.codebox.slicewith--memory=512M:memory.maxis 536870912, a 3G allocation is killed (oom_kill 1), the container's shell survives.--memory=4G(frontend tests of the affected project piped intohead -40): vitest workers are OOM-killed one after the other (8 kills in 45s), memory stays at the limit, the container survives, andsystemd-oomdkills nothing. Observed for 45 seconds only.Limits
MemoryHighis not refused; the docs say to keep it below.podman createaccepts them); not validated here.Docs updated:
docs/usage.md(new section "One session cannot take the others down"),docs/architecture.md,AGENTS.md, and the launcher help.🤖 Generated with Claude Code