You are not logged in.

#1 2019-03-17 20:49:22

mixxoo
Member
Registered: 2017-05-04
Posts: 10

[SOLVED] JACK started from D-Bus cannot allocate memory

Hi,

when I start JACK via D-Bus with command

jack_control start

I find the following error in the log :

ERROR: Cannot lock down 82280346 byte memory area (Cannot allocate memory)

Nevertheless, JACK seems to be started with realtime priority and all audio works without problems

ps -C jackdbus H o pid,tid,comm,rtprio,priority,policy
  PID   TID COMMAND         RTPRIO PRI POL
 3021  3021 jackdbus             -  20 TS
 3021  3025 jackdbus             -  20 TS
 3021  3026 jackdbus            90 -91 FF
 3021  3027 jackdbus             -  20 TS

Although MPD complains about not be able to memlock as well, but audio plays.

jack_output: Cannot lock down 82280346 byte memory area (Cannot allocate memory)
jack_output: Cannot use real-time scheduling (RR/85)(1: Operation not permitted)
jack_output: JackClient::AcquireSelfRealTime error

I have correctly setup realtime privileges (realtime group member) and starting via Qjackctl or directly from shell (jackd command) works without error messages.

/etc/security/limits.d/99-realtime-privileges.conf
@realtime - rtprio 98
@realtime - memlock unlimited

Please do you have any ideas what is going on any hints where to dig to get rid of those errors?

THX

Last edited by mixxoo (2019-03-24 10:21:17)

Offline

#2 2019-03-17 21:29:14

Maniaxx
Member
Registered: 2014-05-14
Posts: 732

Re: [SOLVED] JACK started from D-Bus cannot allocate memory

Set 'DefaultLimitMEMLOCK=128M' in:
/etc/systemd/system.conf
/etc/systemd/user.conf

and re-login. Check with 'ulimit -l'.

That probably will not fix this though:

jack_output: Cannot use real-time scheduling (RR/85)(1: Operation not permitted)

Last edited by Maniaxx (2019-03-17 21:33:57)


sys2064

Offline

#3 2019-03-18 11:07:31

mixxoo
Member
Registered: 2017-05-04
Posts: 10

Re: [SOLVED] JACK started from D-Bus cannot allocate memory

Sorry, I forgot to say ulimit -l already showed unlimited

ulimit -a

core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 59556
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 98
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 59556
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

I guess it is a privilege related issue but I ran out of ideas. Classic approach JACK works, however with D-Bus it behaves this strange. It might look as bug maybe. Because although it throws the error realtime seems to work correctly.

Offline

#4 2019-03-18 15:38:15

Maniaxx
Member
Registered: 2014-05-14
Posts: 732

Re: [SOLVED] JACK started from D-Bus cannot allocate memory

Not just 'Jack' needs to run ìn realtime, MPD should as well. I guess its not.
Are you in 'audio' and 'realtime' group?
You still seem to be on 64MB limit. Did you check soft and hard limits?

$ ulimit -Sl 
$ ulimit -Hl

Can you give me this output?

$ init --version
$ uname -a

sys2064

Offline

#5 2019-03-19 11:09:55

mixxoo
Member
Registered: 2017-05-04
Posts: 10

Re: [SOLVED] JACK started from D-Bus cannot allocate memory

$ ulimit -Sl
unlimited
$ ulimit -Hl
unlimited
$ init --version
systemd 240
+PAM +AUDIT -SELINUX -IMA -APPARMOR +SMACK -SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid
$ uname -a
Linux NUC 4.20.5-arch1-1-ARCH #1 SMP PREEMPT Sat Jan 26 12:59:18 UTC 2019 x86_64 GNU/Linux
$ groups
wheel video audio wireshark realtime mirek

MPD is started via user systemd unit and I presume the output thread IS realtime

$ ps -C mpd H o pid,tid,comm,rtprio,priority,policy
  PID   TID COMMAND         RTPRIO PRI POL
  545   545 mpd                  -  20 TS
  545   556 io                   -  20 TS
  545   557 rtio                50 -51 FF
  545  1190 player               -  20 TS
  545  1191 decoder:mad          -  20 TS
  545  1192 output:JACK         50 -51 FF
  545  1193 output:JACK          -  20 TS
  545  1194 output:JACK          -  20 TS
  545  1195 output:JACK          -  20 TS

Offline

#6 2019-03-19 13:01:38

Maniaxx
Member
Registered: 2014-05-14
Posts: 732

Re: [SOLVED] JACK started from D-Bus cannot allocate memory

Update your system. Systemd 240 is buggy.

mixxoo wrote:

MPD is started via user systemd unit and I presume the output thread IS realtime

Yes, my fault. Didn't notice the TID column.
MPD probably still tries both implementations: 'sched_setscheduler' and 'pthread_setschedparam'.
https://github.com/MusicPlayerDaemon/MP … -364320830

Last edited by Maniaxx (2019-03-19 13:28:45)


sys2064

Offline

#7 2019-03-24 10:18:24

mixxoo
Member
Registered: 2017-05-04
Posts: 10

Re: [SOLVED] JACK started from D-Bus cannot allocate memory

System upgrade solved the problem with JACK memory allocation started via D-Bus. I did not follow the forum rule "pacman -Syu" before asking. Sorry.
However the MPD issue still persists. I guess it might be because MPD tries to set SCHED_RR and JACK is running with SCHED_FIFO. I don't know.

Offline

#8 2019-03-24 18:24:04

Maniaxx
Member
Registered: 2014-05-14
Posts: 732

Re: [SOLVED] JACK started from D-Bus cannot allocate memory

I quickly tested mpd with Cantata and GMPC and i don't get that error.


sys2064

Offline

#9 2020-04-04 09:38:32

mixxoo
Member
Registered: 2017-05-04
Posts: 10

Re: [SOLVED] JACK started from D-Bus cannot allocate memory

Just to conclude the topic. Many weeks later, just by chance, I found the root of the problem with MPD. It was in systemd mpd.service configuration file. It limits MPD's realtime priority to 50 and JACK requires 85.

# allow MPD to use real-time priority 50
LimitRTPRIO=50
LimitRTTIME=infinity

After changing this setting everything works fine.

Offline

Board footer

Powered by FluxBB