Bug 1189860

Summary: jack can not lock down memory area
Product: [Fedora] Fedora Reporter: bodhi.zazen <bodhi.zazen>
Component: jack-audio-connection-kitAssignee: Brendan Jones <brendan.jones.it>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 21CC: bodhi.zazen, brendan.jones.it, fdc, martin_, oget.fedora
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-02 08:37:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description bodhi.zazen 2015-02-05 16:33:05 UTC
Description of problem: I am using Fedora Jam for recording with an external USB mixer.

When I start jack, there is an error, jack can not lock down memory area


Version-Release number of selected component (if applicable): jack audio connection kit 


How reproducible: Start jack with  qjackctl

command  /bin/jackd -u -dalsa -r48000 -p1024 -n3 -D -Chw:CODEC -Phw:CODEC -i2 -o2


Steps to Reproduce:
1. Run qjackctl
2. Start jack 
3.  Open messages

Actual results:

jack throws an error 

Cannot lock down 107335194 byte memory area (Cannot allocate memory)


Expected results: Jack starts and is able to use memory


Additional info:

Installed packages

alsa-plugins-jack.x86_64         1.0.28-3.fc21      @koji-override-0/$releasever
audacious-plugins-jack.x86_64    3.5.2-1.fc21       @fedora                     
jack-audio-connection-kit.x86_64 1.9.10-1.fc21      @updates                    
jack-audio-connection-kit-dbus.x86_64
jack-audio-connection-kit-example-clients.x86_64
jack-rack.x86_64                 1.4.7-17.fc21      @koji-override-0/$releasever
jack_capture.x86_64              0.9.61-6.fc21      @koji-override-0/$releasever
jackctlmmc.x86_64                4-9.fc21           @koji-override-0/$releasever
pulseaudio-module-jack.x86_64    5.0-25.fc21        @koji-override-0/$releasever
qjackctl.x86_64                  0.3.12-1.fc21      @updates                    
rtmidi-jack.x86_64               1.0.15-9.fc21      @koji-override-0/$releasever
zynjacku.x86_64                  6-10.fc21          @koji-override-0/$releasever

I tried IRC and #fedora-audio as well as the fedora audio mailing list for support  (fedora jam). #fedora-audio is almost silent and the mailing list bounced my post =(

http://fedoraproject.org/wiki/Fedora_jam

I am not sure if this error is a problem or not, and the documentation on jack is a bit sketchy on a few issues, specifically Fedora 21 and "real time" kernel , integration with pulse audio, etc

The documentation seems a bit out dated 

https://fedoraproject.org/wiki/JACK_Audio_Connection_Kit

Thank you in advance

Comment 1 bodhi.zazen 2015-02-05 16:36:55 UTC
Ardour throws this message 

WARNING: Your system has a limit for maximum amount of locked memory. This might cause Ardour to run out of memory before your system runs out of memory. 

You can view the memory limit with 'ulimit -l', and it is normally controlled by  /etc/security/limits.conf

iduid=1000(bodhi) gid=1000(bodhi) groups=1000(bodhi),10(wheel),63(audio),986(jackuser) context=staff_u:staff_r:staff_t:s0

ulimit -a                                                                                                                                                   02/05/15  9:35 AM
-t: cpu time (seconds)              unlimited
-f: file size (blocks)              unlimited
-d: data seg size (kbytes)          unlimited
-s: stack size (kbytes)             8192
-c: core file size (blocks)         0
-m: resident set size (kbytes)      unlimited
-u: processes                       96261
-n: file descriptors                1024
-l: locked-in-memory size (kbytes)  64
-v: address space (kbytes)          unlimited
-x: file locks                      unlimited
-i: pending signals                 96261
-q: bytes in POSIX msg queues       819200
-e: max nice                        0
-r: max rt priority                 0
-N 15:                              unlimited

Tried all these options in /etc/security/limits.conf 

bodhi - rtprio 90 
bodhi - memlock unlimited

@audio - rtprio 90          # maximum realtime priority
@audio - memlock unlimited  # maximum locked-in-memory address space (KB)

@jackuser - rtprio 90          # maximum realtime priority
@jackuser - memlock unlimited  # maximum locked-in-memory address space (KB)

Comment 2 Japplo 2015-02-21 12:30:13 UTC
Hi, I've the same problem (also F21). If I try to start ardour3 I get the message:

Cannot lock down 107335194 byte memory area

I'm not sure if this is a BUG or a configuration issue because I've never installed ardour3 before.

Comment 3 bodhi.zazen 2015-02-21 15:47:05 UTC
I included the additional information from Ardour in the hope it helps.

