This is an archive of the discontinued LLVM Phabricator instance.

[tsan] Turn lit test deadlocks into failures (OS X)
ClosedPublic

Authored by kubamracek on Nov 6 2015, 7:57 AM.

Details

Summary

Several tests currently deadlock when the lit test suite is run on OS X. At this point, I'd like to turn them into failures so we can actually have a buildbot running the tests.

One class of deadlocks is when using fork/vfork – if something fails within the fork interceptor, an external symbolizer is spawned using fork() again and that deadlock with the original fork. Let's disable the symbolizer in these tests (none of them actually rely on the symbolizer).

Second class of deadlocks is when having a very fast timer (ITIMER_PROF, tv_usec = 10) and spawning new threads. Apparently, a thread receives a signal at a very early initialization stage, which deadlocks again. I don't have a solution for this yet, so I think we should just make the test simply fail on OS X.

Diff Detail

Repository
rL LLVM

Event Timeline

kubamracek updated this revision to Diff 39531.Nov 6 2015, 7:57 AM
kubamracek retitled this revision from to [tsan] Turn lit test deadlocks into failures (OS X).
kubamracek updated this object.
kubamracek added reviewers: dvyukov, samsonov, kcc, glider.
dvyukov added inline comments.Nov 6 2015, 8:14 AM
test/tsan/signal_reset.cc
44 ↗(On Diff #39531)

There is some infrastructure in lit for this.

Tsan only disables for particular hardware now:
longjmp.cc:// XFAIL: mips64
longjmp.cc:// XFAIL: aarch64

but asan disables tests for operating systems:
test/asan/TestCases/log-path_test.cc:// XFAIL: android
test/asan/TestCases/log-path_test.cc:// XFAIL: win32

maybe it also works for tsan tests?

XFAILs don't work for deadlocked tests. XFAIL still runs the tests, but they'll never finish.

dvyukov accepted this revision.Nov 6 2015, 9:09 AM
dvyukov edited edge metadata.
This revision is now accepted and ready to land.Nov 6 2015, 9:09 AM

I've go fork tests working by disabling interceptors for it. It's fused with another commit in my history, so I can't be precise. But...

--- a/lib/tsan/rtl/tsan_interceptors.cc
+++ b/lib/tsan/rtl/tsan_interceptors.cc
@@ -2112,7 +2307,15 @@ TSAN_INTERCEPTOR(int, fork, int fake) {
     return REAL(fork)(fake);
   SCOPED_INTERCEPTOR_RAW(fork, fake);
   ForkBefore(thr, pc);
+#if !SANITIZER_MAC
   int pid = REAL(fork)(fake);
+#else
+  int pid = -1;
+  {
+    ScopedIgnoreInterceptors ignore;
+    pid = REAL(fork)(fake);
+  }
+#endif
   if (pid == 0) {
     // child
     ForkChildAfter(thr, pc);

may fix the problem.

samsonov edited edge metadata.Nov 6 2015, 3:54 PM
In D14443#283736, @kubabrecka wrote:

XFAILs don't work for deadlocked tests. XFAIL still runs the tests, but they'll never finish.

Try UNSUPPORTED:

This revision was automatically updated to reflect the committed changes.

I didn't know about "UNSUPPORTED", thanks! Changed the patch to use it.