Flakey failure on clang-ppc64le-linux-multistage

Seems there were a couple of correlated failures that appear to be flakes on this buildbot recently:

green: http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/builds/13974
red: http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/builds/13975 (target-override.c during stage 1, seems to be missing the directory/symlink it just created)
red: http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/builds/13976 (same test failure as the last, but during stage 2, not stage 1)
green: http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/builds/13977

Including Nico & Pavlov as the people who wrote/edited the test, but I’m guessing this is something interesting going on on the buildbot itself?

powerllvm@ca.ibm.com, whoever you are on the end of that mailing list - could you take a look at this? Possibly manually running that test in a loop a bunch of times to see if it fails sometimes & try to help us understand why?

Interesting, thanks for bringing this to our attention. I just took a quick look through the last 100 builds and this test has failed 13 times. This is certainly something we need to look at. We will investigate and see if we can make any sense of this.

Nemanja Ivanovic
LLVM PPC Backend Development
IBM Toronto Lab
Email: nemanjai@ca.ibm.com
Phone: 905-413-3388

Well, I am at my wit’s end. I have copied over the script and directories for this test case and run it a few million times. First I was running one at a time, then I switched to kicking off 1000 at a time. All the while, the bots continued to run on the same machine. The script never failed even once. I am not sure if this has something to do with Python as part of llvm-lit or what is going on.
I am thinking that the best course of action for us is to mark this test case UNSUPPORTED for PPC.

Thanks for looking into it!

Could you describe your test process in more detail? Were you running lit from your script? Running the build system (ninja?)?

Sure.
I didn’t use lit or ninja. I simply copied the script produced by lit (/home/buildbots/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/tools/clang/test/Driver/Output/target-override.c.script) into a temporary directory (along with a deep copy of the build directory). I modified the paths in the script to point to the temporary directory.

Then I ran the script in a loop.
For running a bunch in parallel, I just produced a wrapper script to invoke that one:
target-override.c.script $LINENO &
target-override.c.script $LINENO &
target-override.c.script $LINENO &

wait
And ran that in a loop. For thousands of iterations…

Is the machine running any jobs in parallel? Would it be worth trying running lit in the loop, rather than the script? (perhaps lit’s doing something interesting) or maybe the full test run from ninja, but I appreciate that that is expensive.

Are there other PPC bots? Any idea if they are experiencing this failure?

There are also other tests that do similar mkdir/symlink things, I think - yet they are not failing? Maybe they do it in some slightly different manner?

This is likely due to a race condition (%T is a shared parent
directory). I'll put up a patch to fix it.

Oh yeah, good catch! Thanks!

Should be fixed by ⚙ D87103 [test] Use %t instead of %T to remove race conditions between config-file3.c and target-override.c

Shall we consider deprecating(emitting a warning)/removing %T from
lit? lldb, lld/COFF and clang-tools-extra are the three major users of
%T. There are a few other %T in other places but there are not too
many. We will also investigate whether other projects using lit are
using %T.

Yeah, I think I’d be up for considering deprecation of %T due to the risk of race conditions/conflicts between tests. %t gives a unique name you can do whatever you want with - only need one file, use %t as a file, need a directory full of files, mkdir %t and use that, etc.

But will depend a bit on what the uses of %T look like, maybe there are some good uses of it that we haven’t thought of until we see them.

I recall that there was a proposal to remove %T some time in the last two years. Go for it.

https://llvm.org/docs/CommandGuide/lit.html already lists %T as “parent directory of %t (not unique, deprecated, do not use)”. See also https://reviews.llvm.org/D35396

I have a vague memory that libcxx wanted it for something, and claimed it would be hard to work around not having it.

Anyone else remember that? I can’t dredge up the details, sorry…

In any event, a separate properly-titled thread on llvm-dev would be the right way to decide this.

–paulr

I think that was maybe the discussion on https://reviews.llvm.org/D78245

Thank you! It sounds like libcxx is rolling their own, so it seems like finishing the removal of %T should be fine.

But it should still be announced separately.

–paulr

Thanks everyone for this discussion. Turns out that in my effort to make it possible to run multiple instances of this script in parallel, I inadvertently hid the issue. I made each instance use a directory that has $1 appended to the name and the wrapper script provided a unique value with $LINENO. :frowning:

MaskRay, thanks for fixing the problem. All the PPC bots are back to green now.

That’s great, thank you for taking care of this!

It looks like there may still be a problem with the clang-ppc64le-linux bot, which is failing due to gcc getting killed when building llvm/clang/unittests/Tooling/RecursiveASTVisitorTests/Callbacks.cpp.

It seems like it sometimes passes, but fails due to getting killed most of the time. I took a look at the build history and it has been happening at least since http://lab.llvm.org:8011/builders/clang-ppc64le-linux/builds/32287

Cheers,
Florian


Right, I have left a message to the original author of that test case in the review where it was added (https://reviews.llvm.org/D82485) in the hopes the test case can be broken up into multiple files to avoid this problem.