Commit Graph

1 Commits

Author SHA1 Message Date
Kuba Brecka 11d8c1f8dd [tsan] Fix an assertion failure in FindThreadByUidLocked with recycled threads
When a race on file descriptors is detected, `FindThreadByUidLocked()` is called to retrieve ThreadContext with a specific unique_id. However, this ThreadContext might not exist in the thread registry anymore (it may have been recycled), in which case `FindThreadByUidLocked` will cause an assertion failure in `GetThreadLocked`. Adding a test case that reproduces this, producing:

    FATAL: ThreadSanitizer CHECK failed: sanitizer_common/sanitizer_thread_registry.h:92 "((tid)) < ((n_contexts_))" (0x34, 0x34)

This patch fixes this by replacing the loop with `FindThreadContextLocked`.

Differential Revision: http://reviews.llvm.org/D14984

llvm-svn: 254223
2015-11-28 09:16:34 +00:00