Page MenuHomePhabricator

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

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



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


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
44 ↗(On Diff #39531)

There is some infrastructure in lit for this.

Tsan only disables for particular hardware now: XFAIL: mips64 XFAIL: aarch64

but asan disables tests for operating systems:
test/asan/TestCases/ XFAIL: android
test/asan/TestCases/ 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/
+++ b/lib/tsan/rtl/
@@ -2112,7 +2307,15 @@ TSAN_INTERCEPTOR(int, fork, int fake) {
     return REAL(fork)(fake);
   ForkBefore(thr, pc);
   int pid = REAL(fork)(fake);
+  int pid = -1;
+  {
+    ScopedIgnoreInterceptors ignore;
+    pid = REAL(fork)(fake);
+  }
   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.


This revision was automatically updated to reflect the committed changes.

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