Skip to content
This repository was archived by the owner on Feb 21, 2026. It is now read-only.

Commit dd5aa53

Browse files
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>
1 parent 2e8cc65 commit dd5aa53

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

container/entrypoint.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ set -e
77
# Cap JS heap to prevent OOM
88
export NODE_OPTIONS="--max-old-space-size=2048"
99

10+
# Cap Go heap for tsgo (TypeScript native compiler) — Go doesn't auto-detect
11+
# container memory limits, so without this tsgo allocates unbounded memory and hangs.
12+
# See: https://github.com/microsoft/typescript-go/issues/2125
13+
export GOMEMLIMIT=3GiB
14+
1015
# Configure git with GitHub token
1116
if [ -n "$GITHUB_TOKEN" ]; then
1217
gh auth setup-git 2>/dev/null || true

src/backends/local-backend.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ function buildVolumeMounts(
231231
}
232232

233233
function buildContainerArgs(mounts: VolumeMount[], containerName: string): string[] {
234-
const args: string[] = ['run', '-i', '--rm', '--name', containerName];
234+
const args: string[] = ['run', '-i', '--rm', '--memory', '4G', '--name', containerName];
235235

236236
for (const mount of mounts) {
237237
if (mount.readonly) {

0 commit comments

Comments
 (0)