[pulseaudio-discuss] How to debug a deadlock on audio routing?

Lin, Mengdong mengdong.lin at intel.com
Wed Jul 27 07:54:50 PDT 2011


I got a thread deadlock during audio routing. Could anyone share some advice to debug a deadlocked thread? Great thanks!

My scenario is:

1.       make a VOIP call with a Bluetooth headset,

2.       disconnect the Bluetooth headset during the phone call

3.       then the phone input & output stream shall be routed back to ALSA sink & source and module-echo-cancel's filter sink& source shall be automatically inserted.


But I got a deadlock on step 3. It seems the AEC virtual sink does not process " PA_SINK_MESSAGE_SET_STATE " and blocks PA main thread when the phone stream is moving to it. And I found module-echo-cancel's message handler has not been called. So I think the IO thread (ALSA sink's IO thread, right?) which shall call the message handler is also deadlocked.

Could anyone share some advice on the possible reason of this deadlock? How could I find out the where the IO thread is blocked by gdb?


Here is the main thread stack on deadlock:
#1  0x4d8d28d5 in sem_wait () at ../nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S:80  ....... Here is the deadlock, when AEC filter sink update status to RUNNING
#2  0x42684ad8 in pa_semaphore_wait (s=0x8ab5fd8) at pulsecore/semaphore-posix.c:63
#3  0x4de0f94a in pa_asyncmsgq_send (a=0x8b3ba00, object=0x8ab5ff0, code=11, userdata=0x0, offset=0, chunk=0x0) at pulsecore/asyncmsgq.c:169
#4  0x4de48ee9 in sink_set_state (s=<value optimized out>, state=<value optimized out>) at pulsecore/sink.c:415
#5  0x4de459ec in pa_sink_input_finish_move (i=0x8b581b0, dest=0x8ab5ff0, save=false) at pulsecore/sink-input.c:1530   ........................ the phone input stream is moving to the AEC filter sink, triggered by module-filter-apply
#6  0x4de464e7 in pa_sink_input_move_to (i=0x8b581b0, dest=0x8ab5ff0, save=false) at pulsecore/sink-input.c:1587
#7  0xb6c44b02 in do_move (o=0x8b581b0, filter=<value optimized out>, restore=false, is_sink_input=true) at modules/module-filter-apply.c:192
#8  move_object_for_filter (o=0x8b581b0, filter=<value optimized out>, restore=false, is_sink_input=true) at modules/module-filter-apply.c:217
#9  0xb6c45d73 in process (u=0x8a8d0c8, o=<value optimized out>, is_sink_input=true) at modules/module-filter-apply.c:340
#10 0x4de2607f in pa_hook_fire (hook=0x8a6f054, data=0x8b581b0) at pulsecore/hook-list.c:104
#11 0x4de45aaf in pa_sink_input_finish_move (i=0x8b581b0, dest=0x8aa9af0, save=false) at pulsecore/sink-input.c:1539      ..................... the phone input stream is moving to the ALSA sink after the Bluetooth HSP sink disappears

#12 0x4de4c51d in pa_sink_move_all_finish (s=0x8aa9af0, q=0x8b63a58, save=false) at pulsecore/sink.c:740
#13 0xb6c35da2 in card_set_profile (c=0x8aa7ac0, new_profile=0x8aa7940) at modules/alsa/module-alsa-card.c:352
#14 0xb2a7da21 in restore_sco_card_default_profile (u=0x8b57e00) at modules/bluetooth/module-bluetooth-device.c:2073
#15 stop_thread (u=0x8b57e00) at modules/bluetooth/module-bluetooth-device.c:2515
#16 0xb2a7e8ab in module_bluetooth_device_LTX_pa__done (m=0x8b53540) at modules/bluetooth/module-bluetooth-device.c:3123
#17 0x4de27b08 in pa_module_free (m=<value optimized out>) at pulsecore/module.c:165
#18 0x4de2850d in defer_cb (api=0x8a6cc70, e=0x8b46a28, userdata=0x8a6ed90) at pulsecore/module.c:231
#19 0x42b23a0b in dispatch_defer (m=0x8a6cc30) at pulse/mainloop.c:706
#20 pa_mainloop_dispatch (m=0x8a6cc30) at pulse/mainloop.c:922
#21 0x42b23e11 in pa_mainloop_iterate (m=0x8a6cc30, block=1, retval=0xbfa70228) at pulse/mainloop.c:962
#22 0x42b23ee4 in pa_mainloop_run (m=0x8a6cc30, retval=0xbfa70228) at pulse/mainloop.c:977
#23 0x08053b32 in main (argc=4, argv=0xbfa703f4) at daemon/main.c:1135

Thanks & Best Regards
Amanda
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20110727/e5ce8556/attachment.htm>


More information about the pulseaudio-discuss mailing list