gcstress: Limit the number of unwinds.
Temporary hack while diagnosing timeouts.
Bug: 142039427
Test: ./art/test.py -b -r --host --jit --64 --gcstress
Change-Id: If27211852fbbc1623664c93415f6355c5a8e58ba
diff --git a/runtime/backtrace_helper.cc b/runtime/backtrace_helper.cc
index 2d39270..08d67cd 100644
--- a/runtime/backtrace_helper.cc
+++ b/runtime/backtrace_helper.cc
@@ -81,11 +81,19 @@
};
void BacktraceCollector::Collect() {
+ // HACK(b/142039427): Limit the number of unwinds while we diagnose timeout issues.
+ static uint32_t s_count = 0;
+ if (s_count > 1000) {
+ return;
+ }
+ s_count++;
+
if (!CollectImpl()) {
// Reparse process mmaps to detect newly loaded libraries and retry.
UnwindHelper::Get(Thread::Current(), max_depth_)->Reparse();
if (!CollectImpl()) {
// Failed to unwind stack. Ignore for now.
+ s_count = std::numeric_limits<uint32_t>::max(); // Prevent future unwinds.
}
}
}