<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/112399>112399</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [compiler-rt] `ThreadDescriptorSize` failing (on some systems) since aa44f59abf399f81585898fb95e66518ef3591af
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            compiler-rt:sanitizer
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          mgorny
      </td>
    </tr>
</table>

<pre>
    Today, two tests started failing for me on main:

```
FAIL: SanitizerCommon-Unit :: ./Sanitizer-i386-Test/1/12 (3455 of 7309)
******************** TEST 'SanitizerCommon-Unit :: ./Sanitizer-i386-Test/1/12' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/var/tmp/portage/sys-libs/compiler-rt-sanitizers-20.0.0_pre20241015/work/compiler-rt_build/lib/sanitizer_common/tests/./Sanitizer-i386-Test-SanitizerCommon-Unit-878-1-12.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=12 GTEST_SHARD_INDEX=1 /var/tmp/portage/sys-libs/compiler-rt-sanitizers-20.0.0_pre20241015/work/compiler-rt_build/lib/sanitizer_common/tests/./Sanitizer-i386-Test
--

Script:
--
/var/tmp/portage/sys-libs/compiler-rt-sanitizers-20.0.0_pre20241015/work/compiler-rt_build/lib/sanitizer_common/tests/./Sanitizer-i386-Test --gtest_filter=SanitizerLinux.ThreadDescriptorSize
--
/var/tmp/portage/sys-libs/compiler-rt-sanitizers-20.0.0_pre20241015/work/compiler-rt/lib/sanitizer_common/tests/sanitizer_linux_test.cpp:208: Failure
Expected equality of these values:
  0u
    Which is: 0
 ThreadDescriptorSize()
    Which is: 1216


/var/tmp/portage/sys-libs/compiler-rt-sanitizers-20.0.0_pre20241015/work/compiler-rt/lib/sanitizer_common/tests/sanitizer_linux_test.cpp:208
Expected equality of these values:
  0u
    Which is: 0
 ThreadDescriptorSize()
    Which is: 1216



********************
FAIL: SanitizerCommon-Unit :: ./Sanitizer-x86_64-Test/10/13 (3639 of 7309)
******************** TEST 'SanitizerCommon-Unit :: ./Sanitizer-x86_64-Test/10/13' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/var/tmp/portage/sys-libs/compiler-rt-sanitizers-20.0.0_pre20241015/work/compiler-rt_build/lib/sanitizer_common/tests
/./Sanitizer-x86_64-Test-SanitizerCommon-Unit-878-10-13.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=13 GTEST_SHARD_INDEX=10 /var/tmp/portag
e/sys-libs/compiler-rt-sanitizers-20.0.0_pre20241015/work/compiler-rt_build/lib/sanitizer_common/tests/./Sanitizer-x86_64-Test
--

Script:
--
/var/tmp/portage/sys-libs/compiler-rt-sanitizers-20.0.0_pre20241015/work/compiler-rt_build/lib/sanitizer_common/tests/./Sanitizer-x86_6
4-Test --gtest_filter=SanitizerLinux.ThreadDescriptorSize
--
/var/tmp/portage/sys-libs/compiler-rt-sanitizers-20.0.0_pre20241015/work/compiler-rt/lib/sanitizer_common/tests/sanitizer_linux_test.cp
p:208: Failure
Expected equality of these values:
  0u
    Which is: 0
 ThreadDescriptorSize()
    Which is: 2368


/var/tmp/portage/sys-libs/compiler-rt-sanitizers-20.0.0_pre20241015/work/compiler-rt/lib/sanitizer_common/tests/sanitizer_linux_test.cp
p:208
Expected equality of these values:
  0u
    Which is: 0
 ThreadDescriptorSize()
    Which is: 2368



********************
```

A bisect points out that the failure started happening with aa44f59abf399f81585898fb95e66518ef3591af. Curious facts:

- Tests fail only on one of the two systems I've tested. The "failing" system is `-j12`, the good one is `-j32`; I'm going to test later if switching the other to `-j12` triggers the issue.
- If I remove the newly added test (`TEST(SanitizerCommon, PrintThreadHistory)`), they start passing again.
- If I remove the contents of the new test but leave the empty function in place, they still fail.

All this considered, my educated guess is that something is leaking from some other test, and the addition of this one caused other tests to be reorganized into shards that trigger this failure.
</pre>
<img width="1px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