Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix TSAN deadlock in ThreadLocal's fork handler.
Summary: The per ThreadEntrySet lock causes the number of locks to be tracked by TSAN during fork to be too large. We cannot control order of fork handler registration and it seems like TSAN's handlers are run earlier and lock down some of its internal state. Later when a realloc triggered in TSAN's tracking logic when we acquire all the ThreadEntrySet lock causes the fork to deadlock. For now, we can simply skip locking the per ThreadEntrySet lock in fork handlers. reset() and accessAllThreads() path are the only ones that end up holding locks on them and both paths also hold the accessAllThreadsLock_ as well and that is accounted for in the fork handler. Reviewed By: chippermist Differential Revision: D58920872 fbshipit-source-id: dbdc966f2586bb5479e0bf3274e54d3e9e5a2c6c
- Loading branch information