summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Steven Moreland <smoreland@google.com> 2022-10-07 21:20:07 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2022-10-07 21:20:07 +0000
commit1edd9ee60bf1aa41faa9167aac608db5d76e5f7d (patch)
tree07ede69ddc9f16c108a198921de30f15a775c138
parente8296bdc18521152c7c8f661f08f6aca3fd3ad03 (diff)
parent89915109ff10816839fa06b31580b609d9dbbfb4 (diff)
Merge "binderRpcTest: session leak investigation part IV" am: b9909b12c3 am: 89915109ff
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2241715 Change-Id: I815035e30a9bf23e43f81b38654ff8b75c36053a Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--libs/binder/tests/binderRpcTest.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/libs/binder/tests/binderRpcTest.cpp b/libs/binder/tests/binderRpcTest.cpp
index 2b7049202a..d736cd2de7 100644
--- a/libs/binder/tests/binderRpcTest.cpp
+++ b/libs/binder/tests/binderRpcTest.cpp
@@ -181,10 +181,20 @@ struct ProcessSession {
wp<RpcSession> weakSession = session;
session = nullptr;
- sp<RpcSession> strongSession = weakSession.promote();
- EXPECT_EQ(nullptr, strongSession)
- << (debugBacktrace(host.getPid()), debugBacktrace(getpid()), "Leaked sess: ")
- << strongSession->getStrongCount();
+ // b/244325464 - 'getStrongCount' is printing '1' on failure here, which indicates the
+ // the object should not actually be promotable. By looping, we distinguish a race here
+ // from a bug causing the object to not be promotable.
+ for (size_t i = 0; i < 3; i++) {
+ sp<RpcSession> strongSession = weakSession.promote();
+ EXPECT_EQ(nullptr, strongSession)
+ << (debugBacktrace(host.getPid()), debugBacktrace(getpid()),
+ "Leaked sess: ")
+ << strongSession->getStrongCount() << " checked time " << i;
+
+ if (strongSession != nullptr) {
+ sleep(1);
+ }
+ }
}
}
};