Comment 4 Orcan Ogetbil 2015-02-21 16:04:13 UTC
Could you try realTimeConfigQuickScan? Maybe it will give us some clues about what's wrong.

https://fedoraproject.org/wiki/JACK_Audio_Connection_Kit#realTimeConfigQuickScan

Comment 5 bodhi.zazen 2015-02-21 17:09:40 UTC
Sure - I optimized my system as much as I could ...

bodhi@jazz:~$ realTimeConfigQuickScan 

== GUI-enabled checks ==
Checking if you are root... no - good
Checking filesystem 'noatime' parameter...  - good

Checking CPU Governors... CPU 0: 'performance' CPU 1: 'performance' CPU 2: 'performance' CPU 3: 'performance' CPU 4: 'performance' CPU 5: 'performance' CPU 6: 'performance' CPU 7: 'performance'  - good
Checking swappiness... 10 - good
Checking for resource-intensive background processes... none found - good
Checking checking sysctl inotify max_user_watches... >= 524288 - good
Checking access to the high precision event timer... not found - not good
/dev/hpet not found.
Checking access to the real-time clock... not found - not good
/dev/rtc not found.
Checking whether you're in the 'audio' group... yes - good
Checking for multiple 'audio' groups... no - good
chrt: failed to set pid 0's policy: Operation not permitted
Checking the ability to prioritize processes with chrt... no - not good
Could not assign a 80 rtprio value. Set up limits.conf.
For more information, see http://wiki.linuxmusicians.com/doku.php?id=system_configuration#limits.conf
Checking kernel support for high resolution timers... found - good
Kernel with Real-Time Preemption... not found - not good
Kernel without real-time capabilities found
For more information, see http://wiki.linuxmusicians.com/doku.php?id=system_configuration#installing_a_real-time_kernel
Checking if kernel system timer is set to 1000 hz... found - good
Checking kernel support for tickless timer... found - good
== Other checks ==
Checking filesystem types... ok.
ok.
** Set $SOUND_CARD_IRQ to the IRQ of your soundcard to enable more checks.
   Find your sound card's IRQ by looking at '/proc/interrupts' and lspci.

Comment 6 Orcan Ogetbil 2015-02-21 18:30:54 UTC
Hmm, did you alter /etc/security/limits.conf manually?

There is also the /etc/security/limits.d/95-jack.conf file that gets installed by the jack package. Can you make sure they are not conflicting with each other (also check the contents of the other files in /etc/security/limits.d/ for potential conflicts)?

Comment 7 bodhi.zazen 2015-02-22 14:54:35 UTC
When I posted the options I tried in /etc/security/limits.d/95-jack.conf and /etc/security/limits.conf I did not mean to say I tried all those configuration options at the same time. I tried all those options, one at a time, first in /etc/security/limits.d/95-jack.conf and next in /etc/security/limits.conf 

Those options are from the Fedora wiki (JACK page) and realTimeConfigQuickScan 

Do you have a working set of configuration files I can try ?

Comment 8 bodhi.zazen 2015-02-22 15:05:29 UTC
root@jazz:~# ls /etc/security/limits.d                                                                         

95-jack.conf  20-nproc.conf

Comment 9 bodhi.zazen 2015-02-22 15:15:57 UTC
bodhi@jazz:~$ id

uid=1000(bodhi) gid=1000(bodhi) groups=1000(bodhi),10(wheel),63(audio),986(jackuser) context=staff_u:staff_r:staff_t:s0


grep jack /etc/security/limits.d/95-jack.conf                                                                                                                02/22/15  8:11 AM
# Default limits for users of jack-audio-connection-kit
@jackuser - rtprio 90
@jackuser - memlock unlimited
#@jackuser - memlock 4194304
#@jackuser - memlock 107335194

root@jazz:~# sestatus                                                                                                                                                     02/22/15  8:11 AM
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   permissive
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      29

