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

[DocDB] Use std::mutex for write lock in RWCLock #25391

Closed
1 task done
spolitov opened this issue Dec 20, 2024 · 0 comments
Closed
1 task done

[DocDB] Use std::mutex for write lock in RWCLock #25391

spolitov opened this issue Dec 20, 2024 · 0 comments
Assignees
Labels
area/docdb YugabyteDB core features kind/enhancement This is an enhancement of an existing feature priority/medium Medium priority issue

Comments

@spolitov
Copy link
Contributor

spolitov commented Dec 20, 2024

Jira Link: DB-14620

Description

Thread sanitizer does not understand timed_mutex, so it cannot detect related issue, such as lock order reversal.
Could use std::mutex when building for TSAN to turn on detection of related issues.

Issue Type

kind/enhancement

Warning: Please confirm that this issue does not contain any sensitive information

  • I confirm this issue does not contain any sensitive information.
@spolitov spolitov added area/docdb YugabyteDB core features status/awaiting-triage Issue awaiting triage labels Dec 20, 2024
@spolitov spolitov self-assigned this Dec 20, 2024
@yugabyte-ci yugabyte-ci added kind/enhancement This is an enhancement of an existing feature priority/medium Medium priority issue labels Dec 20, 2024
@rthallamko3 rthallamko3 removed the status/awaiting-triage Issue awaiting triage label Jan 2, 2025
spolitov added a commit that referenced this issue Jan 10, 2025
Summary:
Thread sanitizer does not understand `std::timed_mutex`, so it cannot detect related issue, such as lock order reversal.
Could use `std::mutex` when building for TSAN to turn on detection of related issues.

Also fixed all TSAN issues found after this change.
There are two most common patterns for lock order reversion:
1) Usually we acquire object write lock while holding catalog manager mutex_. But sometimes we acquire catalog manager mutex_ while holding object write lock.
Fixed by changing place where we acquire catalog manager mutex_. Doing it before acquiring object write lock. Or after object write lock is released.

2) Different write lock order for catalog objects.
Fixed by adjusting code to take locks in the object id order.
Jira: DB-14620

Test Plan: Jenkins

Reviewers: zdrudi, hsunder, xCluster, asrivastava, stiwary

Reviewed By: zdrudi, hsunder, asrivastava

Subscribers: stiwary, yql, esheng, ybase

Tags: #jenkins-ready

Differential Revision: https://phorge.dev.yugabyte.com/D40697
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docdb YugabyteDB core features kind/enhancement This is an enhancement of an existing feature priority/medium Medium priority issue
Projects
None yet
Development

No branches or pull requests

3 participants