TSAN false negative on second thread::join
if first thread::join
throws
#66537
Labels
compiler-rt:tsan
Thread sanitizer
thread::join
if first thread::join
throws
#66537
Given the following problem
The
jt.join()
would throw and the exception would be caught. Later at the end of the scope, the destructor ofjthread
would calljoin
the second time. This is valid code but TSAN complainsWhat might be happening is that TSAN instruments
pthread_join
and it thinks that thethread
has already been joined when you call it the second time in the destructor. But in reality, the thread wasn't joined the first time around because of the system error.I had a looked at TSAN's code
ThreadConsumeTid
callsConsumeThreadUserId
, whichtry to find by id, assert id is found
remove what is found
From what I can see, the first time
join
is called, the user id is removed. thenjoin
throws.The second time
join
is called, the user id is no longer there and hence assertion failure.The text was updated successfully, but these errors were encountered: