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

Use Serial GC with capped address space for linux-x86_64 binary - #136

Merged
pditommaso merged 1 commit into
masterfrom
fix/linux-serial-gc
Oct 7, 2026
Merged

pditommaso merged 1 commit into
masterfrom
fix/linux-serial-gc

Conversation

@pditommaso

Copy link
Copy Markdown
Contributor

Fixes #86.

Cause: with --gc=G1, the static musl image runs HotSpot's sched_getcpu_init() at startup. In a static musl binary dlsym(RTLD_DEFAULT, "sched_getcpu") returns null, so it falls back to calling the legacy vsyscall getcpu at 0xffffffffff600800. On kernels booted with vsyscall=none (e.g. WSL2) that page isn't mapped, so the binary segfaults on startup.

Fix: go back to the default Serial GC. G1 was introduced in #63 to fix #46: with default settings, Serial GC reserves a large heap address space and fails under ulimit -v with Failed to create the main Isolate. To keep #46 fixed, this caps the reservation with -R:ReservedAddressSpaceSize=512m. The heap is already capped at MaxHeapSize=100M.

The smoke test now also runs the binary with ulimit -v set to 2 GB and 1 GB, to cover #46.

🤖 Generated with Claude Code

G1 in a static musl image falls back to the legacy vsyscall getcpu,
which segfaults on kernels with vsyscall=none such as WSL2 (#86).
Cap the reserved heap address space so the binary still starts under
ulimit -v (#46), and check that in the smoke test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pditommaso
pditommaso marked this pull request as ready for review October 7, 2026 09:06
@pditommaso
pditommaso merged commit 2403b10 into master Oct 7, 2026
13 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Segmentation fault, linux-x86_64 "Failed to create the main Isolate" error - Large Memory Req

1 participant