Bug 104761

Summary: Crash when changing port
Product: PulseAudio Reporter: Tanu Kaskinen <tanuk>
Component: alsaAssignee: pulseaudio-bugs
Status: RESOLVED FIXED QA Contact: pulseaudio-bugs
Severity: normal    
Priority: medium CC: ernestas.kulik, lennart, manuel.lauss
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 102546    

Description Tanu Kaskinen 2018-01-24 07:32:33 UTC
With the current master changing ports on an alsa card makes PulseAudio crash:

#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff60d319a in __GI_abort () at abort.c:89
#2  0x00007ffff79008a5 in pa_sink_suspend (s=s@entry=0x55555583be10, suspend=suspend@entry=false, cause=<optimized out>)
    at pulsecore/sink.c:849
#3  0x00007fffecb4ac01 in sink_set_port_cb (s=0x55555583be10, p=0x5555557b0090) at modules/alsa/alsa-sink.c:1533
#4  0x00007ffff7906e82 in pa_sink_process_msg (o=o@entry=0x55555583be10, code=code@entry=22, userdata=userdata@entry=0x7fffffffd5f0, 
    offset=offset@entry=0, chunk=chunk@entry=0x0) at pulsecore/sink.c:2921
#5  0x00007fffecb4c9cb in sink_process_msg (o=0x55555583be10, code=22, data=0x7fffffffd5f0, offset=0, chunk=0x0)
    at modules/alsa/alsa-sink.c:1231
#6  0x00007ffff78e7155 in asyncmsgq_read_work (i=0x5555557b5250) at pulsecore/rtpoll.c:566
#7  0x00007ffff78e7a75 in pa_rtpoll_run (p=0x5555559908b0) at pulsecore/rtpoll.c:236
#8  0x00007fffecb4d665 in thread_func (userdata=0x555555990660) at modules/alsa/alsa-sink.c:1822
#9  0x00007ffff76833a8 in internal_thread_func (userdata=0x55555584e3a0) at pulsecore/thread-posix.c:81
#10 0x00007ffff6b67519 in start_thread (arg=0x7fffecb23700) at pthread_create.c:456
#11 0x00007ffff618aa4f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

The pa_sink_suspend() call was recently added to sink_set_port_cb(). sink_set_port_cb() is called from the IO thread when deferred volume is enabled, as it usually is.

Fixing this doesn't seem trivial. I think I'll try to make things so that sink_set_port_cb() is only called from the main thread so that it can safely call pa_sink_suspend(). The mixer handling will still need to happen in the IO thread when deferred volume is enabled, but sink_set_port_cb() can probably do that by sending a message to the IO thread.
Comment 1 Tanu Kaskinen 2018-03-20 11:21:21 UTC
Fixed in master.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.