[all-commits] [llvm/llvm-project] 747612: [lldb][test] Fix race condition in test_stop-hook....

David Spickett via All-commits all-commits at lists.llvm.org
Tue Sep 29 09:17:55 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 747612bf4a4334a343221359a27a1eb9026a5db1
      https://github.com/llvm/llvm-project/commit/747612bf4a4334a343221359a27a1eb9026a5db1
  Author: David Spickett <david.spickett at arm.com>
  Date:   2026-09-29 (Tue, 29 Sep 2026)

  Changed paths:
    M lldb/test/API/api/multithreaded/test_stop-hook.cpp

  Log Message:
  -----------
  [lldb][test] Fix race condition in test_stop-hook.cpp (#227284)

This test has been failing on AArch64 Linux recently. Either with
SIGSEGV or SIGABRT (less often that one).

I could reproduce it locally by varying system load, and got this out of
a core file:
```
* thread #1, name = 'test_python_sto', stop reason = SIGSEGV: address not mapped to object (fault address=0xc17d18317552db80)
   * frame #0: 0x0000ef7dc72ac6cc libc.so.6`__GI_memchr at memchr.S:68
     frame #1: 0x0000ef7dc727cf4c libc.so.6`_IO_getline_info(fp=0x0000b9b53a8bd180, buf="\xa9\xb4\t\xce}\xef", n=<unavailable>
, delim=10, extract_delim=1, eof=0x0000000000000000) at iogetline.c:85:17
     frame #2: 0x0000ef7dc727bdc4 libc.so.6`_IO_fgets(buf="\xa9\xb4\t\xce}\xef", n=<unavailable>, fp=0x0000b9b53a8bd180) at io
fgets.c:53:11
     frame #3: 0x0000ef7dc80f2b80 liblldb.so.24.0git`lldb_private::IOHandlerEditline::GetLine(std::__cxx11::basic_string<char,
 std::char_traits<char>, std::allocator<char>>&, bool&) + 996
     frame #4: 0x0000ef7dc80f41f4 liblldb.so.24.0git`lldb_private::IOHandlerEditline::Run() + 180
     frame #5: 0x0000ef7dc80bf614 liblldb.so.24.0git`lldb_private::Debugger::RunIOHandlers() + 128
     frame #6: 0x0000ef7dc80ccee8 liblldb.so.24.0git`std::_Function_handler<void* (), lldb_private::Debugger::StartIOHandlerTh
read()::$_0>::_M_invoke(std::_Any_data const&) + 28
     frame #7: 0x0000ef7dc81e1608 liblldb.so.24.0git`lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(void*) + 124
     frame #8: 0x0000ef7dc72903c8 libc.so.6`start_thread(arg=0x000000000080e640) at pthread_create.c:442:8
     frame #9: 0x0000ef7dc72f9fdc libc.so.6`thread_start at clone.S:79
```
What's happening is that the interpreter's input stream is set to stream
A, then we reset it to the default, then close stream A. There may still
be reads from stream A in flight when we close it, which lead to the
crash.

The solution is to wait on the interpreter thread to finish whatever
it's doing. SBDebuger::Destroy does that.

Normally that would be called by driver.cpp but it can be called on
already destroyed objects. So for this test we'll call it twice, but
that's not a problem.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list