Android Codec2 component store service crashes while stopping the service

I am debugging a crash issue reported in the Android Codec2 integration of an audio decoder. The decoder component starts as a lazy service. Please see the source code below,

int main()
{
     ALOGE("Lazy Service starting...");

     ::android::hardware::configureRpcThreadpool(/*threads*/ 8, /*willJoin*/ true);
     using namespace ::android::hardware::media::c2::V1_0;

    ALOGE("Instantiating Codec2's IComponentStore service...");
    android::sp<IComponentStore> store(
            new utils::ComponentStore(android::MyComponentStore::Create()));
    
    if (store == nullptr) {
        ALOGE("Cannot create Codec2's IComponentStore service.");
    }
    else if (store->registerAsService("default3") != android::OK) {
        ALOGE("Cannot register Codec2's IComponentStore service default3.");
    } else {
        ALOGI("Codec2's IComponentStore default3 service created.");
    }

    ::android::hardware::joinRpcThreadpool();
    ALOGE("Lazy Service stopped...");

    return 0;
}

The decoder service is running while playing media files through an Android application. The audio and video playback is working correctly.

But I see a crash dump in the adb log messages when the media playback stops(when I click the ‘back’ button to exit from the player window)

--------- beginning of crash
06-10 23:18:42.875  1046  4195  4222 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
06-10 23:18:42.875  1046  4195  4222 F DEBUG   : Build fingerprint: 'Android/aosp_panther/panther:14/UP1A.231005.007.A1/eng.audio.20240510.161544:userdebug/test-keys'
06-10 23:18:42.875  1046  4195  4222 F DEBUG   : Revision: 'MP1.0'
06-10 23:18:42.875  1046  4195  4222 F DEBUG   : ABI: 'arm64'
06-10 23:18:42.875  1046  4195  4222 F DEBUG   : Timestamp: 2024-06-10 23:18:42.779663327+0530
06-10 23:18:42.875  1046  4195  4222 F DEBUG   : Process uptime: 28s
06-10 23:18:42.875  1046  4195  4222 F DEBUG   : Cmdline: /vendor/bin/hw/[email protected]
06-10 23:18:42.875  1046  4195  4222 F DEBUG   : pid: 4195, tid: 4222, name: HwBinder:4195_4  >>> /vendor/bin/hw/[email protected] <<<
06-10 23:18:42.875  1046  4195  4222 F DEBUG   : uid: 1046
06-10 23:18:42.875  1046  4195  4222 F DEBUG   : tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
06-10 23:18:42.875  1046  4195  4222 F DEBUG   : signal 0 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
06-10 23:18:42.875  1046  4195  4222 F DEBUG   : Abort message: 'terminating'
06-10 23:18:42.875  1046  4195  4222 F DEBUG   :     x0  0000000000000000  x1  000000000000107e  x2  0000000000000006  x3  00000070e6d55190
06-10 23:18:42.875  1046  4195  4222 F DEBUG   :     x4  fefefefeff666d68  x5  fefefefeff666d68  x6  fefefefeff666d68  x7  7f7f7f7f7f7f7f7f
06-10 23:18:42.875  1046  4195  4222 F DEBUG   :     x8  00000000000000f0  x9  0000007387a77050  x10 0000000000000001  x11 0000007387ac0b60
06-10 23:18:42.875  1046  4195  4222 F DEBUG   :     x12 000000738a41c020  x13 000000007fffffff  x14 00000000000547f6  x15 00000004077fedd6
06-10 23:18:42.875  1046  4195  4222 F DEBUG   :     x16 0000007387b2ccf8  x17 0000007387b09470  x18 00000070e6ac0000  x19 0000000000001063
06-10 23:18:42.875  1046  4195  4222 F DEBUG   :     x20 000000000000107e  x21 00000000ffffffff  x22 00000070e6d55300  x23 00000070e6d552c0
06-10 23:18:42.875  1046  4195  4222 F DEBUG   :     x24 ffffff80ffffffc8  x25 0000007387b2ef38  x26 0000000000000364  x27 0000000000000362
06-10 23:18:42.875  1046  4195  4222 F DEBUG   :     x28 0000000000005000  x29 00000070e6d55210
06-10 23:18:42.875  1046  4195  4222 F DEBUG   :     lr  0000007387ab1178  sp  00000070e6d55170  pc  0000007387ab11a4  pst 0000000000001000
06-10 23:18:42.875  1046  4195  4222 F DEBUG   : 20 total frames
06-10 23:18:42.875  1046  4195  4222 F DEBUG   : backtrace:
06-10 23:18:42.875  1046  4195  4222 F DEBUG   :       #00 pc 000000000005c1a4  /apex/com.android.runtime/lib64/bionic/libc.so (abort+164) (BuildId: 19c32900d9d702c303d2b4164fbba76c)
06-10 23:18:42.875  1046  4195  4222 F DEBUG   :       #01 pc 00000000000501b4  /apex/com.android.vndk.v34/lib64/libc++.so (abort_message+276) (BuildId: 0e7a8aa3d376c1c6544d64065247b1a8)
06-10 23:18:42.875  1046  4195  4222 F DEBUG   :       #02 pc 0000000000064bf8  /apex/com.android.vndk.v34/lib64/libc++.so (demangling_terminate_handler() (.__uniq.205383134706309982814331919004001075825)+72) (BuildId: 0e7a8aa3d376c1c6544d64065247b1a8)
06-10 23:18:42.875  1046  4195  4222 F DEBUG   :       #03 pc 00000000000650c8  /apex/com.android.vndk.v34/lib64/libc++.so (std::__terminate(void (*)())+8) (BuildId: 0e7a8aa3d376c1c6544d64065247b1a8)
06-10 23:18:42.875  1046  4195  4222 F DEBUG   :       #04 pc 0000000000065080  /apex/com.android.vndk.v34/lib64/libc++.so (std::terminate()+32) (BuildId: 0e7a8aa3d376c1c6544d64065247b1a8)
06-10 23:18:42.875  1046  4195  4222 F DEBUG   :       #05 pc 00000000000aa818  /apex/com.android.vndk.v34/lib64/libc++.so (std::__1::thread::~thread()+24) (BuildId: 0e7a8aa3d376c1c6544d64065247b1a8)
06-10 23:18:42.876  1046  4195  4222 F DEBUG   :       #06 pc 0000000000029b14  /vendor/lib64/[email protected] (android::hardware::media::c2::V1_0::utils::InputBufferManager::~InputBufferManager()+20) (BuildId: 64cb2eacaa9e46287c6dee01e446565f)
06-10 23:18:42.876  1046  4195  4222 F DEBUG   :       #07 pc 00000000000cd8f0  /apex/com.android.runtime/lib64/bionic/libc.so (__cxa_finalize+144) (BuildId: 19c32900d9d702c303d2b4164fbba76c)
06-10 23:18:42.876  1046  4195  4222 F DEBUG   :       #08 pc 00000000000bfa98  /apex/com.android.runtime/lib64/bionic/libc.so (exit+24) (BuildId: 19c32900d9d702c303d2b4164fbba76c)
06-10 23:18:42.876  1046  4195  4222 F DEBUG   :       #09 pc 0000000000074070  /apex/com.android.vndk.v34/lib64/libhidlbase.so (android::hardware::details::ClientCounterCallback::tryShutdownLocked()+320) (BuildId: 3797c42cd4e3a5ee79f1e760e1466d51)
06-10 23:18:42.876  1046  4195  4222 F DEBUG   :       #10 pc 0000000000073c6c  /apex/com.android.vndk.v34/lib64/libhidlbase.so (android::hardware::details::ClientCounterCallback::onClients(android::sp<android::hidl::base::V1_0::IBase> const&, bool)+300) (BuildId: 3797c42cd4e3a5ee79f1e760e1466d51)
06-10 23:18:42.876  1046  4195  4222 F DEBUG   :       #11 pc 000000000009a96c  /apex/com.android.vndk.v34/lib64/libhidlbase.so (android::hidl::manager::V1_2::BnHwClientCallback::_hidl_onClients(android::hidl::base::V1_0::BnHwBase*, android::hardware::Parcel const&, android::hardware::Parcel*, std::__1::function<void (android::hardware::Parcel&)>)+332) (BuildId: 3797c42cd4e3a5ee79f1e760e1466d51)
06-10 23:18:42.876  1046  4195  4222 F DEBUG   :       #12 pc 000000000009acf8  /apex/com.android.vndk.v34/lib64/libhidlbase.so (android::hidl::manager::V1_2::BnHwClientCallback::onTransact(unsigned int, android::hardware::Parcel const&, android::hardware::Parcel*, unsigned int, std::__1::function<void (android::hardware::Parcel&)>)+88) (BuildId: 3797c42cd4e3a5ee79f1e760e1466d51)
06-10 23:18:42.876  1046  4195  4222 F DEBUG   :       #13 pc 00000000000ac41c  /apex/com.android.vndk.v34/lib64/libhidlbase.so (android::hardware::BHwBinder::transact(unsigned int, android::hardware::Parcel const&, android::hardware::Parcel*, unsigned int, std::__1::function<void (android::hardware::Parcel&)>)+156) (BuildId: 3797c42cd4e3a5ee79f1e760e1466d51)
06-10 23:18:42.876  1046  4195  4222 F DEBUG   :       #14 pc 0000000000052874  /apex/com.android.vndk.v34/lib64/libhidlbase.so (android::hardware::IPCThreadState::executeCommand(int)+996) (BuildId: 3797c42cd4e3a5ee79f1e760e1466d51)
06-10 23:18:42.876  1046  4195  4222 F DEBUG   :       #15 pc 000000000006669c  /apex/com.android.vndk.v34/lib64/libhidlbase.so (android::hardware::IPCThreadState::joinThreadPool(bool)+668) (BuildId: 3797c42cd4e3a5ee79f1e760e1466d51)
06-10 23:18:42.876  1046  4195  4222 F DEBUG   :       #16 pc 00000000000705f8  /apex/com.android.vndk.v34/lib64/libhidlbase.so (android::hardware::PoolThread::threadLoop()+24) (BuildId: 3797c42cd4e3a5ee79f1e760e1466d51)
06-10 23:18:42.876  1046  4195  4222 F DEBUG   :       #17 pc 000000000000fe18  /apex/com.android.vndk.v34/lib64/libutils.so (android::Thread::_threadLoop(void*)+584) (BuildId: 625583f4cd601a4f751800f91b840e76)
06-10 23:18:42.876  1046  4195  4222 F DEBUG   :       #18 pc 00000000000c9ccc  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+204) (BuildId: 19c32900d9d702c303d2b4164fbba76c)
06-10 23:18:42.876  1046  4195  4222 F DEBUG   :       #19 pc 000000000005db00  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: 19c32900d9d702c303d2b4164fbba76c)

Detailed log message is available here

Seems like the problem is occurring while the thread join. Could you please suggest to me any possible solution to fix this issue?

Here is the service’s .rc file.

service vendor-media-c2-hal-1-0-audiocodec /vendor/bin/hw/[email protected]
    interface [email protected]::IComponentStore default3
    class hal
    oneshot
    disabled
    user mediacodec
    group mediadrm camera drmrpc system
    ioprio rt 4

New contributor

Rahul M is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật