Because we use SCOPED_TSAN_INTERCEPTOR in the dispatch_once interceptor, the original dispatch_once can also be sometimes called (when ignores are enabled or when thr->is_inited is false). However the original dispatch_once function doesn’t expect to find “2” in the storage and it will spin forever (but we use “2” to indicate that the initialization is already done, so no waiting is necessary). We should never call the original dispatch_once.
Details
Details
- Reviewers
kcc glider dvyukov - Commits
- rG09d3e53a9387: [tsan] dispatch_once interceptor will cause a crash/deadlock when the original…
rCRT274548: [tsan] dispatch_once interceptor will cause a crash/deadlock when the original…
rL274548: [tsan] dispatch_once interceptor will cause a crash/deadlock when the…
Diff Detail
Diff Detail
Event Timeline
Comment Actions
Adding a testcase. Without the patch, the test doesn’t deadlock but only crashes, so I didn’t add a timeout.