summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Steven Moreland <smoreland@google.com> 2022-09-28 23:56:39 +0000
committer Steven Moreland <smoreland@google.com> 2022-09-28 23:57:43 +0000
commit276d8dfe41da95f04fd573f9cbb3bcf82c2cbd78 (patch)
tree4bbe70baba3ef2ec61b00bb00f299f4e35fbe0e1
parent00a54e416a72ab98ebb31c6dfb4b6eb581f41166 (diff)
binderRpcTest: backtrace on leaked session
There is a bug we're hitting here where sessions leak, but it only seems to repro on infra. Adding additional logging to narrow down the issue. Bug: 244325464 Test: binderRpcTest Change-Id: I6586534e23ee884be6aa7a6e25258ae2c07aedd9
-rw-r--r--libs/binder/tests/binderRpcTest.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/libs/binder/tests/binderRpcTest.cpp b/libs/binder/tests/binderRpcTest.cpp
index 21b0354b60..9a6d4dfa53 100644
--- a/libs/binder/tests/binderRpcTest.cpp
+++ b/libs/binder/tests/binderRpcTest.cpp
@@ -85,6 +85,11 @@ static std::string WaitStatusToString(int wstatus) {
return base::StringPrintf("unexpected state %d", wstatus);
}
+static void debugBacktrace(pid_t pid) {
+ std::cerr << "TAKING BACKTRACE FOR PID " << pid << std::endl;
+ system((std::string("debuggerd -b ") + std::to_string(pid)).c_str());
+}
+
class Process {
public:
Process(Process&&) = default;
@@ -125,6 +130,8 @@ public:
// Kill the process. Avoid if possible. Shutdown gracefully via an RPC instead.
void terminate() { kill(mPid, SIGTERM); }
+ pid_t getPid() { return mPid; }
+
private:
std::function<void(int wstatus)> mCustomExitStatusCheck;
pid_t mPid = 0;
@@ -173,7 +180,9 @@ struct ProcessSession {
wp<RpcSession> weakSession = session;
session = nullptr;
- EXPECT_EQ(nullptr, weakSession.promote()) << "Leaked session";
+
+ EXPECT_EQ(nullptr, weakSession.promote())
+ << (debugBacktrace(host.getPid()), debugBacktrace(getpid()), "Leaked session");
}
}
};