alsa suddenly stopped working (dmix socket disappeared)

Bug #85157 reported by Marius Gedminas

This bug report was converted into a question: question #78789: alsa suddenly stopped working (dmix socket disappeared).

20
Affects Status Importance Assigned to Milestone
alsa-lib (Ubuntu)
Invalid
Low
Ubuntu Audio Team

Bug Description

Binary package hint: libasound2

Sound suddenly stopped working for me in the middle of a session (i.e. no package upgrades, no reboots, no hardware changes). I use esd which plays through alsa, which uses dmix for mixing (the default configuration).
Playing sound through /dev/dsp works. Applications that use ALSA fail.

If I try to run, e.g., alsaplayer on a sound file, I see

ALSA lib pcm_direct.c:224:(make_local_socket) connect failed: /tmp/alsa-dmix-31499-1171450656-848382: No such file or directory
ALSA lib pcm_dmix.c:894:(snd_pcm_dmix_open) unable to connect client
snd_pcm_open: No such file or directory (default)
Failed to initialize plugin!
Failed to register plugin: /usr/lib/alsaplayer/output/libalsa_out.so
Failed to load output plugin "alsa". Trying defaults.
ALSA lib pcm_direct.c:224:(make_local_socket) connect failed: /tmp/alsa-dmix-31499-1171450656-848382: No such file or directory
ALSA lib pcm_dmix.c:894:(snd_pcm_dmix_open) unable to connect client
snd_pcm_open: No such file or directory (default)
Failed to initialize plugin!
/usr/lib/alsaplayer/output/libalsa_out.so failed to load

Related branches

Revision history for this message
Marius Gedminas (mgedmin) wrote :

I managed to fix the error with some deep black magic:

   strace -o /tmp/out mplayer -ao alsa file.mp3

watch it bomb out with an error

   grep shmget /tmp/out

get one important line:
shmget(5678293, 384, IPC_CREAT|0660) = 48824355

   shmrm -M 5678293

Looks like the process that previously acted as the dmix server died, but did not free the SysV shared memory segment.

I may have caused the problem by killing a firefox instance that stayed behind (with its 400 megs of virtual memory allocated) after I closed all of its windows.

Revision history for this message
Dave Walker (davewalker) wrote :

Thanks for the report and your fix. However, we need some more info.

Has this bug reproduced itself? If so, was it in identical circumstances?

What package version of 'alsa' are you using?

What release of ubuntu are you using?

Changed in alsa-lib:
assignee: nobody → davewalker
status: Unconfirmed → Needs Info
Revision history for this message
Marius Gedminas (mgedmin) wrote :

So far I've been unable to reproduce the problem.

I have Ubuntu Edgy with alsa 1.0.11-5ubuntu1.

Revision history for this message
Andrew Ash (ash211) wrote :

If you can't reproduce it on your edgy installation, is it also not a problem in an edgy livecd environment?

Revision history for this message
Dave Walker (davewalker) wrote :

As this can't be reproduced; i am going to reject this bug report.

Thanks again for your report - if it re-occurs please reopen this bug.

Changed in alsa-lib:
assignee: davewalker → nobody
status: Needs Info → Rejected
Revision history for this message
gga (ggarra) wrote :

I am also suffering from this problem ( Kubuntu Edgy ).
At first glance, it does indeed seem related to an application exiting incorrectly (ie. crashing).

Using a different also application, I get:

> grep shmget /tmp/out

shmget(5678293, 384, IPC_CREAT|0660) = 134873127
shmget(IPC_PRIVATE, 21760, IPC_CREAT|0777) = 1487996561

I don't have access to shmrm, thou, to test if that also fixes it in my case. What package is that command part of?

Revision history for this message
Marius Gedminas (mgedmin) wrote :

Sorry, when I wrote 'shmrm', I was actually thinking about 'ipcrm'. It's in the util-linux package, which is installed by default.

Revision history for this message
gga (ggarra) wrote : Re: [Bug 85157] Re: alsa suddenly stopped working (dmix socket disappeared)

Marius Gedminas wrote:
> Sorry, when I wrote 'shmrm', I was actually thinking about 'ipcrm'.
> It's in the util-linux package, which is installed by default.
>

Cool. I can confirm that the workaround works also for me. I had to do:
> ipcrm -M 5678293 -S 5678293

Revision history for this message
Michael (michaeljt) wrote :

This issue seems to be due to a design problem in ALSA and dmix in Linux 2.6.17. The design was changed in 2.6.18, so the problem should go away with Feisty.

Revision history for this message
ilia (ilia) wrote :

I use Feisty with 2.6.20 kernel on AMD64 platform. I have discovered a similar problem and already reported it as Bug #115593 (now, when I've found this bug description, #115593 may be marked as a duplicate, but I don't know how to do it...).
Today, when all sound applications hanged again I did one more debug session. I think, some application which used dmix was killed. I don't know dmix architecture, but I know that dmix uses semaphores and shared memory for IPC. If application which raised the semaphore exits without zeroing it (e.g. segfaults or is killed in another way), other applications will wait forever for the semaphore to lower (in my testing, semctl(sem_id, 0, GETZCNT) has returned 2). The presence of the semaphore may be checked from the command line:
  ipcs -s $IPC_KEY
where $IPC_KEY contains the value of dmix' ipc_key option. The semaphore may be deleted with:
  ipcrm -S $IPC_KEY
This return all sound applications to the working state.

IMO, the issue should be reported upstream and some watchdog should be implemented to overcome the deadlock when "important" process dies. Although I don't know the ALSA architecture, I think, changing just dmix may fix the bug (no need to touch other ALSA parts).
Since the bug is present in the latest release, it should be reopened.

Revision history for this message
ilia (ilia) wrote :

Bug still exists in Feisty (see comment 10).

Changed in alsa-lib:
status: Rejected → Confirmed
Daniel T Chen (crimsun)
Changed in alsa-lib:
assignee: nobody → ubuntu-audio
importance: Undecided → Low
Revision history for this message
Daniel T Chen (crimsun) wrote :

alsa-lib (1.0.15-2ubuntu1) hardy; urgency=low

  * Merge from Debian unstable.
  * Ubuntu-specific changes:
    - debian/libasound2.p{ostinst,rerm}: Install,remove update-notifier
      file, respectively;
    - debian/control: Add lpia to supported arches, adhere to
      DebianMaintainerField.
  * Dmix/dsnoop no longer use sockets (LP: #85157).
  * Biarch plugins support fixed (LP: #145645).

 -- Daniel T Chen <email address hidden> Sat, 01 Dec 2007 18:50:12 -0500

Changed in alsa-lib:
status: Confirmed → Fix Released
prasad_qx (prasad-qx)
Changed in alsa-lib (Ubuntu):
status: Fix Released → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Related questions

Remote bug watches

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