Deadlock in GAsyncqueue's mutex.
Submitted by Debdeep
Link to original bug (#788596)
Description
glib's GAsyncqueue creates a mutex using g_mutex_impl_new(), which always creates a mutex with the type PTHREAD_MUTEX_ADAPTIVE_NP, this mutex type is not robust/reliable and can cause deadlock.
Observed a deadlock in my custom playback pipeline, which uses the GAsyncqueue, in the scenario of repeated play requests. E.g : Consider a stress test scenario where repeated playback requests are given and the test is executed for days.
To overcome the issue did the following :
- Expose the GAsyncqueue's mutex to the custom playback pipeline.
- Forcefully change the mutex type from PTHREAD_MUTEX_ADAPTIVE_NP to PTHREAD_MUTEX_NORMAL.
Doing the above, resolves the issue and deadlock was not seen after repeated tests. Using PTHREAD_MUTEX_ADAPTIVE_NP causes deadlock, while PTHREAD_MUTEX_NORMAL is mapped to the non-fast type, correctness over speed and no deadlock.
Can anyone please suggest on this ?
Thanks
Version: 2.36.x