From af4ca715bd1820616e04fcc63ad4e64d64df4024 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Mon, 24 May 2021 23:22:08 +0000 Subject: binderRpcTest: use waitpid Actually reap child processes. This gives us stronger guarantees (that everything can shut down) and it avoids 'kill'. Bug: 186661301 Test: binderRpcTest Change-Id: If10f00de845eb8097813b4edbf8e2b8ffdc90c5f --- libs/binder/RpcServer.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'libs/binder/RpcServer.cpp') diff --git a/libs/binder/RpcServer.cpp b/libs/binder/RpcServer.cpp index bff5543c9b..93f970946a 100644 --- a/libs/binder/RpcServer.cpp +++ b/libs/binder/RpcServer.cpp @@ -193,10 +193,12 @@ bool RpcServer::shutdown() { mShutdownTrigger->trigger(); while (mJoinThreadRunning || !mConnectingThreads.empty() || !mSessions.empty()) { - ALOGI("Waiting for RpcServer to shut down. Join thread running: %d, Connecting threads: " - "%zu, Sessions: %zu", - mJoinThreadRunning, mConnectingThreads.size(), mSessions.size()); - mShutdownCv.wait(_l); + if (std::cv_status::timeout == mShutdownCv.wait_for(_l, std::chrono::seconds(1))) { + ALOGE("Waiting for RpcServer to shut down (1s w/o progress). Join thread running: %d, " + "Connecting threads: " + "%zu, Sessions: %zu. Is your server deadlocked?", + mJoinThreadRunning, mConnectingThreads.size(), mSessions.size()); + } } // At this point, we know join() is about to exit, but the thread that calls -- cgit v1.2.3-59-g8ed1b