Summary:
For some reasons on Chromium when we start leak checking we get own pid as 1.
After that we see threads with PPID:0 assuming that thread is dead in infinite
loop.
To resolve particularly this case and possible issues like this, when IsAlive check failed to detect thread status, we need to limit the number of SuspendAllThreads
iterations.
Reviewers: eugenis
Subscribers: kubamracek, llvm-commits
Differential Revision: https://reviews.llvm.org/D46852
llvm-svn: 332319
bool ThreadSuspender::SuspendAllThreads() {
ThreadLister thread_lister(pid_);
- bool retry;
+ bool retry = true;
InternalMmapVector<tid_t> threads;
threads.reserve(128);
- do {
+ for (int i = 0; i < 30 && retry; ++i) {
retry = false;
switch (thread_lister.ListThreads(&threads)) {
case ThreadLister::Error:
for (tid_t tid : threads)
if (SuspendThread(tid))
retry = true;
- } while (retry);
+ };
return suspended_threads_list_.ThreadCount();
}