race condition in snd_pcm_drain() sometimes hangs userspace processes

Bug #18545 reported by Joe Barnett
14
Affects Status Importance Assigned to Milestone
linux-source-2.6.15 (Ubuntu)
Fix Released
Medium
Ben Collins

Bug Description

in breezy as of today, logging into gnome hangs. ssh'ing in and killing the esd
process causes gnome login to continue.

i also noticed that running esd from the cmdline never exits (process keeps
foreground), and assume this is the cause of the login hang.

Revision history for this message
Sami Haahtinen (ressu) wrote :

I'm seeing the same problem. (confirming)

bt of the hanged state of esd, stracing esd appears to remove the problem:
#0 0xffffe410 in ?? ()
#1 0xbfff9068 in ?? ()
#2 0xffffffff in ?? ()
#3 0x00000001 in ?? ()
#4 0xb7f1a4b5 in poll () from /lib/tls/i686/cmov/libc.so.6
#5 0xb7dd3ca1 in snd_pcm_wait_nocheck () from /usr/lib/libasound.so.2
#6 0xb7e09a2d in _snd_pcm_dmix_open () from /usr/lib/libasound.so.2
#7 0xb7dd1a9c in snd_pcm_drain () from /usr/lib/libasound.so.2
#8 0xb7dee0ea in _snd_pcm_rate_open () from /usr/lib/libasound.so.2
#9 0xb7dd1a9c in snd_pcm_drain () from /usr/lib/libasound.so.2
#10 0xb7fd12f9 in esd_audio_flush () from /usr/lib/libesd.so.0
#11 0x0804bdd0 in clean_exit ()
#12 0x0804a927 in clean_exit ()
#13 0xb7e72e8a in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6
#14 0x08049751 in ?? ()
(gdb) cont
Continuing.

Revision history for this message
Sami Haahtinen (ressu) wrote :

Oh, and it's not about daemonizing or not. I fired up 'esd -nobeep' in a
terminal and killed gnome-panel which then freezes and offers a quick way to debug.

Revision history for this message
Sebastien Bacher (seb128) wrote :

do you use libesd0 or libesd-alsa0?

Revision history for this message
Joe Barnett (thejoe) wrote :

I've got libesd-alsa0 installed

Revision history for this message
Sami Haahtinen (ressu) wrote :

Same here, libesd-alsa0 installed.

Revision history for this message
Martin Pitt (pitti) wrote :

I can reproduce it on my iBook.

Revision history for this message
Martin Pitt (pitti) wrote :

For the records:
 * Hang occurs with both hoary's and breezy's esound (daemon+libs), on both
Hoary and Breezy kernel.
 * Hang does not occur with libesd0, only with libesd-alsa0.
 * esd itself works perfectly (esdplay etc.)
 * It only seems to affect gnome applications.

This is not a regression of the newer 0.2.36 version. This is most probably a
bug that appears in conjunction with a newer Gnome library that is responsible
for sound events, however, we did not isolate that library yet.

As a temporary workaround, either use libesd0 or switch to polypaudio.

Revision history for this message
Martin Pitt (pitti) wrote :

(In reply to comment #0)

> i also noticed that running esd from the cmdline never exits (process keeps
> foreground), and assume this is the cause of the login hang.

No, esd does not daemonize on its own, this is not the cause.

Revision history for this message
Martin Pitt (pitti) wrote :

 esound (0.2.36-1ubuntu2) breezy; urgency=low
 .
   * audio_alsa09.c: Disable snd_pcm_drain() call for now since it sometimes
     triggers a race condition in the ALSA kernel driver which causes the
     esd process to hang. This is not a proper bug fix, but at least makes all
     those broken Colony installations out there work again. (Ubuntu #12276)

The workaround is uploaded, but it's not a final fix. Readjusting the bug
details for the real cause.

Revision history for this message
Sebastien Bacher (seb128) wrote :

please stop reassigning bugs at the wrong place

Revision history for this message
Thomas Hood (jdthood) wrote :
Revision history for this message
Thomas Hood (jdthood) wrote :

Upstream says that a bug like this was fixed in ALSA 1.0.9a.
In which versions of ALSA has the race condition been found?

Revision history for this message
Thomas Hood (jdthood) wrote :

$ cat /proc/asound/version
Advanced Linux Sound Architecture Driver Version 1.0.9 (Sun May 29 07:31:02 2005
UTC).

I see that the kernel has version 1.0.9. The bug was (probably) fixed in 1.0.9a.

/usr/share/doc/alsa-base/changelog.gz:
Changelog between 1.0.9 and 1.0.9a releases
  + PCM Midlevel
    - Fix races between PCM drain and other ops

It seems that the ALSA drivers in the kernel need to be updated.

Revision history for this message
Ben Collins (ben-collins) wrote :

Fix in our current alsa.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.