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

Give the Linux skip binary 8 MiB thread stacks - #290

Merged
marcprux merged 1 commit into
skiptools:mainfrom
Ceylo:fix/linux-thread-stack-size
Oct 11, 2026
Merged

marcprux merged 1 commit into
skiptools:mainfrom
Ceylo:fix/linux-thread-stack-size

Conversation

@Ceylo

@Ceylo Ceylo commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

What

Lets SkipUI-based packages build for Android on Linux, about 3× faster than on Intel macOS (table below). One step of skiptools/actions#23: skip-ui and skip-fuse-ui run their emulator tests only on Intel, and this removes the first blocker to running them on Linux (the second is listed under Side effects).

On Linux, transpiling SkipUI kills skipstone with SIGSEGV (exit 139) and no message: skip android build of skip-ui or skip-fuse-ui fails on Linux. The skip binary is built with the static Linux SDK, whose musl gives non-main threads a 128 KiB stack (glibc: 8 MiB). SwiftParser recurses per nesting level, and SkipUI's nested trailing closures overflow it on a DispatchWorker thread (gdb backtrace). musl takes its default thread stack from PT_GNU_STACK, so this links with -z stack-size=8388608: glibc's usual size and musl's maximum.

Before / after

Same skipstone binary and command on ubuntu-24.04, only PT_GNU_STACK changed (run): 128 KiB → exit 139; 512 KiB, 1 MiB, 8 MiB → exit 0, full SkipUI output.

Built by this branch (run): readelf -lW shows GNU_STACK … 0x800000. With that binary, skip android build on ubuntu-24.04:

Intel macOS (main, today) Linux (this branch)
skip-ui 91 s 32 s (run)
skip-fuse-ui 180 s 57 s (run)

On main the same step segfaults on Linux (skip-ui, skip-fuse-ui).

Side effects

  • Thread stacks are reserved address space, committed only as used.
  • The main thread's stack is unchanged.
  • Both libraries' host swift test still fails on Linux for unrelated reasons (no such module 'CoreGraphics' in skip-ui; duplicate static products in skip-fuse-ui).

Verified

  • The runs above, and this branch's android-ci on Ubuntu, both Swift versions (one job re-run after the toolchain's swift-build crashed in libdispatch, unrelated to the skip binary).

Skip Pull Request Checklist:

  • REQUIRED: I have signed the Contributor Agreement
  • REQUIRED: I have tested my change locally with swift test (not applicable: build script only)
  • OPTIONAL: I have tested my change on an iOS simulator or device (not applicable)
  • OPTIONAL: I have tested my change on an Android emulator or device (Ubuntu android-ci, above)

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes.

Written with Claude Code: the diagnosis, the patch and the runs above, each from a run.

🤖 Generated with Claude Code

The static Linux SDK links musl, which gives every thread but the main one
a 128 KiB stack. SwiftParser recurses per nesting level, and transpiling
SkipUI overflows that on a DispatchWorker thread: skipstone exits with
SIGSEGV (139) and no message. musl takes its default thread stack size
from PT_GNU_STACK, so set it at link time to 8 MiB, glibc's usual default
and musl's maximum.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cla-bot cla-bot Bot added the cla-signed label Oct 4, 2026
@Ceylo
Ceylo marked this pull request as ready for review October 4, 2026 22:39

@marcprux marcprux left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@marcprux
marcprux merged commit 344d8c8 into skiptools:main Oct 11, 2026
9 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants