Bug 107144

Summary: Jack modules showing real-time schedule warnings on load
Product: PulseAudio Reporter: Sam P <dagofthedofg>
Component: modulesAssignee: pulseaudio-bugs
Status: RESOLVED MOVED QA Contact: pulseaudio-bugs
Severity: normal    
Priority: medium CC: lennart
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: pulseaudio --dump-conf
cat /proc/`pidof pulseaudio`/limits
cat /proc/`pidof pulseaudio`/limits
~/.config/pulse/daemon.conf
/etc/pulse/daemon.conf
pulseaudio --dump-conf
cat /proc/`pidof jackdbus`/limits
cat /proc/`pidof pulseaudio`/limits

Description Sam P 2018-07-06 20:22:28 UTC
Overview:

During startup the module-jack-sink and module-jack-source are showing warnings regarding gaining real-time priority.

Steps to reproduce:

Start the jackdbus instance while the pulseaudio sound server is running.

Actual results:

Errors show up in the logs:

Jun 21 08:43:46 localhost pulseaudio[1988]: W: [pulseaudio]
module-jack-sink.c: JACK error >Cannot use real-time scheduling
(RR/15)(1: Operation not permitted)<
Jun 21 08:43:46 localhost pulseaudio[1988]: W: [pulseaudio]
module-jack-source.c: JACK error >Cannot use real-time scheduling
(RR/15)(1: Operation not permitted)<
Jun 21 08:44:40 localhost pulseaudio[2596]: W: [pulseaudio]
module-jack-sink.c: JACK error >Cannot use real-time scheduling
(RR/15)(1: Operation not permitted)<
Jun 21 08:44:40 localhost pulseaudio[2596]: W: [pulseaudio]
module-jack-source.c: JACK error >Cannot use real-time scheduling
(RR/15)(1: Operation not permitted)<

Expected Results:

No warnings to be shown

Build Date & Hardware:

$ cat /etc/fedora-release 
Fedora release 28 (Twenty Eight)
$ sudo dnf info pulseaudio-module-jack
Last metadata expiration check: 0:33:22 ago on Fri 06 Jul 2018 02:43:20 PM CDT.
Installed Packages
Name         : pulseaudio-module-jack
Version      : 11.1
Release      : 18.fc28.1
Arch         : x86_64
Size         : 63 k
Source       : pulseaudio-11.1-18.fc28.1.src.rpm
Repo         : @System
From repo    : updates
Summary      : JACK support for the PulseAudio sound server
URL          : http://www.freedesktop.org/wiki/Software/PulseAudio
License      : LGPLv2+
Description  : JACK sink and source modules for the PulseAudio sound server.

Additional Builds and Platforms:

I am not aware of a version where this issue has not existed

Additional Information:

I have my user added to the fedora "jackuser" group which has the following /etc/security/limits.d.conf settings:

@jackuser - rtprio 70
@jackuser - memlock 4194304

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

When I increase the verbosity these are the results:

