This repository was archived by the owner on Feb 21, 2026. It is now read-only.
Commit 1f74883
fix: resolve container OOM hangs from tsgo and --memory flag (#55)
* 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>1 parent 2e8cc65 commit 1f74883
File tree
3 files changed
+10
-1
lines changed- container
- src
- backends
3 files changed
+10
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
10 | 17 | | |
11 | 18 | | |
12 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
231 | 232 | | |
232 | 233 | | |
233 | 234 | | |
234 | | - | |
| 235 | + | |
235 | 236 | | |
236 | 237 | | |
237 | 238 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
0 commit comments