I have commented out all other enteries in /etc/security/limits.d/95-jack.conf
and /etc/security/limits.conf
cat /etc/security/limits.conf                                                                                                                                02/22/15  8:11 AM
# /etc/security/limits.conf
#
#This file sets the resource limits for the users logged in via PAM.
#It does not affect resource limits of the system services.
#
#Also note that configuration files in /etc/security/limits.d directory,
#which are read in alphabetical order, override the settings in this
#file in case the domain is the same or more specific.
#That means for example that setting a limit for wildcard domain here
#can be overriden with a wildcard setting in a config file in the
#subdirectory, but a user specific setting here can be overriden only
#with a user specific setting in the subdirectory.
#
#Each line describes a limit for a user in the form:
#
#<domain>        <type>  <item>  <value>
#
#Where:
#<domain> can be:
#        - a user name
#        - a group name, with @group syntax
#        - the wildcard *, for default entry
#        - the wildcard %, can be also used with %group syntax,
#                 for maxlogin limit
#
#<type> can have the two values:
#        - "soft" for enforcing the soft limits
#        - "hard" for enforcing hard limits
#
#<item> can be one of the following:
#        - core - limits the core file size (KB)
#        - data - max data size (KB)
#        - fsize - maximum filesize (KB)
#        - memlock - max locked-in-memory address space (KB)
#        - nofile - max number of open files
#        - rss - max resident set size (KB)
#        - stack - max stack size (KB)
#        - cpu - max CPU time (MIN)
#        - nproc - max number of processes
#        - as - address space limit (KB)
#        - maxlogins - max number of logins for this user
#        - maxsyslogins - max number of logins on the system
#        - priority - the priority to run user process with
#        - locks - max number of file locks the user can hold
#        - sigpending - max number of pending signals
#        - msgqueue - max memory used by POSIX message queues (bytes)
#        - nice - max nice priority allowed to raise to values: [-20, 19]
#        - rtprio - max realtime priority
#
#<domain>      <type>  <item>         <value>
#

#*               soft    core            0
#*               hard    rss             10000
#@student        hard    nproc           20
#@faculty        soft    nproc           20
#@faculty        hard    nproc           50
#ftp             hard    nproc           0
#@student        -       maxlogins       4

#bodhi - rtprio 90 
#bodhi - memlock unlimited
# bodhi - rtprio 70 bodhi - memlock 107335194

#@audio - rtprio 90          # maximum realtime priority
#@audio - memlock unlimited  # maximum locked-in-memory address space (KB)

#@jackuser - rtprio 90          # maximum realtime priority
#@jackuser - memlock unlimited  # maximum locked-in-memory address space (KB)

# End of file

cat /etc/security/limits.d/95-jack.conf                                                                                                                      02/22/15  8:13 AM
# Default limits for users of jack-audio-connection-kit

@jackuser - rtprio 90
@jackuser - memlock unlimited

#@jackuser - memlock 4194304
#@jackuser - memlock 107335194

#@pulse-rt - rtprio 20
#@pulse-rt - nice -20

#bodhi - rtprio 90 
#bodhi - memlock unlimited

#@audio - rtprio 90          # maximum realtime priority
#@audio - memlock unlimited  # maximum locked-in-memory address space (KB)

cat /etc/security/limits.d/20-nproc.conf                                                                                                                     02/22/15  8:14 AM
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.

*          soft    nproc     4096
root       soft    nproc     unlimited

Full message from qjackctl

08:11:24.114 JACK is starting...
08:11:24.116 /bin/jackd -u -dalsa -r48000 -p1024 -n3 -D -Chw:CODEC -Phw:CODEC -i2 -o2
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
08:11:24.131 JACK was started with PID=2317.
Cannot create RT messagebuffer thread: Operation not permitted (1)
Retrying messagebuffer thread without RT scheduling
Messagebuffer not realtime; consider enabling RT scheduling for user
no message buffer overruns
Cannot create RT messagebuffer thread: Operation not permitted (1)
Retrying messagebuffer thread without RT scheduling
Messagebuffer not realtime; consider enabling RT scheduling for user
no message buffer overruns
Cannot create RT messagebuffer thread: Operation not permitted (1)
Retrying messagebuffer thread without RT scheduling
Messagebuffer not realtime; consider enabling RT scheduling for user
no message buffer overruns
jackdmp 1.9.10
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2014 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 20
self-connect-mode is "Don't restrict self connect requests"
Cannot lock down 107335194 byte memory area (Cannot allocate memory)
audio_reservation_init
Acquire audio card Audio1
creating alsa driver ... hw:CODEC|hw:CODEC|1024|3|48000|2|2|nomon|swmeter|-|32bit
configuring for 48000Hz, period = 1024 frames (21.3 ms), buffer = 3 periods
ALSA: final selected sample format for capture: 16bit little-endian
ALSA: use 3 periods for capture
ALSA: final selected sample format for playback: 16bit little-endian
ALSA: use 3 periods for playback
Cannot use real-time scheduling (RR/20)(1: Operation not permitted)
AcquireSelfRealTime error
08:11:26.224 JACK connection change.
08:11:26.225 Server configuration saved to "/home/bodhi/.jackdrc".
08:11:26.225 Statistics reset.
08:11:26.241 Client activated.
08:11:26.268 JACK connection graph change.
Cannot lock down 107335194 byte memory area (Cannot allocate memory)

