From f5a5bb84b8595f632dbdfb4cd1a73b793d5cf6d8 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Thu, 16 Dec 2021 00:04:29 +0000 Subject: libbinder: log when wrong number of threads start Add a log when a service requests to have 0 threads but a threadpool (with a thread) is still requested to be started). This currently doesn't get hit on cuttlefish, but by triggering it manually I can see the log. Bug: 210145621 Test: trigger API misuse case and check for log Change-Id: I9113828e10812895802a83017ed8f55e851fa220 --- libs/binder/ProcessState.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libs/binder/ProcessState.cpp') diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp index 4f21cda4a1..9abe4b50bc 100644 --- a/libs/binder/ProcessState.cpp +++ b/libs/binder/ProcessState.cpp @@ -176,6 +176,11 @@ void ProcessState::startThreadPool() { AutoMutex _l(mLock); if (!mThreadPoolStarted) { + if (mMaxThreads == 0) { + ALOGW("Extra binder thread started, but 0 threads requested. Do not use " + "*startThreadPool when zero threads are requested."); + } + mThreadPoolStarted = true; spawnPooledThread(true); } -- cgit v1.2.3-59-g8ed1b