[compiler-rt] r332319 - [asan] Workaround to avoid hangs in Chromium tests

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Mon May 14 18:39:13 PDT 2018


Author: vitalybuka
Date: Mon May 14 18:39:13 2018
New Revision: 332319

URL: http://llvm.org/viewvc/llvm-project?rev=332319&view=rev
Log:
[asan] Workaround to avoid hangs in Chromium tests

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

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc?rev=332319&r1=332318&r2=332319&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc Mon May 14 18:39:13 2018
@@ -209,10 +209,10 @@ void ThreadSuspender::KillAllThreads() {
 
 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:
@@ -227,7 +227,7 @@ bool ThreadSuspender::SuspendAllThreads(
     for (tid_t tid : threads)
       if (SuspendThread(tid))
         retry = true;
-  } while (retry);
+  };
   return suspended_threads_list_.ThreadCount();
 }
 




More information about the llvm-commits mailing list