<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Windows sanitizer tests are flaky due to LNK1104, when the linker cannot overwrite the last executable"
   href="https://llvm.org/bugs/show_bug.cgi?id=24554">24554</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Windows sanitizer tests are flaky due to LNK1104, when the linker cannot overwrite the last executable
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>rnk@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>aaron@aaronballman.com, llvm-bugs@lists.llvm.org, peter@pcc.me.uk
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The sanitizer tests (asan, ubsan, etc) often have RUN lines like the following:

// RUN: %clangxx -fsanitize=integer-divide-by-zero -DDIVIDEND=0 %s -o %t &&
%run %t 2>&1 | FileCheck %s
// RUN: %clangxx -fsanitize=integer-divide-by-zero -DDIVIDEND=1U %s -o %t &&
%run %t 2>&1 | FileCheck %s
// RUN: %clangxx -fsanitize=float-divide-by-zero -DDIVIDEND=1.5 %s -o %t &&
%run %t 2>&1 | FileCheck %s

This repeatedly compiles the test with different settings, links it, and runs
it in place. This pattern fails every so often on Windows for reasons that
aren't fully understood. It seems like the %t process is still alive when the
next linker command is running, and Windows doesn't let you overwrite EXEs or
DLLs that are in use.

It's possible that this is a Python/lit bug. If the lit process isn't closing
it's process handle before running the next command, that might be the cause.

It's possible that this is caused by anti-virus software that is still scanning
the executable, but unlikely, since the sanitizer-windows buildbot doesn't have
any third-party AV on it.

Regardless, we should fix it.

One workaround is to not reuse %t over and over in tests, but this will be
difficult to enforce, since it works on Linux.

Another workaround is to make '%run' on Windows expand to a wrapper program
that waits for the child process to really exit.

If the theory about 'lit' is correct, the best fix would be to use the Popen
object to explicitly close the handle before running the next process.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>