ContainerService: Add minimum memory amount validation#1208
Merged
dcantah merged 1 commit intoapple:mainfrom Feb 18, 2026
Merged
ContainerService: Add minimum memory amount validation#1208dcantah merged 1 commit intoapple:mainfrom
dcantah merged 1 commit intoapple:mainfrom
Conversation
Today it's possible to pass a memory amount that very easily will cause the container's VM to not be able to boot. We should protect against this to avoid weird hangs/error messages. I could be convinced that a limit should be in Containerization as well, but I think having one in the daemon is a decent idea regardless.
Peyton-Spencer
added a commit
to omniaura/nanoclaw
that referenced
this pull request
Feb 15, 2026
Two issues caused containers to hang indefinitely: 1. Apple Container's `--memory` flag treats bare numbers as bytes, not megabytes. `--memory 1024` = 1024 bytes, causing the VM to never boot. Fix: use proper suffix (`--memory 4G`). Ref: apple/container#1202 Ref: apple/container#1208 2. tsgo (TypeScript native compiler) has no default memory ceiling — Go doesn't auto-detect container memory limits, so tsgo allocates unbounded memory until the VM hangs under memory pressure. Fix: set GOMEMLIMIT=3GiB in entrypoint. Ref: microsoft/typescript-go#2125 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3 tasks
Peyton-Spencer
added a commit
to omniaura/nanoclaw
that referenced
this pull request
Feb 15, 2026
* fix: resolve container OOM hangs from tsgo and --memory flag Two issues caused containers to hang indefinitely: 1. Apple Container's `--memory` flag treats bare numbers as bytes, not megabytes. `--memory 1024` = 1024 bytes, causing the VM to never boot. Fix: use proper suffix (`--memory 4G`). Ref: apple/container#1202 Ref: apple/container#1208 2. tsgo (TypeScript native compiler) has no default memory ceiling — Go doesn't auto-detect container memory limits, so tsgo allocates unbounded memory until the VM hangs under memory pressure. Fix: set GOMEMLIMIT=3GiB in entrypoint. Ref: microsoft/typescript-go#2125 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * make container memory configurable via CONTAINER_MEMORY env var Default 4G, configurable in .env. GOMEMLIMIT auto-derives from actual VM memory (75%) so it scales with any CONTAINER_MEMORY value. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
JaewonHur
approved these changes
Feb 17, 2026
ajemory
approved these changes
Feb 17, 2026
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.
Closes #1202
Today it's possible to pass a memory amount that very easily will cause the container's VM to not be able to boot. We should protect against this to avoid weird hangs/error messages. I could be convinced that a limit should be in Containerization as well, but I think having one in the daemon is a decent idea regardless.