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

    <tr>
        <th>Summary</th>
        <td>
            lldb tests sometimes fail with SmallVector assert "Iterator to erase is out of bounds."
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            lldb,
            test-suite
      </td>
    </tr>

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

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

<pre>
    Originally reported in https://discourse.llvm.org/t/lldb-tests-seems-flaky-on-lldb-arm-ubuntu-bot/79798.

This has been reported to happen on Arm 32 bit Linux, Arm 64 bit Linux, and x86 _64 Linux bots. I have not seen it on Windows on Arm, and Mac maintainers have not seen it there.

On Arm 32 it has caused at least these tests to fail every so often, usually just one of them:
```
TestAddressBreakpoints.py
TestThreadAPI.py
TestTargetSymbolsAddCommand.py
TestDataFormatterLibcxxStringSimulator.py
```

These tests don't seem to be related so we suspect some more generic flaky behaviour.

The traceback is always cut off before anything useful:
```
python3.8: ../llvm-project/llvm/include/llvm/ADT/SmallVector.h:754: iterator llvm::SmallVectorImpl<std::pair<std::weak_ptr<lldb_private::Listener>, unsigned int>>::erase(const_iterator) [T = std::pair<std::weak_ptr<lldb_private::Listener>, unsigned int>]: Assertion `this->isReferenceToStorage(CI) && "Iterator to erase is out of bounds."' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
#0 0xedd8c394 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lib/python3.8/site-packages/lldb/_lldb.cpython-38-arm-linux-gnueabihf.so+0xf6d394)
#1 0xedd89db4 llvm::sys::RunSignalHandlers() (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lib/python3.8/site-packages/lldb/_lldb.cpython-38-arm-linux-gnueabihf.so+0xf6adb4)
#2 0xedd8cc2c SignalHandler(int) (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lib/python3.8/site-packages/lldb/_lldb.cpython-38-arm-linux-gnueabihf.so+0xf6dc2c)
#3 0xf7ee5530 __default_sa_restorer /build/glibc-tftl1u/glibc-2.31/signal/../sysdeps/unix/sysv/linux/arm/sigrestorer.S:67:0
#4 0xf7ed57e6 /build/glibc-tftl1u/glibc-2.31/csu/../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:47:0
#5 0xf7ee47fe raise /build/glibc-tftl1u/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:28:1
```

Example: https://lab.llvm.org/buildbot/#/builders/18/builds/460
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVt1u6zgOfhrlRojhyI7jXOTCp62xBc5iDibF7mUgS7StqSwZopQmb7-QkjTN2R_MDjDAAEYbUST1fSRFiiOqwQDsyPobWT8vePCjdbtnflRyPyvxDt4vOivPu1-cGpThWp-pg9k6D5IqQ0fvZyRFQ1hLWCsVChscQqb1ccqsGwhrPWGt1rJbekCPSwSYcNlr_n5eWrNMO9xNy9AF48Oys1F_s91s64zkzyRvLn_fRoV05Eg7AHOH4C0d-TyDodbQxk20YLRTnn5XJpwIe0qyqnyUcSPpqa7ooSovQtpZjxl9pSM_AjXWU4ynKB-9_lMZaT_wesDN_u9c0Ikr47ky4PDfLf0IDh4o_PKJUPlERfCAICn3VAPHZIJAU5gisZ4rTeEI7kzRUtt7MPH0gCGl4beAER9Q20fLKWbhclqVX79L5AB9I6UDxG8O-PtslfGYzef79tvogMvmx-ujlLsB_P48dVZjI-WTnSZu5IPOM_e8tW7i3oP7rjpxOu29U2bYqylo7q37VP8J1i2td8rSGsI2KYJT5N8BdaB5TDNa-gEUA84gPEU7AZ2sAzqAAacETeVEOxj5UdngfqocoN5xAR0X71Qh5fqDn5GK4Knte9pBH11xc_ajMgMNCH3Q_y2a89mP1hRZTYqGZlmq7eO0nJ39DYS_LglrlR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