I: [pulseaudio] module-jack-sink.c: Successfully connected as
'PulseAudio JACK Sink'
I: [pulseaudio] module-device-restore.c: Restoring volume for sink
jack_out: front-left: 45922 /  70%,   front-right: 45922 /  70%
I: [pulseaudio] module-device-restore.c: Restoring mute state for sink
jack_out: unmuted
W: [pulseaudio] sink.c: Default and alternate sample rates are the same.
I: [pulseaudio] sink.c: Created sink 3 "jack_out" with sample spec
float32le 2ch 48000Hz and channel map front-left,front-right
I: [pulseaudio] sink.c:     device.api = "jack"
I: [pulseaudio] sink.c:     device.description = "Jack sink
(PulseAudio JACK Sink)"
I: [pulseaudio] sink.c:     jack.client_name = "PulseAudio JACK Sink"
I: [pulseaudio] sink.c:     device.icon_name = "audio-card"
I: [pulseaudio] module-device-restore.c: Restoring volume for source
jack_out.monitor: front-left: 65536 / 100%,   front-right: 65536 /
100%
I: [pulseaudio] source.c: Created source 5 "jack_out.monitor" with
sample spec float32le 2ch 48000Hz and channel map
front-left,front-right
I: [pulseaudio] source.c:     device.description = "Monitor of Jack
sink (PulseAudio JACK Sink)"
I: [pulseaudio] source.c:     device.class = "monitor"
I: [pulseaudio] source.c:     device.icon_name = "audio-input-microphone"
I: [pulseaudio] module-jack-sink.c: JACK thread starting up.
I: [pulseaudio] core-util.c: Successfully enabled SCHED_RR scheduling
for thread, with priority 9.
I: [jack-sink] core-util.c: Successfully enabled SCHED_RR scheduling
for thread, with priority 5.
I: [pulseaudio] module-jack-sink.c: JACK buffer size changed.
I: [pulseaudio] module-jack-sink.c: JACK thread starting up.
I: [pulseaudio] core-util.c: Successfully enabled SCHED_RR scheduling
for thread, with priority 9.
W: [pulseaudio] module-jack-sink.c: JACK error >Cannot use real-time
scheduling (RR/15)(1: Operation not permitted)<
W: [pulseaudio] module-jack-sink.c: JACK error
>JackClient::AcquireSelfRealTime error<
I: [pulseaudio] module-jack-sink.c: JACK thread starting up.
I: [pulseaudio] core-util.c: Successfully enabled SCHED_RR scheduling
for thread, with priority 9.
I: [pulseaudio] module.c: Loaded "module-jack-sink" (index: #24;
argument: "connect=no channels=2").
I: [pulseaudio] module-jackdbus-detect.c: Successfully started module-jack-sink.
I: [pulseaudio] module-jack-source.c: Successfully connected as
'PulseAudio JACK Source'
I: [pulseaudio] module-device-restore.c: Restoring volume for source
jack_in: front-left: 65536 / 100%,   front-right: 65536 / 100%
I: [pulseaudio] module-device-restore.c: Restoring mute state for
source jack_in: unmuted
W: [pulseaudio] source.c: Default and alternate sample rates are the same.
I: [pulseaudio] source.c: Created source 6 "jack_in" with sample spec
float32le 2ch 48000Hz and channel map front-left,front-right
I: [pulseaudio] source.c:     device.api = "jack"
I: [pulseaudio] source.c:     device.description = "Jack source
(PulseAudio JACK Source)"
I: [pulseaudio] source.c:     jack.client_name = "PulseAudio JACK Source"
I: [pulseaudio] source.c:     device.icon_name = "audio-input-microphone"
I: [pulseaudio] module-jack-source.c: JACK thread starting up.
I: [pulseaudio] core-util.c: Successfully enabled SCHED_RR scheduling
for thread, with priority 9.
I: [jack-source] core-util.c: Successfully enabled SCHED_RR scheduling
for thread, with priority 5.
I: [pulseaudio] module-jack-source.c: JACK thread starting up.
I: [pulseaudio] core-util.c: Successfully enabled SCHED_RR scheduling
for thread, with priority 9.
W: [pulseaudio] module-jack-source.c: JACK error >Cannot use real-time
scheduling (RR/15)(1: Operation not permitted)<
W: [pulseaudio] module-jack-source.c: JACK error
>JackClient::AcquireSelfRealTime error<
I: [pulseaudio] module-jack-source.c: JACK thread starting up.
I: [pulseaudio] core-util.c: Successfully enabled SCHED_RR scheduling
for thread, with priority 9.
I: [pulseaudio] module.c: Loaded "module-jack-source" (index: #25;
argument: "connect=no channels=2").
I: [pulseaudio] module-jackdbus-detect.c: Successfully started
module-jack-source.

Jack and pulse are able to startup just fine and everything appears to be "functional" but due to the nature of the beast I have concerns with the module not running at real-time priority.

