FORTIFY: pthread_mutex_lock called on a destroyed mutex (0x<sanitized>)

Started by b_kosmowski,

b_kosmowski

In our Android app, we are currently using:

  • Bass.Net version 2.4.17.2
  • Native libraries (libbass.so and libbass_fx.so) version 2.4.16.7

Recently, we noticed an exception reported by one of our users (details below).
We're not sure what could be causing it — could it be related to the native library version, or something else?

We'd really appreciate any hints or suggestions on how to investigate or fix the issue.

Thanks in advance!

Exception details:

QuoteFORTIFY: pthread_mutex_lock called on a destroyed mutex (0x<sanitized>)

pid: 0, tid: 27554 >>> temp.android.main <<<

backtrace:
  #00  pc 0x00000000000950b0  /apex/com.android.runtime/lib64/bionic/libc.so (abort+168)
  #01  pc 0x0000000000096fe4  /apex/com.android.runtime/lib64/bionic/libc.so (__fortify_fatal(char const*, ...)+128)
  #02  pc 0x00000000000fe490  /apex/com.android.runtime/lib64/bionic/libc.so (HandleUsingDestroyedMutex(pthread_mutex_t*, char const*)+68)
  #03  pc 0x00000000000fe310  /apex/com.android.runtime/lib64/bionic/libc.so (pthread_mutex_lock+296)
  #04  pc 0x000000000000827c  /data/app/~~FXuJJAWZzXJvCZvpW5Ge6w==/temp.android.main-_hHU_RhKTUcheKfL9Pzjfg==/split_config.arm64_v8a.apk!libbass.so (BuildId: 48aed544a29d5d3bef74c4f9dde7dea952934d3f)
  #05  pc 0x000000000002dfe4  /system/lib64/libaaudio_internal.so (aaudio::AudioStream::maybeCallErrorCallback(int)+196)
  #06  pc 0x0000000000030c74  /system/lib64/libaaudio_internal.so (aaudio::AudioStreamLegacy::onAudioDeviceUpdate(int, int)+748)
  #07  pc 0x00000000000a1768  /system/lib64/libaudioclient.so (android::AudioTrack::onAudioDeviceUpdate(int, int)+328)
  #08  pc 0x00000000000757bc  /system/lib64/libaudioclient.so (android::AudioSystem::AudioFlingerClient::ioConfigChanged(android::media::AudioIoConfigEvent, android::media::AudioIoDescriptor const&)+3652)
  #09  pc 0x000000000003d738  /system/lib64/audioflinger-aidl-cpp.so (android::media::BnAudioFlingerClient::onTransact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+408)
  #10  pc 0x0000000000076638  /system/lib64/libbinder.so (android::BBinder::transact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+308)
  #11  pc 0x0000000000060c90  /system/lib64/libbinder.so (android::IPCThreadState::executeCommand(int)+1040)
  #12  pc 0x00000000000607bc  /system/lib64/libbinder.so (android::IPCThreadState::getAndExecuteCommand()+164)
  #13  pc 0x0000000000061130  /system/lib64/libbinder.so (android::IPCThreadState::joinThreadPool(bool)+116)
  #14  pc 0x000000000006af14  /system/lib64/libbinder.so (android::PoolThread::threadLoop()+132)
  #15  pc 0x00000000000142d4  /system/lib64/libutils.so (android::Thread::_threadLoop(void*)+288)
  #16  pc 0x00000000000f1934  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+144)
  #17  pc 0x00000000000fd254  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208)
  #18  pc 0x0000000000096a04  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+68)`

Ian @ un4seen

I believe this is a bug that's fixed in the latest Android BASS build, which you can get here:

   www.un4seen.com/stuff/bass-android.zip

Please try that and let me know if you still see the problem happening.