Still getting "Cannot allocate memory" despite configuration as directed and disabling selinux

Comment 10 bodhi.zazen 2015-02-22 15:20:08 UTC
root@jazz:~# ulimit -a                                                                                                                                                    02/22/15  8:14 AM
-t: cpu time (seconds)              unlimited
-f: file size (blocks)              unlimited
-d: data seg size (kbytes)          unlimited
-s: stack size (kbytes)             8192
-c: core file size (blocks)         0
-m: resident set size (kbytes)      unlimited
-u: processes                       96370
-n: file descriptors                1024
-l: locked-in-memory size (kbytes)  64
-v: address space (kbytes)          unlimited
-x: file locks                      unlimited
-i: pending signals                 96370
-q: bytes in POSIX msg queues       819200
-e: max nice                        0
-r: max rt priority                 0
-N 15:                              unlimited

and as a user

bodhi@jazz:~$ ulimit -a                                                                                                                                                   02/22/15  8:16 AM
-t: cpu time (seconds)              unlimited
-f: file size (blocks)              unlimited
-d: data seg size (kbytes)          unlimited
-s: stack size (kbytes)             8192
-c: core file size (blocks)         0
-m: resident set size (kbytes)      unlimited
-u: processes                       96370
-n: file descriptors                1024
-l: locked-in-memory size (kbytes)  64
-v: address space (kbytes)          unlimited
-x: file locks                      unlimited
-i: pending signals                 96370
-q: bytes in POSIX msg queues       819200
-e: max nice                        0
-r: max rt priority                 0
-N 15:                              unlimited

running qjackctl as root - works, no errors 

08:18:00.748 Patchbay deactivated.
08:18:00.758 Statistics reset.
08:18:00.760 ALSA connection change.
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
08:18:00.773 ALSA connection graph change.
08:18:03.977 JACK is starting...
08:18:03.978 /bin/jackd -dalsa -dhw:0 -r48000 -p1024 -n2
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
08:18:03.986 JACK was started with PID=2415.
no message buffer overruns
no message buffer overruns
no message buffer overruns
jackdmp 1.9.10
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2014 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 20
self-connect-mode is "Don't restrict self connect requests"
audio_reservation_init
Acquire audio card Audio0
creating alsa driver ... hw:0|hw:0|1024|2|48000|0|0|nomon|swmeter|-|32bit
configuring for 48000Hz, period = 1024 frames (21.3 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 32bit integer little-endian
ALSA: use 2 periods for capture
ALSA: final selected sample format for playback: 32bit integer little-endian
ALSA: use 2 periods for playback
08:18:06.213 JACK connection change.
08:18:06.214 Server configuration saved to "/root/.jackdrc".
08:18:06.215 Statistics reset.
08:18:06.244 Client activated.
08:18:06.271 JACK connection graph change.

AS ROOT

08:19:07.496 Patchbay deactivated.
08:19:07.497 Statistics reset.
08:19:07.499 ALSA connection change.
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
08:19:07.515 ALSA connection graph change.
08:19:29.205 JACK is starting...
08:19:29.206 /bin/jackd -u -dalsa -r48000 -p1024 -n2 -D -Chw:CODEC -Phw:CODEC
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
08:19:29.212 JACK was started with PID=2432.
no message buffer overruns
no message buffer overruns
no message buffer overruns
jackdmp 1.9.10
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2014 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 20
self-connect-mode is "Don't restrict self connect requests"
audio_reservation_init
Acquire audio card Audio1
creating alsa driver ... hw:CODEC|hw:CODEC|1024|2|48000|0|0|nomon|swmeter|-|32bit
configuring for 48000Hz, period = 1024 frames (21.3 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 16bit little-endian
ALSA: use 2 periods for capture
ALSA: final selected sample format for playback: 16bit little-endian
ALSA: use 2 periods for playback
08:19:31.261 JACK connection change.
08:19:31.262 Server configuration saved to "/root/.jackdrc".
08:19:31.262 Statistics reset.
08:19:31.292 Client activated.
08:19:31.319 JACK connection graph change.

So it seems something has changed with security limits.conf ???

Comment 11 bodhi.zazen 2015-02-23 15:55:26 UTC
See this bug - https://bugzilla.redhat.com/show_bug.cgi?id=754285

Comment 12 Fedora End Of Life 2015-11-04 13:29:28 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 13 Fedora End Of Life 2015-12-02 08:37:11 UTC
Fedora 21 changed to end-of-life (EOL) status on 2015-12-01. Fedora 21 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.