This repository was archived by the owner on Feb 21, 2026. It is now read-only.
fix: resolve container OOM hangs from tsgo and --memory flag - #55
Merged
Conversation
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>
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughAdds a runtime memory limit configuration exported from the app config, passes that limit to the container runtime, and sets a Go heap cap inside the container based on total system memory. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
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>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
--memoryflag treats bare numbers as bytes (not MB), so--memory 1024meant 1024 bytes, silently hanging the VM. Use--memory 4Gwith proper suffix. Ref: apple/container#1202, apple/container#1208GOMEMLIMIT=3GiBin entrypoint — tsgo (TypeScript native compiler) has no default memory ceiling. Go doesn't auto-detect container/cgroup memory limits, so tsgo allocates unbounded memory until the VM hangs. Ref: microsoft/typescript-go#2125Test plan
container listbun typecheck(tsgo) on a medium-sized TypeScript project inside a container — should complete without OOMGOMEMLIMITis set:container run -i --rm --entrypoint /bin/sh nanoclaw-agent:latest -c 'echo $GOMEMLIMIT'🤖 Generated with Claude Code
Summary by CodeRabbit