Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5704271e authored by Steven Moreland's avatar Steven Moreland
Browse files

binderRpcTest: session leak investigation part IV

Repros in infra every once in a while, local repro
reported w/ concurrent build, but unable to repro
overnight.

Bug: 244325464
Test: binderRpcTest
Change-Id: I07a173dd3b670d5dd80fc37eb9819ede7d305aa6
parent 23f910cb
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -181,10 +181,20 @@ struct ProcessSession {
            wp<RpcSession> weakSession = session;
            session = nullptr;

            // 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();
                        << (debugBacktrace(host.getPid()), debugBacktrace(getpid()),
                            "Leaked sess: ")
                        << strongSession->getStrongCount() << " checked time " << i;

                if (strongSession != nullptr) {
                    sleep(1);
                }
            }
        }
    }
};