jackd cannot be started in realtime mode on Karmic if there is not enough free space in /dev/shm
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
jack-audio-connection-kit (Ubuntu) |
Confirmed
|
Low
|
Unassigned |
Bug Description
When trying to start jackd in realtime mode with memory locking enabled, at least on my system, it crashes with a "Bus error" without printing any useful error message. What happens seems to be the following:
1. Ubuntu mounts a tmpfs file system in /dev/shm with a size of 50% of the main memory size. My system has only 512MB RAM, so my /dev/shm is 256MB.
2. /dev/shm is also used by Pulseaudio, which seems to allocate ~64MB for every client. On my system this means that most of the time there is no free space in /dev/shm. Moreover, even after shutting down Pulseaudio, there are pulse-shm-* files left in /dev/shm.
3. When started in realtime mode with memory locking enabled, jackd attempts to allocate ~130MB shared memory without checking for free space. This fails and jackd crashes with a bus error.
I don't know exactly how the /dev/shm file system works or how Pulseaudio uses it, but the following solves the problem:
1. Make shure that Pulseaudio is not running. I use the Fluxbox WM for audio, so when I kill Pulseaudio, it is not automatically restarted; I don't know how this can be done when running Gnome.
2. Clean up /dev/shm by deleting the files left over by Pulseaudio.
3. Start jackd in realtime mode with memory locking enabled.
I would expect the following behavior:
1. jackd should tell the user that there is not enough shared memory available and shut down cleanly instead of crashing.
2. There should be no files left over by Pulseaudio when it is not running.
ProblemType: Bug
Architecture: i386
Date: Wed Dec 2 11:56:48 2009
DistroRelease: Ubuntu 9.10
InstallationMedia: Ubuntu 9.10 "Karmic Koala" - Release i386 (20091028.5)
Package: jackd 0.116.1-4ubuntu2
ProcEnviron:
LANG=de_DE.UTF-8
SHELL=/bin/bash
ProcVersionSign
SourcePackage: jack-audio-
Uname: Linux 2.6.31-15-generic i686
I experience what appears to be the same problem on my laptop with a USB sound device.
I'm running Karmic. Pulseaudio is enabled but the USB sound device is set to profile "Off" in the Sound Preferences GUI, so pulseaudio shouldn't try to use it (right?). Pulseaudio is allowed to manage the laptop's internal sound device, though.
Immediately after logging in, pulseaudio has created (around) five 65MB files in /dev/shm, but only a total of 224kB is actually allocated/used:
jonas@bruno:~$ ls -lsh /dev/shm/ 3132421645 3183276808 3321423159 3424433770
total 224K
4.0K -rw-r----- 1 jonas jonas 4.0K 2009-12-25 13:20 mono.5866
84K -r-------- 1 gdm gdm 65M 2009-12-25 13:20 pulse-shm-
32K -r-------- 1 jonas jonas 65M 2009-12-25 13:22 pulse-shm-
12K -r-------- 1 jonas jonas 65M 2009-12-25 13:20 pulse-shm-
80K -r-------- 1 jonas jonas 65M 2009-12-25 13:22 pulse-shm-
12K -r-------- 1 jonas jonas 65M 2009-12-25 13:20 pulse-shm-586544485
When I try to start jackd, pulseaudio starts to fill up its previously sparse files in /dev/shm. After a few seconds and a lot of swapping jackd exits with "Bus error" and my /dev/shm is completely filled:
jonas@bruno:~$ ls -lsh /dev/shm/ 3132421645 3183276808 3321423159 3424433770
total 232M
0 drwx------ 3 jonas jonas 60 2009-12-25 13:22 jack-1000
4.0K -rw-r----- 1 jonas jonas 4.0K 2009-12-25 13:20 mono.5866
84K -r-------- 1 gdm gdm 65M 2009-12-25 13:20 pulse-shm-
65M -r-------- 1 jonas jonas 65M 2009-12-25 13:22 pulse-shm-
65M -r-------- 1 jonas jonas 65M 2009-12-25 13:20 pulse-shm-
39M -r-------- 1 jonas jonas 65M 2009-12-25 13:22 pulse-shm-
0 -r-------- 1 jonas jonas 65M 2009-12-25 13:22 pulse-shm-448440592
65M -r-------- 1 jonas jonas 65M 2009-12-25 13:20 pulse-shm-586544485
All this happens only when I have "@audio - memlock unlimited" in my limits.conf (otherwise jackd says that it can't allocate memory, but seems to work happily anyway). Sometimes not enough pulseaudio clients are running to fill up /dev/shm and jackd will start fine. My preferred workaround is to start jackd on the console before logging in.
My system:
512MB RAM,
USB sound device: ESI U46XL
Ubuntu realtime kernel linux-image-rt 2.6.31.9.10
pulseaudio 1:0.9.19-0ubuntu4, jackd 0.116.1-4ubuntu2