When the rtsp client handles a request (Thread 9) it wait's for the stream lock on src pad of a queue ("queue58324", 0x72e4edf8). That lock is held by "queue58324"'s streaming thread (Thread 12).

(Thread 8) is executing a bus message, and it wait's for the rtsp-media lock (that lock is held by Thread 9).

Thread 12 (LWP 14722):
#0  __pthread_cond_wait (cond=0x73c7a360, mutex=0x73472100) at pthread_cond_wait.c:156
#1  0x772103c8 in g_cond_wait (cond=<optimized out>, mutex=<optimized out>) at glib/glib/gthread-posix.c:750
#2  0x758589fc in gst_queue_loop (pad=<optimized out>) at gstreamer/plugins/elements/gstqueue.c:1232
#3  0x773b5708 in gst_task_func (task=0x734d3738) at gstreamer/gst/gsttask.c:316
#4  0x771ec12c in g_thread_pool_thread_proxy (data=<optimized out>) at glib/glib/gthreadpool.c:309
#5  0x771eb4f8 in g_thread_proxy (data=0x75715630) at glib/glib/gthread.c:798
#6  0x771455b8 in start_thread (arg=0x718ff4b0) at pthread_create.c:310
#7  0x76e6ecfc in __thread_start () from target/mipsisa32r2el-axis-linux-gnu/lib/libc.so.6
Backtrace stopped: frame did not save the PC

