Skip to content

Commit

Permalink
libutils: Restore old RefBase-behavior for SDK < Q to avoid loops wit…
Browse files Browse the repository at this point in the history
…h legacy blobs

09-14 01: 13:36.048   528   528 D RefBase : RefBase: Explicit destruction, weak count = 0 (in 0xe5afad00)
09-14 01: 13:36.114   528   528 D RefBase : #00 pc 0000b1bd  /system/lib/libutils.so (android::RefBase::~RefBase()+104)
09-14 01: 13:36.114   528   528 D RefBase : #01 pc 0009b15b  /vendor/lib/hw/camera.msm8994.so (qcamera::CKPIItem::~CKPIItem()+22)
09-14 01: 13:36.114   528   528 D RefBase : aosp-mirror#2 pc 0009b195  /vendor/lib/hw/camera.msm8994.so (qcamera::frame_quality::~frame_quality()+24)
09-14 01: 13:36.114   528   528 D RefBase : aosp-mirror#3 pc 000abed9  /vendor/lib/hw/camera.msm8994.so (qcamera::Hal8994_EXT::~Hal8994_EXT()+112)
09-14 01: 13:36.114   528   528 D RefBase : aosp-mirror#4 pc 000abff1  /vendor/lib/hw/camera.msm8994.so (qcamera::Hal8994_EXT::~Hal8994_EXT()+4)
09-14 01: 13:36.114   528   528 D RefBase : aosp-mirror#5 pc 0006751f  /vendor/lib/hw/camera.msm8994.so (qcamera::QCamera2HardwareInterface::~QCamera2HardwareInterface()+174)
09-14 01: 13:36.114   528   528 D RefBase : aosp-mirror#6 pc 00067585  /vendor/lib/hw/camera.msm8994.so (qcamera::QCamera2HardwareInterface::~QCamera2HardwareInterface()+4)
09-14 01: 13:36.115   528   528 D RefBase : aosp-mirror#7 pc 0005be5d  /vendor/lib/hw/camera.msm8994.so (qcamera::QCamera2HardwareInterface::close_camera_device(hw_device_t*)+148)
09-14 01: 13:36.115   528   528 D RefBase : aosp-mirror#8 pc 00015627  /vendor/lib/camera.device@1.0-impl-hima.so (android::hardware::camera::device::V1_0::implementation::CameraDevice::close()+54)
09-14 01: 13:36.115   528   528 D RefBase : aosp-mirror#9 pc 00026819  /system/lib/android.hardware.camera.device@1.0.so (android::hardware::camera::device::V1_0::BsCameraDevice::close()+76)
09-14 01: 13:36.115   528   528 D RefBase : aosp-mirror#10 pc 000ed439  /system/lib/libcameraservice.so (android::CameraHardwareInterface::release()+32)
09-14 01: 13:36.115   528   528 D RefBase : aosp-mirror#11 pc 000b53f1  /system/lib/libcameraservice.so (android::CameraClient::disconnect()+164)
09-14 01: 13:36.115   528   528 D RefBase : aosp-mirror#12 pc 0002eda7  /system/lib/libcamera_client.so (android::hardware::BnCamera::onTransact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+106)
09-14 01: 13:36.115   528   528 D RefBase : aosp-mirror#13 pc 00032ee5  /system/lib/libbinder.so (android::BBinder::transact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+72)
09-14 01: 13:36.115   528   528 D RefBase : aosp-mirror#14 pc 0003afe9  /system/lib/libbinder.so (android::IPCThreadState::executeCommand(int)+768)
09-14 01: 13:36.115   528   528 D RefBase : aosp-mirror#15 pc 0003ac2b  /system/lib/libbinder.so (android::IPCThreadState::getAndExecuteCommand()+98)
09-14 01: 13:36.115   528   528 D RefBase : aosp-mirror#16 pc 0003b1bf  /system/lib/libbinder.so (android::IPCThreadState::joinThreadPool(bool)+38)
09-14 01: 13:36.115   528   528 D RefBase : aosp-mirror#17 pc 000010ab  /system/bin/cameraserver (main+102)
09-14 01: 13:36.115   528   528 D RefBase : aosp-mirror#18 pc 000598f9  /apex/com.android.runtime/lib/bionic/libc.so (__libc_init+68)
09-14 01: 13:36.115   528   528 D RefBase : aosp-mirror#19 pc 0000102f  /system/bin/cameraserver (_start_main+38)
09-14 01: 13:36.115   528   528 D RefBase : aosp-mirror#20 pc 0000446e  <anonymous:ecdf3000>
Change-Id: I586a51d77968aec93d27c17aa92d0b3a55fb4878

Change-Id: Icd2bf08f14759e833e59c393f0f1771dd61128c3
  • Loading branch information
chaosmaster authored and elginsk8r committed Dec 10, 2021
1 parent e6767e2 commit 974d0e6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions libutils/Android.bp
Expand Up @@ -164,6 +164,7 @@ cc_library {
srcs: [
"Trace.cpp",
],
cflags: ["-DCHECK_SDK"],
},
linux: {
header_libs: ["libbase_headers"],
Expand Down
20 changes: 15 additions & 5 deletions libutils/RefBase.cpp
Expand Up @@ -751,16 +751,26 @@ RefBase::~RefBase()
}
} else if (mRefs->mStrong.load(std::memory_order_relaxed) == INITIAL_STRONG_VALUE) {
// We never acquired a strong reference on this object.
#ifdef CHECK_SDK
#include <android/api-level.h>
// In Android Q this also fails for objects with 0 weak references.
// Restore old behavior if the SDK version precedes Q.
if ((android_get_application_target_sdk_version() >= __ANDROID_API_Q__) || (mRefs->mWeak.load() != 0)) {
#endif
#if DEBUG_REFBASE_DESTRUCTION
// Treating this as fatal is prone to causing boot loops. For debugging, it's
// better to treat as non-fatal.
ALOGD("RefBase: Explicit destruction, weak count = %d (in %p)", mRefs->mWeak.load(), this);
// Treating this as fatal is prone to causing boot loops. For debugging, it's
// better to treat as non-fatal.
ALOGD("RefBase: Explicit destruction, weak count = %d (in %p)", mRefs->mWeak.load(), this);

#if CALLSTACK_ENABLED
CallStack::logStack(LOG_TAG);
CallStack::logStack(LOG_TAG);
#endif
#else
LOG_ALWAYS_FATAL("RefBase: Explicit destruction, weak count = %d", mRefs->mWeak.load());
LOG_ALWAYS_FATAL("RefBase: Explicit destruction, weak count = %d", mRefs->mWeak.load());
#endif
#ifdef CHECK_SDK
}
delete mRefs;
#endif
}
// For debugging purposes, clear mRefs. Ineffective against outstanding wp's.
Expand Down

0 comments on commit 974d0e6

Please sign in to comment.