NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.13k stars 14.17k forks source link

pulseaudio realtime error with jackdbus integration #15851

Open anderspapitto opened 8 years ago

anderspapitto commented 8 years ago

Issue description

when pulseaudio connects to jack over dbus, an error is generated because jack (or maybe pulseaudio, I'm not sure) is unable to set itself to a realtime priority.

Steps to reproduce

from a clean boot. The initial restart is due to https://github.com/NixOS/nixpkgs/issues/15850, which I believe to be an entirely unrelated issue.

[anders@gurney:~]
$ systemctl --user restart pulseaudio
[anders@gurney:~]
$ systemctl --user status pulseaudio
● pulseaudio.service - PulseAudio Server
   Loaded: loaded (/nix/store/zcqqaw2w6p8n2pp4c7h4czx6ldia0qmj-unit-pulseaudio.service/pulseaudio.service; static; vendor preset: enabled)
   Active: active (running) since Mon 2016-05-30 22:25:22 PDT; 4s ago
 Main PID: 1373 (pulseaudio)
   CGroup: /user.slice/user-1000.slice/user@1000.service/pulseaudio.service
           └─1373 /nix/store/vijnj53rskw5ijcrlp0cngb8f9s6y1am-pulseaudio-8.0/bin/pulseaudio --daemonize=no

May 30 22:25:22 gurney systemd[964]: Starting PulseAudio Server...
May 30 22:25:22 gurney systemd[964]: Started PulseAudio Server.
[anders@gurney:~]
$ jack_control start
--- start
[anders@gurney:~]
$ systemctl --user status pulseaudio
● pulseaudio.service - PulseAudio Server
   Loaded: loaded (/nix/store/zcqqaw2w6p8n2pp4c7h4czx6ldia0qmj-unit-pulseaudio.service/pulseaudio.service; static; vendor preset: enabled)
   Active: active (running) since Mon 2016-05-30 22:25:22 PDT; 17s ago
 Main PID: 1373 (pulseaudio)
   CGroup: /user.slice/user-1000.slice/user@1000.service/pulseaudio.service
           └─1373 /nix/store/vijnj53rskw5ijcrlp0cngb8f9s6y1am-pulseaudio-8.0/bin/pulseaudio --daemonize=no

May 30 22:25:22 gurney systemd[964]: Starting PulseAudio Server...
May 30 22:25:22 gurney systemd[964]: Started PulseAudio Server.
May 30 22:25:38 gurney pulseaudio[1373]: W: [pulseaudio] sink.c: Default and alternate sample rates are the same.
May 30 22:25:38 gurney pulseaudio[1373]: W: [pulseaudio] module-jack-sink.c: JACK error >Cannot use real-time scheduling (RR/5)(1: Operation not permitted)<
May 30 22:25:38 gurney pulseaudio[1373]: W: [pulseaudio] module-jack-sink.c: JACK error >JackClient::AcquireSelfRealTime error<
May 30 22:25:38 gurney pulseaudio[1373]: W: [pulseaudio] source.c: Default and alternate sample rates are the same.
May 30 22:25:38 gurney pulseaudio[1373]: W: [pulseaudio] module-jack-source.c: JACK error >Cannot use real-time scheduling (RR/5)(1: Operation not permitted)<
May 30 22:25:38 gurney pulseaudio[1373]: W: [pulseaudio] module-jack-source.c: JACK error >JackClient::AcquireSelfRealTime error<

I do have sufficient permissions through limits.conf to execute realtime processes

[anders@gurney:~]
$ groups
users wheel audio docker
[anders@gurney:~]
$ chrt -rr 1 true
[anders@gurney:~]
$ echo $?
0
[anders@gurney:~]
$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 31196
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 99999
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 99
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 31196
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

Technical details

joelmo commented 8 years ago

What version do you use, I can't find e707090M. Could you also provide a minimal config to make it easier to reproduce this error?

anderspapitto commented 8 years ago

I'm on unstable, with a couple extra commits on top. e.g. right now fbde3a745259edf20dc8e275eee954875a2d50ab is the closest hash that's on github. The only extra commit that's related to this is https://github.com/NixOS/nixpkgs/pull/15840 - you'll need to cherry-pick that fix, or else you won't make it as far as this bug.

my full configuration is here https://github.com/anderspapitto/nixos-configuration/blob/master/audio.nix - I don't think there's anything special or edge-casey about my config that's causing this - if you're on ustable + that commit you should be able to just enable pulseaudio and observe it easily

joelmo commented 8 years ago

Try uncommenting wantedBy, and add after = [ "pulseaudio.service" ].

anderspapitto commented 8 years ago

that doesn't have any effect. notice that the original problem I'm reporting isn't with my systemd unit. The problem I'm reporting is that running jack_control manually from a shell causes an error from pulseaudio - that has nothing to do with wantedBy or after - and I do this when it's quite clear that pulseaudio is up.

Are you able to reproduce the same problem?

joelmo commented 8 years ago

I sometimes use jack and PA together to route PA to jack, however I don't use dbus. I use this command:

pulseaudio -k
sleep 1
pactl load-module module-jack-sink channels=2; pacmd set-default-sink jack_out

Seems I can use jack_control, even when PA uses the card:

~ $ jack_control start
--- start
~ $ pulseaudio -k
~ $ sleep 1
~ $ pactl load-module module-jack-sink channels=2; pacmd set-default-sink jack_out

But this if from a shell, at 7465bcd.

Does the log on your jackdbus service say anything?

Profpatsch commented 6 years ago

triage: does this error still appear?

gzoom13 commented 4 years ago

I have just the same problem with all outputs being just the same that @anderspapitto have.

[andrey@andrey-pc:~]$ jack_control status
--- status
stopped

[andrey@andrey-pc:~]$ jack_control start
--- start

[andrey@andrey-pc:~]$ jack_control status
--- status
started

[andrey@andrey-pc:~]$ systemctl --user status pulseaudio
● pulseaudio.service - Sound Service
   Loaded: loaded (/nix/store/7v30452hfhfvfpvnpz90f1c8zavvbp60-pulseaudio-12.2/lib/systemd/user/pulseaudio.service; indirect; vendor preset: enabled)
  Drop-In: /nix/store/1fam4xjwibj3ajngx63n6dzcl3gr9m60-user-units/pulseaudio.service.d
           └─overrides.conf
   Active: active (running) since Sat 2020-01-11 10:25:18 MSK; 4min 39s ago
 Main PID: 1987 (pulseaudio)
   CGroup: /user.slice/user-1000.slice/user@1000.service/pulseaudio.service
           ├─1987 /nix/store/7v30452hfhfvfpvnpz90f1c8zavvbp60-pulseaudio-12.2/bin/pulseaudio --daemonize=no
           └─1991 /nix/store/7v30452hfhfvfpvnpz90f1c8zavvbp60-pulseaudio-12.2/libexec/pulse/gsettings-helper

Jan 11 10:29:26 andrey-pc pulseaudio[1987]: W: [pulseaudio] module-jack-source.c: JACK error >JackClient::AcquireSelfRealTime error<
Jan 11 10:29:32 andrey-pc pulseaudio[1987]: W: [pulseaudio] module-jack-source.c: JACK error >Server is not running<
Jan 11 10:29:32 andrey-pc pulseaudio[1987]: W: [pulseaudio] module-jack-source.c: JACK error >Server is not running<
Jan 11 10:29:51 andrey-pc pulseaudio[1987]: W: [pulseaudio] module-jack-sink.c: JACK error >Cannot open PulseAudio JACK Sink client<
Jan 11 10:29:51 andrey-pc pulseaudio[1987]: W: [pulseaudio] module-jack-sink.c: JACK error >JackShmReadWritePtr1::~JackShmReadWritePtr1 - Init not done for -1, skipping unlock<
Jan 11 10:29:51 andrey-pc pulseaudio[1987]: W: [pulseaudio] module-jack-sink.c: JACK error >JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock<
Jan 11 10:29:51 andrey-pc pulseaudio[1987]: E: [pulseaudio] module-jack-sink.c: jack_client_open() failed.
Jan 11 10:29:51 andrey-pc pulseaudio[1987]: E: [pulseaudio] module.c: Failed to load module "module-jack-sink" (argument: "connect=yes channels=2"): initialization failed.
Jan 11 10:29:51 andrey-pc pulseaudio[1987]: W: [pulseaudio] module-jack-source.c: JACK error >Cannot use real-time scheduling (RR/5)(1: Operation not permitted)<
Jan 11 10:29:51 andrey-pc pulseaudio[1987]: W: [pulseaudio] module-jack-source.c: JACK error >JackClient::AcquireSelfRealTime error<

[andrey@andrey-pc:~]$ nixos-version
19.09.1686.69ed29f5f41 (Loris)

[andrey@andrey-pc:~]$ nix-env --version
nix-env (Nix) 2.3

[andrey@andrey-pc:~]$ nix-instantiate --eval '<nixpkgs>' -A lib.version
"19.09.1686.69ed29f5f41"
stale[bot] commented 4 years ago

Hello, I'm a bot and I thank you in the name of the community for opening this issue.

To help our human contributors focus on the most-relevant reports, I check up on old issues to see if they're still relevant. This issue has had no activity for 180 days, and so I marked it as stale, but you can rest assured it will never be closed by a non-human.

The community would appreciate your effort in checking if the issue is still valid. If it isn't, please close it.

If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me". If you'd like it to get more attention, you can ask for help by searching for maintainers and people that previously touched related code and @ mention them in a comment. You can use Git blame or GitHub's web interface on the relevant files to find them.

Lastly, you can always ask for help at our Discourse Forum or at #nixos' IRC channel.