google / google/sanitizers

False lock-order-inversion reports for locks taken in a single thread

Open
#488 25 comments 2 reactions 1 assignee Claimed by @dvyukov View on GitHub
Priority-Medium ProjectThreadSanitizer Status-Accepted Type-Defect
Dominant language
C
Stars
12.5k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

Originally reported on Google Code with ID 81

```
Consider there're two locks, L1 and L2, and a thread T1 that does the following:
lock(L1)
lock(L2)
unlock(L1)
lock(L1)
unlock(L1)
unlock(L2)

, while other threads may (or may not) acquire and release L1 and L2 (but not both)
at the same time.
Based on the lock acquisition pattern in T1 ThreadSanitizer will report a lock-order-inversion
(potential deadlock), although there's no possibility of a deadlock as long as other
threads do not take both L1 and L2.
The error can even be reported in a single-threaded process, which isn't correct at
all.
```

Reported by `glider@chromium.org` on 2014-10-09 09:25:52

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.