Fix: execution context queue stress tests failures#16472
Merged
straight-shoota merged 9 commits intocrystal-lang:masterfrom Dec 12, 2025
Merged
Conversation
Refactors and abstracts the stress test runs so no loop will run forever: the "thread setup" part has been removed, the main fiber won't block waiting for the threads to be ready, and the threads' loop will eventually timeout, and the thread return, so the main fiber won't block while joining the threads. This fixes the regular CI failures that occured often on Darwin, and may happen on Linux when running both specs in a tight loops multiple times in parallel to overload the CPU cores.
Member
|
With this patch, the spec does not get stuck any more on my machine using seed There are two So apparently they are waiting for randomness. |
Collaborator
Author
|
Whenever I try to fix the issue, mingw fails, this time on ARM64 😡 Why is it using urandom?! stdlib should always use getrandom on linux 😕 |
Collaborator
Author
|
Answering myself: because the libc method check macro doesn't work in older crystal releases! So, multiple fixes:
|
Collaborator
Author
|
Aside: why is urandom failing with EAGAIN? It should never block. Maybe it's wrong to make the fd non-blocking, and we should always read blocking instead since it should never block (readiness might not work). |
Member
The spec always fails on CI for this specific target.
straight-shoota
approved these changes
Dec 9, 2025
Co-authored-by: Johannes Müller <straightshoota@gmail.com>
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.
Refactors and abstracts the stress test specs of
Fiber::ExecutionContext::RunnablesandFiber::ExecutionContext::GlobalQueueso no loop will run forever: the "thread setup" part has been removed, the main fiber won't block waiting for the threads to be ready, and the threads' loop will eventually timeout, and the thread return, so the main fiber won't block while joining the threads.I abstracted a helper because the different tests used the same structure, and it was painful & noisy to dup the logic.
This fixes the regular CI failures that occurred often on Darwin on CI, and that I just reproduced on Linux when running these specs in tight loops multiple times in parallel to overload the CPU cores.
Might fix #16470 or least let it fail (not hang for 6h).
Related to #15630.