GNOME Bugzilla – Bug 577340
ALSA driver crashes beast
Last modified: 2011-04-05 23:29:28 UTC
Steps to reproduce: 1. Fetch the SVN trunk of beast, revision 4483 in particular, build&install 2. Start beast via "beast -p alsa=default" 3. Demo -> Party Monster 4. Hit play Beast will play for ~2 seconds, a semi-garbled sound is audible, then it crashes, giving the output: beast-0.7.2: pcm.c:1029: snd_pcm_prepare: Assertion `pcm' failed. Aborted Stack trace: gdb doesn't provide a useful trace. When I start the application with the additional "--bse-debug=pcm" flag, I get the following: --------------------------------------------------------------------- beast-0.7.2[26933]:BSE-ALSA:1: ALSA: setup: w=0 r=1 n_channels=2 sample_freq=44100 nperiods=4 period=512 (2048) bufsz=2048 beast-0.7.2[26933]:BSE-ALSA:1: ALSA: setup: w=1 r=0 n_channels=2 sample_freq=44100 nperiods=4 period=512 (2048) bufsz=2048 beast-0.7.2[26933]:BSE-ALSA:1: ALSA: opening PCM "default" readable=1 writable=1: Device configurations mismatch beast-0.7.2[26933]:BSE-ALSA:1: ALSA: setup: w=1 r=0 n_channels=2 sample_freq=44100nperiods=4 period=512 (2048) bufsz=2048 beast-0.7.2[26933]:BSE-ALSA:1: ALSA: opening PCM "default" readable=0 writable=1: Everything went well beast-0.7.2[27262]:BSE-ALSA:1: ALSA: retriggering device (r=<CLOSED> w=XRUN)... beast-0.7.2[27262]:BSE-ALSA:1: ALSA: retriggering device (r=<CLOSED> w=XRUN)... beast-0.7.2[27262]:BSE-ALSA:1: ALSA: retriggering device (r=<CLOSED> w=XRUN)... beast-0.7.2[27262]:BSE-ALSA:1: ALSA: retriggering device (r=<CLOSED> w=XRUN)... beast-0.7.2[27262]:BSE-ALSA:1: ALSA: retriggering device (r=<CLOSED> w=XRUN)... beast-0.7.2[27262]:BSE-ALSA:1: ALSA: retriggering device (r=<CLOSED> w=XRUN)... beast-0.7.2[27262]:BSE-ALSA:1: ALSA: retriggering device (r=<CLOSED> w=XRUN)... beast-0.7.2[27262]:BSE-ALSA:1: ALSA: retriggering device (r=<CLOSED> w=XRUN)... beast-0.7.2[27262]:BSE-ALSA:1: ALSA: retriggering device (r=<CLOSED> w=XRUN)... beast-0.7.2[27262]:BSE-ALSA:1: ALSA: retriggering device (r=<CLOSED> w=XRUN)... beast-0.7.2[27262]:BSE-ALSA:1: ALSA: retriggering device (r=<CLOSED> w=XRUN)... beast-0.7.2[27262]:BSE-ALSA:1: ALSA: retriggering device (r=<CLOSED> w=XRUN)... beast-0.7.2[27262]:BSE-ALSA:1: ALSA: retriggering device (r=<CLOSED> w=XRUN)... beast-0.7.2[27262]:BSE-ALSA:1: ALSA: retriggering device (r=<CLOSED> w=XRUN)... beast-0.7.2[27262]:BSE-ALSA:1: ALSA: retriggering device (r=<CLOSED> w=XRUN)... beast-0.7.2[27262]:BSE-ALSA:1: ALSA: retriggering device (r=<CLOSED> w=XRUN)... beast-0.7.2[27262]:BSE-ALSA:1: ALSA: retriggering device (r=<CLOSED> w=XRUN)... beast-0.7.2[27262]:BSE-ALSA:1: ALSA: retriggering device (r=<CLOSED> w=XRUN)... beast-0.7.2[27262]:BSE-ALSA:1: ALSA: retriggering device (r=<CLOSED> w=XRUN)... beast-0.7.2[27262]:BSE-ALSA:1: ALSA: retriggering device (r=<CLOSED> w=XRUN)... beast-0.7.2[27262]:BSE-ALSA:1: ALSA: retriggering device (r=<CLOSED> w=XRUN)... beast-0.7.2[27262]:BSE-ALSA:1: ALSA: retriggering device (r=<CLOSED> w=XRUN)... beast-0.7.2[27262]:BSE-ALSA:1: ALSA: retriggering device (r=<CLOSED> w=XRUN)... beast-0.7.2[27262]:BSE-ALSA:1: ALSA: write() error: Broken pipe beast-0.7.2: pcm.c:1029: snd_pcm_prepare: Assertion `pcm' failed. Aborted --------------------------------------------------------------------- Other information: During the compilation of the ALSA driver I get the following warnings: --------------------------------------------------------------------- bsemididevice-alsa.c: In function ‘bse_midi_device_alsa_open’: bsemididevice-alsa.c:187: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘size_t’ bsemididevice-alsa.c:187: warning: format ‘%d’ expects type ‘int’, but argument 4 has type ‘size_t’ bsemididevice-alsa.c:197: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘size_t’ bsemididevice-alsa.c:197: warning: format ‘%d’ expects type ‘int’, but argument 4 has type ‘size_t’ bsepcmdevice-alsa.c:358: warning: ‘snd_pcm_sw_params_set_xfer_align’ is deprecated --------------------------------------------------------------------- The size_t warnings can be fixed by switching from %d to %zd. I don't know what to do about the deprecation warning. That one might be related to the crash. This is Fedora 10, with gcc-4.3.2 alsa-lib-1.0.19 kernel-2.6.27.12
Created attachment 162267 [details] [review] Patch fixing incorrect use of read handle during write errors I think you're really experiencing two bugs at the same time; one leads to garbled sound, since BEAST is retriggering the ALSA device fairly often. I am seeing these frequent retriggers on my machine, too, but have not yet figured out how to fix this. The other is that if you don't have a read handle (since the trace shows your BEAST is opening ALSA write only), then a crash occurs, since bse-alsa retriggers the read handle (which is NULL). The patch I attached should fix this - please test if that is in fact the case.
I've merged the changes into the main git repo, so the crash should be gone. You will probably still experience garbled sound, so I'll not close the bug, but change the severity.
(In reply to comment #2) > I've merged the changes into the main git repo, so the crash should be gone. > You will probably still experience garbled sound, so I'll not close the bug, > but change the severity. that#d be a different bug then, so this one should be closed.