Repository navigation
Conversation
musl starts every new thread with a 128 KiB stack and ignores RLIMIT_STACK. When one of libdatachannel's worker threads attaches to the JVM to deliver a callback, HotSpot reserves most of that stack for its guard and shadow pages, so the call into Java overflows. JNI_OnLoad now raises the default to 1 MiB on non-glibc Linux before rtcPreload() starts the threads.
Collaborator
|
Merged with c2d3c9a |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
musl starts every new thread with a 128 KiB stack and ignores
RLIMIT_STACK, so libdatachannel's worker threads get 128 KiB. When one of them attaches to the JVM to deliver a callback, HotSpot on aarch64 reserves most of that stack for its guard and shadow pages and the call into Java overflows. Incoming data channels are acked natively butonDataChannelnever runs (GeyserMC/Geyser#6807).JNI_OnLoadnow raises the process default thread stack to 1 MiB withpthread_setattr_default_npon non-glibc Linux, beforertcPreload()starts the threads. glibc and the other platforms are unchanged.Tested on linux-musl-aarch64 (Alpine 3.24, Temurin 25): built with
compileNativeForLinuxMuslAarch64and swapped into Geyser 2.12.0-b1265, a NetherNet join that previously timed out after 30 s reaches login in under a second, the same as on glibc; with the bundled native the same join times out.