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 data race in accessing cached_range_tombstone_ #10680

Closed
wants to merge 2 commits into from

Conversation

cbi42
Copy link
Member

@cbi42 cbi42 commented Sep 14, 2022

Summary: fix a data race introduced in #10547 (P5295241720), first reported by @pdillinger. The race is between the std::atomic_load_explicit in NewRangeTombstoneIteratorInternal and the std::atomic_store_explicit in MemTable::Add() that operate on cached_range_tombstone_. P5295241720 shows that atomic_store_explicit initializes some mutex which atomic_load_explicit could be trying to call lock() on at the same time. This fix moves the initialization to memtable constructor.

Test plan: USE_CLANG=1 COMPILE_WITH_TSAN=1 make -j24 whitebox_crash_test

@facebook-github-bot
Copy link
Contributor

@cbi42 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Contributor

@ajkr ajkr left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

ajkr added a commit to ajkr/rocksdb that referenced this pull request Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants