[PATCH] [Tsan] Fix the signal_recursive.cc test to pass on systems with high loads

Viktor Kutuzov vkutuzov at accesssoftek.com
Thu Dec 4 03:59:03 PST 2014


> Why does tsan deadlock? Does the program actually deadlock in tsan runtime?

Without this sleep we enter CollectGarbage() before BusyThread() is called (the numbers on the left side are what clock_gettime(CLOCK_REALTIME_PRECISE) returns):

  1417692217.980580462: Init()
  1417692217.987495307: pthread_create()
  1417692218.54266293: CollectGarbage()
  1417692218.54445716: in CollectGarbage()
  1417692218.54574294: in StopWorld()
  LLVMSymbolizer: error reading file: No such file or directory.
  ==================
  WARNING: ThreadSanitizer: data race (pid=23947)
    Write of size 8 at 0x7db000000000 by thread T1:
      #0 memcpy /home/buildslave/ikosarev/llvm/projects/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:640
  ...
  SUMMARY: ThreadSanitizer: data race ??:0 ??
  ==================
  Stack dump:
  0.      Program arguments: /home/buildslave/ikosarev/build/./bin/llvm-symbolizer --inlining=true --default-arch=x86_64

With sleep(1) it is:

  1417692556.835742780: Init()
  1417692556.848583448: pthread_create()
  1417692556.896431988: in BusyThread()
  1417692556.896830432: in BusyThread() loop
  1417692556.897031854: in BusyThread() loop
   ...
  1417692557.894940248: in BusyThread() loop
  LLVMSymbolizer: error reading file: No such file or directory.
  ==================
  WARNING: ThreadSanitizer: data race (pid=22303)
    Write of size 8 at 0x7db000000000 by main thread:
      #0 memcpy /home/buildslave/ikosarev/llvm/projects/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:640
  ...
  SUMMARY: ThreadSanitizer: data race ??:0 ??
  ==================
  1417692557.894964692: CollectGarbage()
  1417692558.719659730: in BusyThread() loop
  1417692558.740268355: in CollectGarbage()
  1417692558.740936178: in BusyThread() loop
  1417692558.744038178: in StopWorld()
  1417692558.744717244: in BusyThread() loop
  1417692558.746884000: in StartWorld()
  1417692558.749903867: pthread_join()
  DONE
  ThreadSanitizer: reported 2 warnings

So it looks like we call pthread_kill() for an under-initialized thread. We probably shouldn't quit the pthread_create() interceptor unless the thread's routine took control?

http://reviews.llvm.org/D6504






More information about the llvm-commits mailing list