Summary: | [regression] DYNAMIC_LATENCY introduced in module-combine causes a race contition between pa_sink_render_into_full and sink_update_requested_latency_cb in alsa-sink.c | ||
---|---|---|---|
Product: | PulseAudio | Reporter: | M132 <marcel132132> |
Component: | modules | Assignee: | pulseaudio-bugs |
Status: | RESOLVED FIXED | QA Contact: | pulseaudio-bugs |
Severity: | normal | ||
Priority: | medium | CC: | jiri.tyr, lennart, mtijink.bugs |
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Bug Depends on: | |||
Bug Blocks: | 88920 |
Description
M132
2015-05-17 05:41:24 UTC
http://cgit.freedesktop.org/pulseaudio/pulseaudio/patch/src/modules/module-combine-sink.c?id=512baa1a1fdb58f2d39882ac9d1660da7b8b21be +PA_MODULE_DEPRECATED("Please use module-combine-sink instead of module-combine!"); module-combine-sink sink_name=media slaves=alsa_output.pci-0000_00_14.2.analog-stereo resample_method=speex-float-1 format=s16le rate=44100 channels=2 why only one slave instead of two slaves? While writing the title of the bug, I actually meant module-combine-sink. I'm using module-combine-sink with one slave, because of another bug, described here: https://bugs.freedesktop.org/show_bug.cgi?id=79807 However, the bug isn't probably triggered because of this. I've had the same setup with PulseAudio 5.0, and everything was working flawlessly. take a look at datasheet, one of ADC can record DAC signal through node 0x15 ??? Codec: Conexant CX20757 Address: 0 AFG Function Id: 0x1 (unsol 1) Vendor Id: 0x14f15115 Subsystem Id: 0x17aac03d Revision Id: 0x100100 No Modem Function Group found Default PCM: rates [0x160]: 44100 48000 96000 bits [0xe]: 16 20 24 formats [0x1]: PCM Default Amp-In caps: N/A Default Amp-Out caps: N/A State of AFG node 0x01: Power states: D0 D1 D2 D3 D3cold S3D3cold CLKSTOP EPSS Power: setting=D0, actual=D0 GPIO: io=3, o=0, i=0, unsolicited=1, wake=0 IO[0]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0 IO[1]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0 IO[2]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0 Node 0x10 [Audio Output] wcaps 0xc1d: Stereo Amp-Out R/L Control: name="Headphone Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Control: name="Headphone Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Device: name="CX20757 Analog", type="Audio", device=0 Amp-Out caps: ofs=0x4a, nsteps=0x4a, stepsize=0x03, mute=1 Amp-Out vals: [0x80 0x80] Converter: stream=8, channel=0 PCM: rates [0x60]: 44100 48000 bits [0xa]: 16 24 formats [0x1]: PCM Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Node 0x11 [Audio Output] wcaps 0xc1d: Stereo Amp-Out R/L Control: name="Speaker Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Control: name="Speaker Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Amp-Out caps: ofs=0x4a, nsteps=0x4a, stepsize=0x03, mute=1 Amp-Out vals: [0x4a 0x4a] Converter: stream=8, channel=0 PCM: rates [0x60]: 44100 48000 bits [0xa]: 16 24 formats [0x1]: PCM Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Node 0x14 [Audio Input] wcaps 0x100d1b: Stereo Amp-In R/L Amp-In caps: ofs=0x4a, nsteps=0x50, stepsize=0x03, mute=1 Amp-In vals: [0x4a 0x4a] [0x4a 0x4a] [0x4a 0x4a] Converter: stream=0, channel=0 SDI-Select: 0 PCM: rates [0x160]: 44100 48000 96000 bits [0xa]: 16 24 formats [0x1]: PCM Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Connection: 3 0x19* 0x1a 0x15 Node 0x15 [Audio Mixer] wcaps 0x20050b: Stereo Amp-In Amp-In caps: ofs=0x4a, nsteps=0x4a, stepsize=0x03, mute=1 Amp-In vals: [0x00 0x00] [0x00 0x00] Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Connection: 2 0x10 0x11 Thanks, but I'd still like to record directly from the PulseAudio server, without distortion caused by digital to analog and analog to digital conversions. do you mean your combined-sink is not the default sink ? Yes, I manually select which applications I want to record, in pavucontrol. D: [alsa-sink-CX20757 Analog] alsa-sink.c: Latency set to 116,05ms D: [alsa-sink-CX20757 Analog] alsa-sink.c: hwbuf_unused=332300 D: [alsa-sink-CX20757 Analog] alsa-sink.c: setting avail_min=87311 hwbuf_unused is strange seem snd_hda_prealloc_max is neither 64 nor 4096 between 0.371 second or 23.7 second buffer Regression, marking as a release blocker. I looked a bit into this. The problem is that module-combine-sink can generate rewind requests during the sink input pop() callback. That should never happen. Each output struct has member inq, which is a message queue containing messages from the combine sink thread to the output thread. There are basically only two messages that are transmitted in that queue: POST and SET_REQUESTED_LATENCY. Processing a SET_REQUESTED_LATENCY message results in a rewind request. There are two places where the message queue may get processed during the pop() callback: render_memblock() and request_memblock() both call pa_asyncmsgq_process_one() in a loop to make sure the message queue has no buffered audio before requesting the combine sink to render more audio. If there is a SET_REQUESTED_LATENCY message in the queue when it's drained, this crash will happen. I think the queue draining code could be removed from both places without totally breaking things, but it might cause a situation where audio is rendered earlier than necessary. That might cause some issues. A safer fix would be to have two queues for the two messages. That way the SET_REQUESTED_LATENCY messages could be processed only when it's safe to do so. I'll hopefully get around writing a patch tomorrow. (In reply to Tanu Kaskinen from comment #12) > I'll hopefully get around writing a patch tomorrow. I did get around to doing that, but I didn't have time for testing the patch. Now I have checked that I can reproduce the crash, and that the patch gets rid of it. I sent the patch to the mailing list: http://lists.freedesktop.org/archives/pulseaudio-discuss/2015-June/024136.html Audacity seems to do some crazy stuff at startup - it creates over 70 connections before it settles down. Good for stress testing... *** Bug 91139 has been marked as a duplicate of this bug. *** I was experiencing the following two crashes very frequently: Jul 08 23:55:04 desktop pulseaudio[5512]: E: [alsa-sink-VT1718S Analog] sink.c: Assertion '!s->thread_info.rewind_requested' failed at pulsecore/sink.c:1239, function pa_sink_render_into(). Aborting. Jul 09 00:32:08 desktop pulseaudio[6984]: E: [alsa-sink-VT1718S Digital] sink.c: Assertion '!s->thread_info.rewind_requested' failed at pulsecore/sink.c:1323, function pa_sink_render_into_full(). Aborting. After I have applied the patch, there are no more crashes. I have been testing it for two days. I've been having this problem for some time as well. I'm just now going in and applying the patch and I'll report back whether it works properly for me. I pushed the patch now. Thanks, Jiri, for testing. |
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.