GNOME Bugzilla – Bug 644510
pulsesink: deadlock when create/connect fails
Last modified: 2011-03-11 19:22:49 UTC
My fix for https://bugzilla.gnome.org/show_bug.cgi?id=643087 introduced another deadlock instead. If gst_pulseringbuffer_open_device reaches the goto create_failed or connect_failed between the g_mutex_lock and g_mutex_unlock, pa_shared_resource_mutex is not released.
What's more, this is worse than the original deadlock, because no race condition is involved, it can happen with just one pulsesink instance.
Created attachment 183165 [details] [review] candidate fix I'm not thrilled about need_unlock flags like this, but this patch is what I could cook up this afternoon.
The following fix has been pushed: 387f533 pulsesink: Fix deadlock if connecting to PA fails Thanks, I've pushed a simpler version of your fix.
Created attachment 183171 [details] [review] pulsesink: Fix deadlock if connecting to PA fails Commit dd4ec22e introduced a deadlock in the failure path while trying to connect to PulseAudio. This makes sure we drop the lock on the resource mutex to avoid this.
Arun, your fix will cause g_mutex_unlock to be called twice when the function fails in the third goto. It's possible that another thread has taken the lock before we unlock it the second time. I'm not sure what the consequence would be, but I assume it's bad.
Erf, you're right. Reverted my fix and applied yours. Thanks!