(gdb) f 2
(gdb) list
1227	      GST_QUEUE_MUTEX_LOCK_CHECK (queue, out_flushing);
1228	    }
1229	
1230	    /* we recheck, the signal could have changed the thresholds */
1231	    while (gst_queue_is_empty (queue)) {
1232	      GST_QUEUE_WAIT_ADD_CHECK (queue, out_flushing);
1233	    }
1234	
1235	    GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "queue is not empty");
1236	    if (!queue->silent) {
(gdb) f 2
(gdb) p queue
$5 = (GstQueue *) 0x72e4edf8
(gdb) p *queue
$6 = {element = {object = {object = {g_type_instance = {g_class = 0x7572e450}, ref_count = 8, qdata = 0x0}, lock = {p = 0x73e6bfd8, i = {1944502232, 0}}, name = 0x73e85d50 "queue58324", parent = 0x734539a8, 
      flags = 0, control_bindings = 0x0, control_rate = 100000000, last_sync = 18446744073709551615, _gst_reserved = 0x0}, state_lock = {p = 0x73cba680, i = {0, 0}}, state_cond = {p = 0x73ea4bb0, i = {0, 0}}, 
    state_cookie = 5, target_state = GST_STATE_READY, current_state = GST_STATE_PAUSED, next_state = GST_STATE_READY, pending_state = GST_STATE_READY, last_return = GST_STATE_CHANGE_ASYNC, bus = 0x73c84240, 
    clock = 0x6e40a0, base_time = 16564451140035, start_time = 4131892945, numpads = 2, pads = 0x73a5e570, numsrcpads = 1, srcpads = 0x734ed200, numsinkpads = 1, sinkpads = 0x73444c20, pads_cookie = 2, 
    _gst_reserved = {0x0, 0x0, 0x0, 0x0}}, sinkpad = 0x73a50520, srcpad = 0x73aa9ba8, sink_segment = {flags = GST_SEGMENT_FLAG_NONE, rate = 1, applied_rate = 1, format = GST_FORMAT_TIME, base = 15160434000, 
    offset = 0, start = 0, stop = 18446744073709551615, time = 15160434000, position = 0, duration = 3598548666, _gst_reserved = {0x0, 0x0, 0x0, 0x0}}, src_segment = {flags = GST_SEGMENT_FLAG_NONE, rate = 1, 
    applied_rate = 1, format = GST_FORMAT_TIME, base = 15160434000, offset = 0, start = 0, stop = 18446744073709551615, time = 15160434000, position = 0, duration = 3598548666, _gst_reserved = {0x0, 0x0, 0x0, 
      0x0}}, sinktime = 15160434000, srctime = 15160434000, sink_tainted = 0, src_tainted = 0, srcresult = GST_FLOW_OK, unexpected = 0, eos = 0, queue = 0x73c7d108, cur_level = {buffers = 0, bytes = 0, 
    time = 0}, max_size = {buffers = 200, bytes = 10485760, time = 1000000000}, min_threshold = {buffers = 0, bytes = 0, time = 0}, orig_min_threshold = {buffers = 0, bytes = 0, time = 0}, leaky = 0, qlock = {
    p = 0x73472100, i = {1934041344, 0}}, waiting_add = 1, item_add = {p = 0x73c7a360, i = {0, 0}}, waiting_del = 0, item_del = {p = 0x71f966b8, i = {0, 0}}, head_needs_discont = 0, tail_needs_discont = 0, 
  push_newsegment = 0, silent = 0, newseg_applied_to_src = 0, query_handled = {p = 0x71f966f0, i = {0, 0}}, last_query = 0, flush_on_eos = 0}
(gdb) f 2
(gdb) p (GstPad *)((GstElement *)queue)->srcpads->data
$16 = (GstPad *) 0x73aa9ba8
(gdb) p *(GstPad *)((GstElement *)queue)->srcpads->data
$17 = {object = {object = {g_type_instance = {g_class = 0x696900}, ref_count = 5, qdata = 0x0}, lock = {p = 0x7621d4d0, i = {1981928656, 0}}, name = 0x71f42f68 "src", parent = 0x72e4edf8, flags = 4864, 
    control_bindings = 0x0, control_rate = 100000000, last_sync = 18446744073709551615, _gst_reserved = 0x0}, element_private = 0x0, padtemplate = 0x73445a58, direction = GST_PAD_SRC, stream_rec_lock = {
    p = 0x73a4fd90, i = {0, 0}}, task = 0x734d3738, block_cond = {p = 0x76285a48, i = {0, 0}}, probes = {seq_id = 1, hook_size = 36, is_setup = 1, hooks = 0x0, dummy3 = 0x0, 
    finalize_hook = 0x771a6720 <default_finalize_hook>, dummy = {0x0, 0x0}}, mode = GST_PAD_MODE_NONE, activatefunc = 0x7737e448 <gst_pad_activate_default>, activatedata = 0x0, activatenotify = 0x0, 
  activatemodefunc = 0x75857d8c <gst_queue_src_activate_mode>, activatemodedata = 0x0, activatemodenotify = 0x0, peer = 0x73488bf0, linkfunc = 0x0, linkdata = 0x0, linknotify = 0x0, unlinkfunc = 0x0, 
  unlinkdata = 0x0, unlinknotify = 0x0, chainfunc = 0x0, chaindata = 0x0, chainnotify = 0x0, chainlistfunc = 0x773794ac <gst_pad_chain_list_default>, chainlistdata = 0x0, chainlistnotify = 0x0, 
  getrangefunc = 0x0, getrangedata = 0x0, getrangenotify = 0x0, eventfunc = 0x75857b14 <gst_queue_handle_src_event>, eventdata = 0x0, eventnotify = 0x0, offset = 0, 
  queryfunc = 0x7585786c <gst_queue_handle_src_query>, querydata = 0x0, querynotify = 0x0, iterintlinkfunc = 0x77379e78 <gst_pad_iterate_internal_links_default>, iterintlinkdata = 0x0, iterintlinknotify = 0x0, 
  num_probes = 0, num_blocked = 0, priv = 0x73aa9cd8, _gst_reserved = {0x0, 0x0, 0x0, 0x0}}
(gdb) f 3
(gdb) p task
$7 = (GstTask *) 0x734d3738
(gdb) p *task
$8 = {object = {object = {g_type_instance = {g_class = 0x699248}, ref_count = 4, qdata = 0x2}, lock = {p = 0x73e8ac60, i = {1944628320, 0}}, name = 0x73e6ff90 "queue58324:src", parent = 0x0, flags = 0, 
    control_bindings = 0x0, control_rate = 100000000, last_sync = 18446744073709551615, _gst_reserved = 0x0}, state = GST_TASK_STARTED, cond = {p = 0x71f6d388, i = {0, 0}}, lock = 0x73aa9bf4, 
  func = 0x75858768 <gst_queue_loop>, user_data = 0x73aa9ba8, notify = 0x0, running = 1, thread = 0x75715630, priv = 0x734d37b8, _gst_reserved = {0x0, 0x0, 0x0, 0x0}}


Thread 9 (LWP 14587):
#0  __lll_lock_wait (futex=0x73a4fd90, private=0) at ../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:46
#1  0x77147c1c in __pthread_mutex_lock (mutex=0x73a4fd90) at pthread_mutex_lock.c:89
#2  0x7738418c in gst_pad_stop_task (pad=0x73aa9ba8) at gstreamer/gst/gstpad.c:5526
#3  0x7737d9b0 in gst_pad_activate_mode (pad=0x73aa9ba8, mode=GST_PAD_MODE_PUSH, active=0) at gstreamer/gst/gstpad.c:1089
#4  0x7737e304 in gst_pad_set_active (pad=0x73aa9ba8, active=0) at gstreamer/gst/gstpad.c:975
#5  0x77357ae0 in activate_pads (vpad=0x751fa6c0, ret=0x751fa710, active=0x751fa784) at gstreamer/gst/gstelement.c:2687
#6  0x7736c454 in gst_iterator_fold (it=0x73ca66d0, func=0x77357a9c <activate_pads>, ret=0x751fa710, user_data=0x751fa784)
    at gstreamer/gst/gstiterator.c:614
#7  0x77357f78 in iterator_activate_fold_with_resync (iter=0x73ca66d0, user_data=0x751fa784, func=0x77357a9c <activate_pads>)
    at gstreamer/gst/gstelement.c:2707
#8  0x7735a8c8 in gst_element_pads_activate (element=0x72e4edf8, active=0) at gstreamer/gst/gstelement.c:2743
#9  0x7735acc8 in gst_element_change_state_func (element=0x72e4edf8, transition=<optimized out>) at gstreamer/gst/gstelement.c:2815
#10 0x7735d484 in gst_element_change_state (element=0x72e4edf8, transition=<optimized out>) at gstreamer/gst/gstelement.c:2602
#11 0x7735e08c in gst_element_set_state_func (element=0x72e4edf8, state=<optimized out>) at gstreamer/gst/gstelement.c:2558
#12 0x77338b80 in gst_bin_element_set_state (next=GST_STATE_READY, current=GST_STATE_PAUSED, start_time=4131892945, base_time=16564451140035, element=0x72e4edf8, bin=0x734539a8)
    at gstreamer/gst/gstbin.c:2325
#13 gst_bin_change_state_func (element=0x734539a8, transition=GST_STATE_CHANGE_PAUSED_TO_READY) at gstreamer/gst/gstbin.c:2648
#14 0x77386430 in gst_pipeline_change_state (element=0x734539a8, transition=GST_STATE_CHANGE_PAUSED_TO_READY)
    at gstreamer/gst/gstpipeline.c:471
#15 0x7735d484 in gst_element_change_state (element=0x734539a8, transition=<optimized out>) at gstreamer/gst/gstelement.c:2602
#16 0x7735e08c in gst_element_set_state_func (element=0x734539a8, state=<optimized out>) at gstreamer/gst/gstelement.c:2558
#17 0x774a9e4c in finish_unprepare (media=0x70a2f8) at gst-rtsp-server/gst/rtsp-server/rtsp-media.c:2395
#18 0x774af87c in gst_rtsp_media_unprepare (media=0x70a2f8) at gst-rtsp-server/gst/rtsp-server/rtsp-media.c:2513
#19 0x774b10a8 in gst_rtsp_media_set_state (media=0x70a2f8, state=GST_STATE_NULL, transports=0x73a72d38) at gst-rtsp-server/gst/rtsp-server/rtsp-media.c:3027
#20 0x774c10fc in gst_rtsp_session_media_set_state (media=<optimized out>, state=GST_STATE_NULL) at gst-rtsp-server/gst/rtsp-server/rtsp-session-media.c:453
#21 0x774c8d10 in handle_teardown_request (ctx=0x751fac18, client=0x7726a0) at gst-rtsp-server/gst/rtsp-server/rtsp-client.c:900
#22 handle_request (request=<optimized out>, client=0x7726a0) at gst-rtsp-server/gst/rtsp-server/rtsp-client.c:2216
#23 gst_rtsp_client_handle_message (client=0x7726a0, message=<optimized out>) at gst-rtsp-server/gst/rtsp-server/rtsp-client.c:2778
#24 0x77951338 in gst_rtsp_source_dispatch_read (stream=<optimized out>, watch=0x777800) at gst-plugins-base/gst-libs/gst/rtsp/gstrtspconnection.c:3141
#25 0x771bc244 in g_main_dispatch (context=0x776178) at glib/glib/gmain.c:3061
#26 g_main_context_dispatch (context=0x776178) at glib/glib/gmain.c:3637
#27 0x771bc698 in g_main_context_iterate (context=0x776178, block=1, dispatch=1, self=<optimized out>) at glib/glib/gmain.c:3708
#28 0x771bcd44 in g_main_loop_run (loop=0x74e8e0) at glib/glib/gmain.c:3902
#29 0x774a6a44 in do_loop (thread=0x7346a388) at gst-rtsp-server/gst/rtsp-server/rtsp-thread-pool.c:329
#30 0x771ec12c in g_thread_pool_thread_proxy (data=<optimized out>) at glib/glib/gthreadpool.c:309
#31 0x771eb4f8 in g_thread_proxy (data=0x73ec9cc0) at glib/glib/gthread.c:798
#32 0x771455b8 in start_thread (arg=0x751fb4b0) at pthread_create.c:310
#33 0x76e6ecfc in __thread_start () from target/mipsisa32r2el-axis-linux-gnu/lib/libc.so.6
Backtrace stopped: frame did not save the PC

(gdb) f 11
(gdb) p (GstQueue *)element
$20 = (GstQueue *) 0x72e4edf8
(gdb) p *(GstQueue *)element
$19 = {element = {object = {object = {g_type_instance = {g_class = 0x7572e450}, ref_count = 8, qdata = 0x0}, lock = {p = 0x73e6bfd8, i = {1944502232, 0}}, name = 0x73e85d50 "queue58324", parent = 0x734539a8, 
      flags = 0, control_bindings = 0x0, control_rate = 100000000, last_sync = 18446744073709551615, _gst_reserved = 0x0}, state_lock = {p = 0x73cba680, i = {0, 0}}, state_cond = {p = 0x73ea4bb0, i = {0, 0}}, 
    state_cookie = 5, target_state = GST_STATE_READY, current_state = GST_STATE_PAUSED, next_state = GST_STATE_READY, pending_state = GST_STATE_READY, last_return = GST_STATE_CHANGE_ASYNC, bus = 0x73c84240, 
    clock = 0x6e40a0, base_time = 16564451140035, start_time = 4131892945, numpads = 2, pads = 0x73a5e570, numsrcpads = 1, srcpads = 0x734ed200, numsinkpads = 1, sinkpads = 0x73444c20, pads_cookie = 2, 
    _gst_reserved = {0x0, 0x0, 0x0, 0x0}}, sinkpad = 0x73a50520, srcpad = 0x73aa9ba8, sink_segment = {flags = GST_SEGMENT_FLAG_NONE, rate = 1, applied_rate = 1, format = GST_FORMAT_TIME, base = 15160434000, 
    offset = 0, start = 0, stop = 18446744073709551615, time = 15160434000, position = 0, duration = 3598548666, _gst_reserved = {0x0, 0x0, 0x0, 0x0}}, src_segment = {flags = GST_SEGMENT_FLAG_NONE, rate = 1, 
    applied_rate = 1, format = GST_FORMAT_TIME, base = 15160434000, offset = 0, start = 0, stop = 18446744073709551615, time = 15160434000, position = 0, duration = 3598548666, _gst_reserved = {0x0, 0x0, 0x0, 
      0x0}}, sinktime = 15160434000, srctime = 15160434000, sink_tainted = 0, src_tainted = 0, srcresult = GST_FLOW_OK, unexpected = 0, eos = 0, queue = 0x73c7d108, cur_level = {buffers = 0, bytes = 0, 
    time = 0}, max_size = {buffers = 200, bytes = 10485760, time = 1000000000}, min_threshold = {buffers = 0, bytes = 0, time = 0}, orig_min_threshold = {buffers = 0, bytes = 0, time = 0}, leaky = 0, qlock = {
    p = 0x73472100, i = {1934041344, 0}}, waiting_add = 1, item_add = {p = 0x73c7a360, i = {0, 0}}, waiting_del = 0, item_del = {p = 0x71f966b8, i = {0, 0}}, head_needs_discont = 0, tail_needs_discont = 0, 
  push_newsegment = 0, silent = 0, newseg_applied_to_src = 0, query_handled = {p = 0x71f966f0, i = {0, 0}}, last_query = 0, flush_on_eos = 0}
(gdb) f 2
#2  0x7738418c in gst_pad_stop_task (pad=0x73aa9ba8) at gstreamer/gst/gstpad.c:5526
(gdb) list
5521	    goto no_task;
5522	  GST_PAD_TASK (pad) = NULL;
5523	  res = gst_task_set_state (task, GST_TASK_STOPPED);
5524	  GST_OBJECT_UNLOCK (pad);
5525	
5526	  GST_PAD_STREAM_LOCK (pad);
5527	  GST_PAD_STREAM_UNLOCK (pad);
5528	
5529	  if (!gst_task_join (task))
5530	    goto join_failed;
(gdb) f 2
(gdb) p task
$21 = (GstTask *) 0x73443000
(gdb) p *task
$22 = {object = {object = {g_type_instance = {g_class = 0x699248}, ref_count = 2, qdata = 0x2}, lock = {p = 0x76284f88, i = {1982353288, 0}}, name = 0x762bf6a8 "queue58324:src", parent = 0x0, flags = 0, 
    control_bindings = 0x0, control_rate = 100000000, last_sync = 18446744073709551615, _gst_reserved = 0x0}, state = GST_TASK_STOPPED, cond = {p = 0x73a5be50, i = {0, 0}}, lock = 0x73aa9bf4, 
  func = 0x75858768 <gst_queue_loop>, user_data = 0x73aa9ba8, notify = 0x0, running = 0, thread = 0x0, priv = 0x73443080, _gst_reserved = {0x0, 0x0, 0x0, 0x0}}
(gdb) f 2
(gdb) p pad
$1 = (GstPad *) 0x73aa9ba8
(gdb) p *pad
$2 = {object = {object = {g_type_instance = {g_class = 0x696900}, ref_count = 5, qdata = 0x0}, lock = {p = 0x7621d4d0, i = {1981928656, 0}}, name = 0x71f42f68 "src", parent = 0x72e4edf8, flags = 4864, 
    control_bindings = 0x0, control_rate = 100000000, last_sync = 18446744073709551615, _gst_reserved = 0x0}, element_private = 0x0, padtemplate = 0x73445a58, direction = GST_PAD_SRC, stream_rec_lock = {
    p = 0x73a4fd90, i = {0, 0}}, task = 0x734d3738, block_cond = {p = 0x76285a48, i = {0, 0}}, probes = {seq_id = 1, hook_size = 36, is_setup = 1, hooks = 0x0, dummy3 = 0x0, 
    finalize_hook = 0x771a6720 <default_finalize_hook>, dummy = {0x0, 0x0}}, mode = GST_PAD_MODE_NONE, activatefunc = 0x7737e448 <gst_pad_activate_default>, activatedata = 0x0, activatenotify = 0x0, 
  activatemodefunc = 0x75857d8c <gst_queue_src_activate_mode>, activatemodedata = 0x0, activatemodenotify = 0x0, peer = 0x73488bf0, linkfunc = 0x0, linkdata = 0x0, linknotify = 0x0, unlinkfunc = 0x0, 
  unlinkdata = 0x0, unlinknotify = 0x0, chainfunc = 0x0, chaindata = 0x0, chainnotify = 0x0, chainlistfunc = 0x773794ac <gst_pad_chain_list_default>, chainlistdata = 0x0, chainlistnotify = 0x0, 
  getrangefunc = 0x0, getrangedata = 0x0, getrangenotify = 0x0, eventfunc = 0x75857b14 <gst_queue_handle_src_event>, eventdata = 0x0, eventnotify = 0x0, offset = 0, 
  queryfunc = 0x7585786c <gst_queue_handle_src_query>, querydata = 0x0, querynotify = 0x0, iterintlinkfunc = 0x77379e78 <gst_pad_iterate_internal_links_default>, iterintlinkdata = 0x0, iterintlinknotify = 0x0, 
  num_probes = 0, num_blocked = 0, priv = 0x73aa9cd8, _gst_reserved = {0x0, 0x0, 0x0, 0x0}}


Thread 8 (LWP 14549):
#0  __lll_lock_wait (futex=0x7342b690, private=0) at ../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:46
#1  0x77147c1c in __pthread_mutex_lock (mutex=0x7342b690) at pthread_mutex_lock.c:89
#2  0x774a86b0 in bus_message (bus=0x73403ec0, message=0x72e3b918, media=0x70a2f8) at gst-rtsp-server/gst/rtsp-server/rtsp-media.c:1914
#3  0x7734345c in gst_bus_source_dispatch (source=0x73e874c0, callback=0x774a8668 <bus_message>, user_data=0x70a2f8)
    at gstreamer/gst/gstbus.c:769
#4  0x771bc244 in g_main_dispatch (context=0x734d6780) at glib/glib/gmain.c:3061
#5  g_main_context_dispatch (context=0x734d6780) at glib/glib/gmain.c:3637
#6  0x771bc698 in g_main_context_iterate (context=0x734d6780, block=1, dispatch=1, self=<optimized out>) at glib/glib/gmain.c:3708
#7  0x771bcd44 in g_main_loop_run (loop=0x71fdcbf0) at glib/glib/gmain.c:3902
#8  0x774a6a44 in do_loop (thread=0x776358) at gst-rtsp-server/gst/rtsp-server/rtsp-thread-pool.c:329
#9  0x771ec12c in g_thread_pool_thread_proxy (data=<optimized out>) at glib/glib/gthreadpool.c:309
#10 0x771eb4f8 in g_thread_proxy (data=0x73eb23b0) at glib/glib/gthread.c:798
#11 0x771455b8 in start_thread (arg=0x737ff4b0) at pthread_create.c:310
#12 0x76e6ecfc in __thread_start () from target/mipsisa32r2el-axis-linux-gnu/lib/libc.so.6
Backtrace stopped: frame did not save the PCi

(gdb) f 2
#2  0x774a86b0 in bus_message (bus=0x73403ec0, message=0x72e3b918, media=0x70a2f8) at gst-rtsp-server/gst/rtsp-server/rtsp-media.c:1914
(gdb) list
1909	  GstRTSPMediaClass *klass;
1910	  gboolean ret;
1911	
1912	  klass = GST_RTSP_MEDIA_GET_CLASS (media);
1913	
1914	  g_rec_mutex_lock (&priv->state_lock);
1915	  if (klass->handle_message)
1916	    ret = klass->handle_message (media, message);
1917	  else
1918	    ret = FALSE;
