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 races caught by tsan #2339

Closed
wants to merge 1 commit into from
Closed

Conversation

sagar0
Copy link
Contributor

@sagar0 sagar0 commented May 20, 2017

This fixes the tsan build failures in:

  • write_callback_test
  • persistent_cache_test.*

Test plan:
COMPILE_WITH_TSAN=1 make check

@facebook-github-bot
Copy link
Contributor

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

Copy link
Contributor

@yiwu-arbug yiwu-arbug left a comment

Choose a reason for hiding this comment

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

LGTM.

@sagar0 sagar0 deleted the fix-tsan-tests branch May 22, 2017 17:41
std::atomic<uint64_t> cache_hits_{0};
std::atomic<uint64_t> cache_misses_{0};
std::atomic<uint64_t> cache_errors_{0};
std::atomic<uint64_t> insert_dropped_{0};
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to change in where the counters are incremented to be relaxed order?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you are right; I did not realize that the default memory order could impact the performance here. I'll read up a bit on the right memory_order to use here, and make the right change.

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.

None yet

4 participants