I replicated the issue on a live image of Fedora 28 using the "liveuser" ensuring that it was a member of the jackuser group with minimal configuration changes.
Comment 1 Tanu Kaskinen 2018-07-26 11:35:40 UTC
What do these two commands print?

    pulseaudio --dump-conf
    cat /proc/`pidof pulseaudio`/limits

Please use the "Add an attachment" link rather than pasting long text to the comment field.
Comment 2 Tanu Kaskinen 2018-07-26 12:01:09 UTC
It occurred to me that systemd might be restricting the rtprio limit, and indeed, it seems that when systemd is used, /etc/security/limits.conf doesn't have effect.

I don't know how per-user and per-group limits are supposed to be configured with systemd - if you figure that out, please leave a comment here. I know it's possible to configure per-service limits in systemd, but that's not the same as per-user and per-group configuration.
Comment 3 Sam P 2018-07-26 12:42:47 UTC
Created attachment 140830 [details]
pulseaudio --dump-conf
Comment 4 Sam P 2018-07-26 12:44:17 UTC
Created attachment 140831 [details]
cat /proc/`pidof pulseaudio`/limits
Comment 5 Sam P 2018-07-26 12:47:32 UTC
I stopped the systemd user service for pulseaudio using:

$ systemctl --user stop pulse*

and then ran pulseaudio manually via

$ pulseaudio 
W: [pulseaudio] sink.c: Default and alternate sample rates are the same.
W: [pulseaudio] module-jack-sink.c: JACK error >Cannot use real-time scheduling (RR/15)(1: Operation not permitted)<
W: [pulseaudio] module-jack-sink.c: JACK error >JackClient::AcquireSelfRealTime error<
W: [pulseaudio] source.c: Default and alternate sample rates are the same.
W: [pulseaudio] module-jack-source.c: JACK error >Cannot use real-time scheduling (RR/15)(1: Operation not permitted)<
W: [pulseaudio] module-jack-source.c: JACK error >JackClient::AcquireSelfRealTime error<

I will attach a second output of the limits details of pulseaudio running outside of systemd.
Comment 6 Sam P 2018-07-26 12:47:59 UTC
Created attachment 140832 [details]
cat /proc/`pidof pulseaudio`/limits
Comment 7 Sam P 2018-07-26 12:48:36 UTC
If you look you can see that regardless of whether it is being run from systemd, the max realtime priority still shows 9.
Comment 8 Tanu Kaskinen 2018-07-26 12:58:19 UTC
I looked into this a bit more, and /etc/security/limits.conf shouldn't be completely ignored on most systems. The pam_limits PAM module should set the limits as appropriate when you log in.

I would have expected that when your run pulseaudio from systemd, the limit would be set to 0 regardless, but apparently limits.conf is having effect also on user services started by systemd.

PulseAudio will by default set the rtprio limit to 9, so you'll need to change that. If you put "rlimit-rtprio = 70" to ~/.config/pulse/daemon.conf, I believe the warnings will go away.

Do you know why libjack is trying to set priority 15 for its thread? Is that what it does by default, or have you configured it yourself? Long time ago, PulseAudio's default rtprio limit was set so that it would work with jack, but if jack's default priority has been raised since then, then the default rtprio limit in PulseAudio should be raised as well.
Comment 9 Sam P 2018-07-26 13:02:37 UTC
Created attachment 140833 [details]
~/.config/pulse/daemon.conf
Comment 10 Sam P 2018-07-26 13:03:24 UTC
Created attachment 140834 [details]
/etc/pulse/daemon.conf
Comment 11 Sam P 2018-07-26 13:09:25 UTC
I have had rlimit-rtprio = 15 in my /etc/pulse/daemon.conf for most of my testing. I updated to 70 and added a directive to .config/pulse/daemon.conf and tried starting pulse but the warnings still persist:

