diff options
| author | 2022-09-21 22:50:20 +0000 | |
|---|---|---|
| committer | 2022-09-21 22:50:20 +0000 | |
| commit | f3ae50ca9b6f8e3ba2b6fe5de3e5e6b0f2e4fbc8 (patch) | |
| tree | 6be28326ee5fa2c34dd5b896be915db9e90ff6d8 | |
| parent | 1e353a1c63460665ed7a25650bf9cecac1770159 (diff) | |
| parent | 1f5cb20c24d07b5baf2a6d7d5b4401886377db24 (diff) | |
Merge "binder: Added info log in waitForService to display # of threads in threadpool." am: 607fcc7190 am: 1f5cb20c24
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2209898
Change-Id: I8e5491119e66c373f64b8d7b9f78cc2970946a06
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | libs/binder/IServiceManager.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libs/binder/IServiceManager.cpp b/libs/binder/IServiceManager.cpp index 5db3eef392..05db7743f2 100644 --- a/libs/binder/IServiceManager.cpp +++ b/libs/binder/IServiceManager.cpp @@ -380,6 +380,13 @@ sp<IBinder> ServiceManagerShim::waitForService(const String16& name16) if (Status status = realGetService(name, &out); !status.isOk()) { ALOGW("Failed to getService in waitForService for %s: %s", name.c_str(), status.toString8().c_str()); + if (0 == ProcessState::self()->getThreadPoolMaxTotalThreadCount()) { + ALOGW("Got service, but may be racey because we could not wait efficiently for it. " + "Threadpool has 0 guaranteed threads. " + "Is the threadpool configured properly? " + "See ProcessState::startThreadPool and " + "ProcessState::setThreadPoolMaxThreadCount."); + } return nullptr; } if (out != nullptr) return out; @@ -410,7 +417,9 @@ sp<IBinder> ServiceManagerShim::waitForService(const String16& name16) if (waiter->mBinder != nullptr) return waiter->mBinder; } - ALOGW("Waited one second for %s (is service started? are binder threads started and available?)", name.c_str()); + ALOGW("Waited one second for %s (is service started? Number of threads started in the " + "threadpool: %zu. Are binder threads started and available?)", + name.c_str(), ProcessState::self()->getThreadPoolMaxTotalThreadCount()); // Handle race condition for lazy services. Here is what can happen: // - the service dies (not processed by init yet). |