This is an archive of the discontinued LLVM Phabricator instance.

[tsan] Remove long sleeps from fork tests
ClosedPublic

Authored by kubamracek on Mar 25 2016, 9:59 AM.

Details

Summary

On one of our testing machines, we're running the tests under heavy load, and especially in the fork-based TSan tests, we're seeing timeouts when a test uses sleep(10), assuming that calling fork() on another thread will finish sooner than that.

This patch removes the timeouts. I'm not sure if there is a better way, especially since these timeouts are supposed to catch deadlocks, and removing them might not be a good idea. Dmitry, if you have a better solution, please suggest.

Diff Detail

Repository
rL LLVM

Event Timeline

kubamracek updated this revision to Diff 51646.Mar 25 2016, 9:59 AM
kubamracek retitled this revision from to [tsan] Remove long sleeps from fork tests.
kubamracek updated this object.
kubamracek added reviewers: dvyukov, kcc, glider, samsonov.
dvyukov edited edge metadata.Mar 27 2016, 3:06 AM

Why do tests timeout if there is a sleeping thread present? Do they deadlock?
If anything, I would expect that a spinning thread will make situation worse on an overloaded machine.

Fork takes a long time on OS X (due to the large mmap TSan regions), much longer than on Linux. On that system, it even takes longer than 10 seconds. Spinning is bad, but it will at least make the test pass.

OK, I see.

For the sleeper thread please either increase sleep duration (1e6 seconds is OK here), or call sleep(1) in a loop. sched_yield will consume whole core.

For the watchdog thread, I've tried to be nicer to LLVM buildbots. But I don't remember that it ever fired. So I guess it is OK to remove it.

kubamracek updated this revision to Diff 51775.Mar 28 2016, 3:34 AM
kubamracek edited edge metadata.

Updating patch.

dvyukov accepted this revision.Apr 4 2016, 2:31 AM
dvyukov edited edge metadata.
This revision is now accepted and ready to land.Apr 4 2016, 2:31 AM
This revision was automatically updated to reflect the committed changes.