$ pulseaudio 
W: [pulseaudio] sink.c: Default and alternate sample rates are the same.
W: [pulseaudio] module-jack-sink.c: JACK error >Cannot use real-time scheduling (RR/15)(1: Operation not permitted)<
W: [pulseaudio] module-jack-sink.c: JACK error >JackClient::AcquireSelfRealTime error<
W: [pulseaudio] source.c: Default and alternate sample rates are the same.
W: [pulseaudio] module-jack-source.c: JACK error >Cannot use real-time scheduling (RR/15)(1: Operation not permitted)<
W: [pulseaudio] module-jack-source.c: JACK error >JackClient::AcquireSelfRealTime error<
$ pulseaudio 
W: [pulseaudio] sink.c: Default and alternate sample rates are the same.
W: [pulseaudio] module-jack-sink.c: JACK error >Cannot use real-time scheduling (RR/15)(1: Operation not permitted)<
W: [pulseaudio] module-jack-sink.c: JACK error >JackClient::AcquireSelfRealTime error<
W: [pulseaudio] source.c: Default and alternate sample rates are the same.
W: [pulseaudio] module-jack-source.c: JACK error >Cannot use real-time scheduling (RR/15)(1: Operation not permitted)<
W: [pulseaudio] module-jack-source.c: JACK error >JackClient::AcquireSelfRealTime error<

I just run Jack with the default priority settings so I'm not sure if they've changed recently.
Comment 12 Tanu Kaskinen 2018-07-26 13:36:20 UTC
Ah, I read the "pulseaudio --dump-conf" attachment sloppily. I didn't notice that the file was read from the very old configuration location, ~/.pulse, which is why editing ~/.config/pulse/daemon.conf didn't work. If ~/.pulse/daemon.conf exists, then neither ~/.config/pulse/daemon.conf nor /etc/pulse/daemon.conf are read.

I recommend you to delete ~/.pulse. If there's something that should be saved, move those files to ~/.config/pulse. Then make sure that ~/.config/pulse/daemon.conf has high enough rlimit-rtprio.
Comment 13 Sam P 2018-07-26 14:02:26 UTC
Created attachment 140836 [details]
pulseaudio --dump-conf
Comment 14 Sam P 2018-07-26 14:03:13 UTC
I have removed the .pulse directory and tried starting pulseaudio again outside of systemd but I'm getting the same error:

$ pulseaudio 
W: [pulseaudio] sink.c: Default and alternate sample rates are the same.
W: [pulseaudio] module-jack-sink.c: JACK error >Cannot use real-time scheduling (RR/15)(1: Operation not permitted)<
W: [pulseaudio] module-jack-sink.c: JACK error >JackClient::AcquireSelfRealTime error<
W: [pulseaudio] source.c: Default and alternate sample rates are the same.
W: [pulseaudio] module-jack-source.c: JACK error >Cannot use real-time scheduling (RR/15)(1: Operation not permitted)<
W: [pulseaudio] module-jack-source.c: JACK error >JackClient::AcquireSelfRealTime error<
Comment 15 Tanu Kaskinen 2018-07-26 14:08:14 UTC
Now the rlimit-rtprio option shouldn't any more be an issue. What does "cat /proc/`pidof pulseaudio`/limits" print now?
Comment 16 Sam P 2018-07-26 14:10:26 UTC
Created attachment 140837 [details]
cat /proc/`pidof jackdbus`/limits
Comment 17 Tanu Kaskinen 2018-07-26 15:45:09 UTC
According to the attachment description you printed the jackdbus limits, but what does "cat /proc/`pidof pulseaudio`/limits" print?
Comment 18 Sam P 2018-07-27 13:05:39 UTC
Created attachment 140854 [details]
cat /proc/`pidof pulseaudio`/limits

Thanks Tanu, here is the output but the issue still persists.
Comment 19 Tanu Kaskinen 2018-07-29 16:06:22 UTC
I'm out of ideas. According to the limits file the process has permission to use RT priority 15, so everything should be fine.
Comment 20 GitLab Migration User 2018-07-30 10:14:38 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/292.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.