Skip to content

Rewrite ListPushPopStressTest to use dedicated threads#1717

Merged
badrishc merged 6 commits into
devfrom
badrishc/fix-list-stress-test
Apr 21, 2026
Merged

Rewrite ListPushPopStressTest to use dedicated threads#1717
badrishc merged 6 commits into
devfrom
badrishc/fix-list-stress-test

Conversation

@badrishc

Copy link
Copy Markdown
Collaborator

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.

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]>
Copilot AI review requested due to automatic review settings April 20, 2026 18:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 ListPushPopStressTest from async Task to a synchronous test using dedicated Thread instances.
  • Replaced async list push/pop calls with synchronous ListLeftPush / ListRightPop and 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.

Comment thread test/Garnet.test/RespListTests.cs Outdated
Comment thread test/Garnet.test/RespListTests.cs Outdated
badrishc and others added 4 commits April 20, 2026 12:11
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]>
@badrishc badrishc force-pushed the badrishc/fix-list-stress-test branch 2 times, most recently from b211085 to 3c53229 Compare April 20, 2026 22:52
Co-authored-by: Copilot <[email protected]>
@badrishc badrishc force-pushed the badrishc/fix-list-stress-test branch from 3c53229 to ed2c826 Compare April 20, 2026 22:54
@badrishc badrishc merged commit 19e7f82 into dev Apr 21, 2026
58 of 59 checks passed
@badrishc badrishc deleted the badrishc/fix-list-stress-test branch April 21, 2026 00:34
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants