Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Single Threaded Client Usage Issues in Parallel ACL SETUSER Tests #1064

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kevinmichaelbowersox
Copy link
Member

@kevinmichaelbowersox kevinmichaelbowersox commented Mar 1, 2025

Summary

The ParallelTests#ParallelAclSetUserTest and ParallelTests#ParallelAclSetUserAvoidsMapContentionTest have issues surrounding the client selected for the test and how the client is used within the test. This misuse can lead to sporadic thread safety and memory access violation issues when executing tests.

ParallelAclSetUserTest

The ParallelAclSetUserTest uses the single threaded GarnetClientSession, however it launches concurrent tasks using Task.WhenAll. This violates the contract of the single threaded client causing sporadic issues with the test. To fix this problem unnecessary usage of Task.WhenAll was removed and each individual async command executed by the client was awaited.

ParallelAclSetUserAvoidsMapContentionTest

The ParallelAclSetUserAvoidsMapContentionTest uses the single threaded GarnetClientSession to start many tasks concurrently using Task.WhenAll. The goal is to create a close race between the first successful task and the runner up, causing contention on the ACL map. However, it launches the concurrent tasks using Task.WhenAll, violating the contract of the ingle threaded client. To fix this problem, the test was updated to use the GarnetClient, which has support for multiple threads.

@badrishc
Copy link
Contributor

badrishc commented Mar 1, 2025

If we want to create server side races, shouldn't we be using multiple GarnetClientSession (one GCS per parallel thread/task) instead of a shared GarnetClient? Because a single GarnetClient will linearize all the requests into a fifo stream on a single TCP connection at the server.

@kevinmichaelbowersox kevinmichaelbowersox changed the title Fix Client Selection Issues in Parallel ACL SETUSER Tests Fix Single Threaded Client Usage Issues in Parallel ACL SETUSER Tests Mar 2, 2025
@kevinmichaelbowersox
Copy link
Member Author

kevinmichaelbowersox commented Mar 2, 2025

If we want to create server side races, shouldn't we be using multiple GarnetClientSession (one GCS per parallel thread/task) instead of a shared GarnetClient? Because a single GarnetClient will linearize all the requests into a fifo stream on a single TCP connection at the server.

Agree. Thanks for pointing this out. I switched back to using multiple clients and was able to create the race (testing with our fixes from the change that introduced the test removed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants