Bug 51060 - Crash (segfault) in snd_pcm_area_silence()
Crash (segfault) in snd_pcm_area_silence()
Status: NEW
Product: PulseAudio
Classification: Unclassified
Component: alsa
unspecified
Other All
: medium normal
Assigned To: pulseaudio-bugs
pulseaudio-bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-13 22:42 UTC by Tanu Kaskinen
Modified: 2013-10-20 20:22 UTC (History)
4 users (show)

See Also:


Attachments
Verbose log and backtrace. (261.79 KB, text/plain)
2012-06-13 22:42 UTC, Tanu Kaskinen
Details
valgrind log (13.38 KB, text/plain)
2012-08-30 21:52 UTC, Maxim Britov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tanu Kaskinen 2012-06-13 22:42:48 UTC
Created attachment 63006 [details]
Verbose log and backtrace.

This was reported in irc. I'll attach the verbose log and backtrace.
Comment 1 Tanu Kaskinen 2012-06-13 22:50:44 UTC
One peculiar thing about the backtrace is that softvol is being used in alsa. So that's one candidate where the bug might be instead of pulseaudio code.

The user didn't enable softvol himself. ~/.asoundrc or /etc/asound.conf don't exist. Presumably softvol is enabled by the stock alsa configuration for the "front" device. It could be tried if removing "front:%f" from the device-strings of the analog-stereo mapping helps. We tried that already, but it was removed only from profile-sets/default.conf, which didn't seem to have any effect ("front:0" was still opened according to the logs), so I think actually profile-sets/extra-hdmi.conf was being used.

The user, "ruler501", had to start doing something else, but he said that he'd come back tomorrow to irc, so further debugging can be done at that point.
Comment 2 Tanu Kaskinen 2012-06-14 00:01:16 UTC
Additional information: The distro is Sabayon Linux, and alsa-lib version is 1.0.25-r1.
Comment 3 Tanu Kaskinen 2012-06-14 00:05:40 UTC
Another bit of information:

<ruler501> these problems just started today but I haven't done any updates or editted anything relating to pulse/alsa if that helps at all


It sounds unlikely that code would start reliably crashing without changing anything, though...
Comment 4 Tanu Kaskinen 2012-06-28 09:51:12 UTC
Forgot to add this: removing "front:%f" from extra-hdmi.conf did the trick: no more crashing observed. So, the problem seems to occur only with softvol. Maybe this is an alsa bug.
Comment 5 Mark Pariente 2012-08-15 03:51:33 UTC
I've also ran into the same issue - crash in sndpcm_area_silence(), running Gentoo ~amd64. In my case though the problem was isolated to a particular application, ie. other apps would work fine but rhythmbox would end up crashing pulseaudio.

Using the workaround from Comment 4, removing "front:%f" from extra-hdmi.conf I was able to get rhythmbox to play songs without crashing pulseaudio, however I noticed that rhythmbox's volume was 0 on pavucontrol. After bumping the volume level up I was able to hear the music being played. What is even more curious though, is that I reverted the change to extra-hdmi.conf, restarted pulseaudio and rhythmbox was STILL working.

This leads me to believe that this bug may have something to do with the per-application volume level getting somehow messed up.
Comment 6 Tanu Kaskinen 2012-08-15 04:35:49 UTC
(In reply to comment #5)
> I've also ran into the same issue - crash in sndpcm_area_silence(), running
> Gentoo ~amd64. In my case though the problem was isolated to a particular
> application, ie. other apps would work fine but rhythmbox would end up crashing
> pulseaudio.
> 
> Using the workaround from Comment 4, removing "front:%f" from extra-hdmi.conf I
> was able to get rhythmbox to play songs without crashing pulseaudio, however I
> noticed that rhythmbox's volume was 0 on pavucontrol. After bumping the volume
> level up I was able to hear the music being played. What is even more curious
> though, is that I reverted the change to extra-hdmi.conf, restarted pulseaudio
> and rhythmbox was STILL working.
> 
> This leads me to believe that this bug may have something to do with the
> per-application volume level getting somehow messed up.

I find it unlikely that the problem is in the per-application volumes as such.

If you have only one stream playing, and its volume is at 0, the hardware volume will also be set to zero (if flat volumes are enabled, like they are by default). So, could it be that the crash happens only when alsa's softvol is used with zero volume? Can you reproduce the crash by setting rhythmbox volume to 0 again?
Comment 7 Mark Pariente 2012-08-15 05:19:32 UTC
Yes, right on. Setting the rhythmbox volume to 0 in pavucontrol (while it was playing) immediately crashed pulseaudio.
Comment 8 Maxim Britov 2012-08-30 21:34:58 UTC
Same issue.
I have it when alsa-lib (1.0.25) compiled (gcc 4.6.3) with -O3 or -ftree-vectorize
Comment 9 Maxim Britov 2012-08-30 21:52:48 UTC
Created attachment 66377 [details]
valgrind log

valgrind --trace-children=yes /usr/bin/pulseaudio

alsa-lib compiled with -O1 --ftree-vectorize
Comment 10 Jana Saout 2012-10-17 10:09:47 UTC
I've had this problem too and the problem only occurs with -ftree-vectorize.

It looks to me as if this is a gcc bug, as it produces a "movdqa" or "vmovdqa" instruction which is used with an unaligned pointer.

Now, I have no clue why gcc assumes the pointer would be an aligned one, maybe it is even right and something else is wrong, but I haven't spent too much time digging into this.

(note that it still happens with gcc 4.7 and the current 4.8 development one)

Also, this bug should probably be brought up with the alsa guys as well, as I don't think pulseaudio is at fault here.
Comment 11 Tanu Kaskinen 2012-10-17 11:56:45 UTC
(In reply to comment #10)
> Also, this bug should probably be brought up with the alsa guys as well, as
> I don't think pulseaudio is at fault here.

You're right. I sent a mail to alsa-devel: http://thread.gmane.org/gmane.linux.alsa.devel/102097
Comment 12 David Heidelberg (okias) 2013-10-20 20:21:29 UTC
alsa-lib-1.0.27.2, gcc-4.9 with -O3. I can confirm this issue.