libhidlbase: avoid dlclose am: edd49128bc
Original change: https://android-review.googlesource.com/c/platform/system/libhidl/+/1592996
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: I4d23e19613633cc473b8dda746362a8a7d9db3e3
diff --git a/transport/ServiceManagement.cpp b/transport/ServiceManagement.cpp
index b51c600..c4e03c3 100644
--- a/transport/ServiceManagement.cpp
+++ b/transport/ServiceManagement.cpp
@@ -417,18 +417,27 @@
*(void **)(&generator) = dlsym(handle, sym.c_str());
if(!generator) {
const char* error = dlerror();
- LOG(ERROR) << "Passthrough lookup opened " << lib
- << " but could not find symbol " << sym << ": "
- << (error == nullptr ? "unknown error" : error);
- dlclose(handle);
- return true;
+ LOG(ERROR) << "Passthrough lookup opened " << lib << " but could not find symbol "
+ << sym << ": " << (error == nullptr ? "unknown error" : error)
+ << ". Keeping library open.";
+
+ // dlclose too problematic in multi-threaded environment
+ // dlclose(handle);
+
+ return true; // continue
}
ret = (*generator)(name.c_str());
if (ret == nullptr) {
- dlclose(handle);
- return true; // this module doesn't provide this instance name
+ LOG(ERROR) << "Could not find instance '" << name.c_str() << "' in library " << lib
+ << ". Keeping library open.";
+
+ // dlclose too problematic in multi-threaded environment
+ // dlclose(handle);
+
+ // this module doesn't provide this particular instance
+ return true; // continue
}
// Actual fqname might be a subclass.