Reduce access to atomic variables in a test #10909
Closed
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.
With TSAN build on CircleCI (see mini-tsan in .circleci/config).
Sometimes
SeqAdvanceConcurrentTest.SeqAdvanceConcurrent
will get stuck when an experimental feature called"unordered write" is enabled. Stack trace will be the following
This is problematic and suspicious. Two threads will get stuck in the same place trying to load from an atomic variable.
https://github.com/facebook/rocksdb/blob/7.8.fb/utilities/transactions/write_prepared_transaction_test.cc#L1694:L1707. Not sure why two threads can reach the same point.
The stack trace shows that there may be a deadlock, since the two threads are on the same write thread (one is doing Prepare, while the other is trying to commit).
Test Plan:
On CircleCI mini-tsan, apply a patch first so that we have a higher chance of hitting the same problematic situation,
then build and run tests
In the above,
SeqAdvanceConcurrent/19
. The tests 10 to 19 correspond to unordered write in which Prepare() and Commit() can both enter the same write thread.Before this PR, there is a high chance of hitting the deadlock. With this PR, no deadlock has been encountered so far.