Fix TestKit startup failures under load with SpinWait#7745
Merged
Arkatufus merged 1 commit intoAug 11, 2025
Conversation
- Changed WaitUntilTestActorIsReady to use SpinWait instead of Thread.Sleep(10) - SpinWait provides better performance under both light and heavy load - Detects TestActor readiness in microseconds instead of minimum 10ms - Yields more efficiently to other threads under resource pressure - Should reduce TestKit timeout failures in CI environments This addresses the sync-over-async issue without breaking changes.
Aaronontheweb
commented
Aug 11, 2025
| var logger = extSystem.SystemActorOf(Props.Create(() => new TestOutputLogger(Output)), "log-test"); | ||
| logger.Ask<LoggerInitialized>(new InitializeLogger(system.EventStream), TestKitSettings.TestKitStartupTimeout) | ||
| .ConfigureAwait(false).GetAwaiter().GetResult(); | ||
| // Start the logger initialization task but don't wait for it yet |
Member
Author
There was a problem hiding this comment.
The idea behind this was to be able to wrap it around the WaitUntilTestActorReady call but that's a bit more work than I thought
This was referenced Aug 14, 2025
This was referenced Aug 22, 2025
This was referenced Sep 4, 2025
This was referenced May 21, 2026
Open
Closed
Open
Open
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.
Summary
Replaces
Thread.Sleep(10)withSpinWaitin TestKit initialization to reduce startup failures and improve performance.Fixes #7744
Changes
Thread.Sleep(10)withSpinWaitinWaitUntilTestActorIsReadyPerformance Impact
Compatibility
This is a non-breaking internal optimization. All existing tests continue to work exactly as before.