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

Add TSAN support #541

Merged
merged 4 commits into from Apr 15, 2022
Merged

Add TSAN support #541

merged 4 commits into from Apr 15, 2022

Conversation

Darksonn
Copy link
Contributor

Was previously attempted in #405, but that PR was closed due to TSAN detection being unstable.

Closes: #540

Copy link
Member

@carllerche carllerche left a comment

Choose a reason for hiding this comment

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

Looks good to me, should we consider defining an acquire! macro? e.g. https://doc.rust-lang.org/stable/src/alloc/sync.rs.html#1637

@Darksonn
Copy link
Contributor Author

Meh, not sure the macro adds that much.

src/bytes_mut.rs Outdated
// Thread sanitizer does not support atomic fences. Use an atomic load
// instead.
//#[cfg(thread = "sanitize")]
//(*ptr).ref_count.load(Ordering::Acquire);
Copy link
Member

Choose a reason for hiding this comment

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

Looks like everything is commented out.

@Darksonn
Copy link
Contributor Author

Darksonn commented Apr 3, 2022

Originally I had misspelled #[cfg(sanitize = "thread")] as #[cfg(thread = "sanitize")], which caused it to not work. Unfortunately, when fixing that, it turns out to still be unstable. The current version will always use an acquire load rather than a fence. This is compatible with TSAN. Thoughts?

@Darksonn Darksonn merged commit 547a320 into master Apr 15, 2022
@Darksonn Darksonn deleted the tsan-support branch April 15, 2022 20:46
lelongg pushed a commit to lelongg/bytes that referenced this pull request Jan 9, 2023
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.

Thread Sanitizer - Data race reserve_inner
3 participants