summaryrefslogtreecommitdiffstats
path: root/libmemunreachable
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2016-01-14 15:35:40 -0800
committerColin Cross <ccross@android.com>2016-02-19 14:00:17 -0800
commitb1b7923efe96350a6ba31b027cc981bcfd6a7c85 (patch)
tree7eed072c15b1793be409940dcfd5d0ac664000db /libmemunreachable
parentfbaefc4d9d4e7e40ec0262123cd54762b81ed47a (diff)
downloadsystem_core-b1b7923efe96350a6ba31b027cc981bcfd6a7c85.tar.gz
system_core-b1b7923efe96350a6ba31b027cc981bcfd6a7c85.tar.bz2
system_core-b1b7923efe96350a6ba31b027cc981bcfd6a7c85.zip
libmemunreachable: fix long timeout on error
The collection thread should unblock the parent when it fails in order to prevent a 100 second timeout delay. Also reduce the timeout to 30 seconds, and fix a few log messages. Change-Id: I47f9ce4f645c453810fec57bef557c32a665eefb
Diffstat (limited to 'libmemunreachable')
-rw-r--r--libmemunreachable/MemUnreachable.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/libmemunreachable/MemUnreachable.cpp b/libmemunreachable/MemUnreachable.cpp
index cb3f1a52c..eca26eb6d 100644
--- a/libmemunreachable/MemUnreachable.cpp
+++ b/libmemunreachable/MemUnreachable.cpp
@@ -224,16 +224,19 @@ bool GetUnreachableMemory(UnreachableMemoryInfo& info, size_t limit) {
// ptrace all the threads
if (!thread_capture.CaptureThreads()) {
+ continue_parent_sem.Post();
return 1;
}
// collect register contents and stacks
if (!thread_capture.CapturedThreadInfo(thread_info)) {
+ continue_parent_sem.Post();
return 1;
}
// snapshot /proc/pid/maps
if (!ProcessMappings(parent_pid, mappings)) {
+ continue_parent_sem.Post();
return 1;
}
@@ -306,7 +309,7 @@ bool GetUnreachableMemory(UnreachableMemoryInfo& info, size_t limit) {
// Wait for the collection thread to signal that it is ready to fork the
// heap walker process.
- continue_parent_sem.Wait(100s);
+ continue_parent_sem.Wait(30s);
// Re-enable malloc so the collection thread can fork.
}
@@ -347,7 +350,7 @@ std::string Leak::ToString(bool log_contents) const {
std::ostringstream oss;
oss << " " << std::dec << size;
- oss << " bytes at ";
+ oss << " bytes unreachable at ";
oss << std::hex << begin;
oss << std::endl;
@@ -405,7 +408,7 @@ std::string UnreachableMemoryInfo::ToString(bool log_contents) const {
std::string GetUnreachableMemoryString(bool log_contents, size_t limit) {
UnreachableMemoryInfo info;
if (!GetUnreachableMemory(info, limit)) {
- return "Failed to get unreachable memory";
+ return "Failed to get unreachable memory\n";
}
return info.ToString(log_contents);