Rewrite ListPushPopStressTest to use dedicated threads#1717
Merged
Conversation
Replace async Task.Run pattern with dedicated Thread instances and synchronous Redis calls to eliminate threadpool dependency entirely. The async version caused threadpool starvation on small CI runners (2-4 cores) where 20 tasks competing for pool threads led to deadlock. Thread.Join with a 5-minute timeout provides a reliable safety net that doesn't depend on the threadpool. Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors ListPushPopStressTest in the RESP list test suite to avoid threadpool starvation on small CI runners by removing Task.Run/async Redis calls and using dedicated Thread workers with synchronous Redis operations.
Changes:
- Converted
ListPushPopStressTestfromasync Taskto a synchronous test using dedicatedThreadinstances. - Replaced async list push/pop calls with synchronous
ListLeftPush/ListRightPopand captured worker exceptions for reporting. - Implemented a join-based timeout mechanism intended to avoid threadpool dependency.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Widen TTL and sleep margins to prevent CI flakiness on slow machines: - Increase short TTL from 200ms to 500ms (margin: 500ms vs 100ms) - Increase long TTL from 500ms to 2000ms (margin: 1000ms vs 200ms) - Increase sleeps from 300ms to 1000ms/1500ms accordingly Co-authored-by: Copilot <[email protected]>
- Mark worker threads as IsBackground=true so they don't hang the test process if the test fails early - Replace per-thread 5-minute timeout with a single shared deadline to prevent the test from running up to N*5 minutes in worst case Co-authored-by: Copilot <[email protected]>
Add ManualResetEventSlim stop flag checked by all worker threads. On timeout or failure, the finally block signals stop and joins all threads (with 30s grace) before returning, preventing leaked threads from interfering with subsequent tests. Co-authored-by: Copilot <[email protected]>
Remove errors array, failureMessage indirection, bit-shift indexing, dead comment. Use straightforward i*2/i*2+1 indexing and let assertions propagate naturally through the finally cleanup block. Co-authored-by: Copilot <[email protected]>
b211085 to
3c53229
Compare
Co-authored-by: Copilot <[email protected]>
3c53229 to
ed2c826
Compare
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Replace async Task.Run pattern with dedicated Thread instances and synchronous Redis calls to eliminate threadpool dependency entirely. The async version caused threadpool starvation on small CI runners (2-4 cores) where 20 tasks competing for pool threads led to deadlock.
Thread.Join with a 5-minute timeout provides a reliable safety net that doesn't depend on the threadpool.