Issue |
129910
|
Summary |
LLDBCoreTests are crashing because of Telemetry
|
Labels |
new issue
|
Assignees |
oontvoo
|
Reporter |
JDevlieghere
|
I can reproduce the crash locally with:
```
❯ lldb tools/lldb/unittests/Core/LLDBCoreTests
(lldb) target create "tools/lldb/unittests/Core/LLDBCoreTests"
Current executable set to '/Users/jonas/llvm/build-ra/tools/lldb/unittests/Core/LLDBCoreTests' (arm64).
(lldb) env GTEST_SHUFFLE=1
(lldb) env GTEST_TOTAL_SHARDS=17
(lldb) env GTEST_SHARD_INDEX=13
(lldb) env
target.env-vars (dictionary of strings) =
GTEST_SHARD_INDEX=13
GTEST_SHUFFLE=1
GTEST_TOTAL_SHARDS=17
```
(lldb) run
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x00000001882bc388 libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`__pthread_kill:
-> 0x1882bc388 <+8>: b.lo 0x1882bc3a8 ; <+40>
0x1882bc38c <+12>: pacibsp
0x1882bc390 <+16>: stp x29, x30, [sp, #-0x10]!
0x1882bc394 <+20>: mov x29, sp
```
The problem is that we try to add entries to `received_entries`, which is a stack allocated variable in the Telemetry test.
```
frame #8: 0x0000000100031b08 LLDBCoreTests`lldb_private::TestDestination::receiveEntry(this=<unavailable>, entry=<unavailable>) at TelemetryTest.cpp:39:25 [opt]
36 // Save a copy of the entry for later verification (because the original
37 // entry might have gone out of scope by the time verification is done.
38 if (auto *fake_entry = llvm::dyn_cast<FakeTelemetryInfo>(entry))
-> 39 received_entries->push_back(
40 std::make_unique<FakeTelemetryInfo>(*fake_entry));
41 return llvm::Error::success();
42 }
(lldb) up
frame #9: 0x00000001000fb9b4 LLDBCoreTests`llvm::telemetry::Manager::dispatch(this=<unavailable>, Entry=0x000000016fdfdfa0) at Telemetry.cpp:31:52 [opt]
28
29 Error AllErrs = Error::success();
30 for (auto &Dest : Destinations) {
-> 31 AllErrs = joinErrors(std::move(AllErrs), Dest->receiveEntry(Entry));
32 }
33 return AllErrs;
34 }
(lldb) up
frame #10: 0x0000000100130220 LLDBCoreTests`lldb_private::telemetry::ScopedDispatcher<lldb_private::telemetry::DebuggerInfo>::~ScopedDispatcher(this=0x000000016fdfdf78) at Telemetry.h:144:35 [opt]
141 // The callback will set the remaining fields.
142 m_callback(&m_info);
143 // And then we dispatch.
-> 144 if (llvm::Error er = manager->dispatch(&m_info)) {
145 LLDB_LOG_ERROR(GetLog(LLDBLog::Object), std::move(er),
146 "Failed to dispatch entry of type: {0}", m_info.getKind());
147 }
```
However, this is not running a TelemetryTest, this is happening when running a ProgressEvent test.
```
frame #13: 0x000000010001eda8 LLDBCoreTests`ProgressReportTest::CreateListenerFor(this=0x00006000012e1400, bit=1) at ProgressReportTest.cpp:36:21 [opt]
33 Platform::SetHostPlatform(
34 PlatformRemoteMacOSX::CreateInstance(true, &arch));
35
-> 36 m_debugger_sp = Debugger::CreateInstance();
37
38 // Get the debugger's broadcaster.
39 Broadcaster &broadcaster = m_debugger_sp->GetBroadcaster();
```
I think the problem is that we're suffering from the Telemetry being global. We have a similar issue for things like the progress events and the file system, which is why the tests use `SubsystemRAII` to initialize and deinitialize the subsystem. I think we'll need to do the same for Telemetry.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs