GNOME Bugzilla – Bug 747275
jackaudiosink: hangs when jackd exits
Last modified: 2016-07-25 10:27:05 UTC
Created attachment 300865 [details] stacktrace When playing over jackaudiosink and stopping jackd the pipeline gets an ERROR message after which I set the pipeline to NULL. This action never returns. Sometimes it will emit EOS before ERROR in which case I also set it to NULL; also never returns. How to reproduce: * jackd -dalsa * gst-play-1.0 --audiosink=jackaudiosink some_file.ogg * killall -2 jackd Stacktrace attached
This affects me also, using 1.6.0.
This also affects 1.6.3.
This affects me too. Using 1.8.1
Created attachment 329532 [details] Test program for reproducing the deadlock The test program can be used to reproduce the deadlock. In the deadlock situation I get the following backtracesafter setting the pipeline state to GST_STATE_NULL. (gdb) thread apply all bt
+ Trace 236317
Thread 2 (Thread 0x7fdaede68700 (LWP 30048))
Thread 1 (Thread 0x7fdaf257f700 (LWP 30037))
Created attachment 330654 [details] [review] Patch gstjackaudiosink blocks This patch prevents waiting for a callback from jack when the jack server has been shut down. So stopping a pipeline with jack elements won't block anymore if the connection to the jack server was lost.
Review of attachment 330654 [details] [review]: ::: ext/jack/gstjackaudioclient.c @@ +600,3 @@ /* make sure that we are not dispatching the client */ g_mutex_lock (&client->conn->lock); + if (client->active && !active && client->server_down == FALSE) { Don't test booleans for equality. Do "!client->server_down" here. But isn't this racy? What if it's just getting set to TRUE right after we did the check?
Yes, this may be racy but due to the fact that the callback will never be called if the jack server has disconnected I think it is much better than it is now. If it gets TRUE right after the check we have the same situation as it is now. I will change the patch with the test.
What I mean is that the boolean flag should be protected by the same mutex, and you should signal the condition variable whenever it changes. The waiting for the condition variable should probably also be > while (client->deactivate && !client->server_down) > g_cond_wait(...)
Created attachment 331073 [details] [review] Second try for the patch Hi Sebastian, I hope I got you right and made a different patch for this problem. Please take a look.
commit e67f5d60abc7ecb1ad9e7ee2b29b88d56058d8e1 Author: Thomas Scheuermann <Thomas.Scheuermann@barco.com> Date: Thu Jun 30 14:40:40 2016 +0200 jack: don't wait for callbacks if the jack server shut down Otherwise we'll wait forever. https://bugzilla.gnome.org/show_bug.cgi?id=747275