KEMBAR78
LockTests - use 3 locks for random threads instead of 2 to improve UT stability by visheshruparelia · Pull Request #1160 · async-profiler/async-profiler · GitHub
Skip to content

Conversation

@visheshruparelia
Copy link
Contributor

Description

After migrating to GH Runners for CI, we started seeing that the raceToLocks test in LockTests class started failing intermittently. The test fails because sometimes the wait time for threads with "shared lock" is lesser than that of threads using "random lock" - the thread randomly chooses one lock from the two available locks. To stabilize this, instead of using two locks, we use three. See below on how was this tested.

Related issues

N/A

How has this been tested?

Scenario 1

Available locks: 2
Test run count: 10
Total failures: 2
Total success: 8
PR: visheshruparelia#4 (See diff)
Builds: https://github.com/visheshruparelia/async-profiler/actions/runs/13686306015 (Notice that Attempt 6 and Attempt 8 failed - attached screenshot)
image

Scenario 2

Available locks: 3
Test run count: 10
Total failures: 0
Total success: 10
PR: visheshruparelia#3 (See diff)
Builds: https://github.com/visheshruparelia/async-profiler/actions/runs/13686282839 (Notice that all the runs passed - attached screenshot)
image


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@visheshruparelia visheshruparelia requested a review from apangin March 6, 2025 11:21
@apangin apangin merged commit 15609cd into async-profiler:master Mar 7, 2025
10 checks passed
krk pushed a commit to krk/async-profiler that referenced this pull request Mar 24, 2025
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