jackaudio/jack1

Warning: cannot use real-time scheduling (FIFO at priority 10) (error=1: Operation not permitted)

Closed this issue · 1 comments

This warning is printed during every startup on the FreeBSD.

What happens is this:

  1. Jack starts with real-time priority
  2. jack_acquire_real_time_scheduling => process already runs at sufficient realtime priority
  3. jack_drop_real_time_scheduling is called with thread=27353088, now it has policy=SCHED_OTHER
  4. thread=27353088 spawns thread=27359488, both have policy=SCHED_OTHER
  5. thread=27353088 spawns thread=27360768, both have policy=SCHED_OTHER
  6. jack_acquire_real_time_scheduling is called in thread=27360768 and it fails, because it can't self-raise its priority, it can only lower it.

It should only lower priority of threads that don't later attempt to raise it again.

IMO, the logic is flawed here. Linux allows to raise priority of threads of root-owned processes, and jack assumes that everybody does the same, while BSD OSes don't allow to raise thread priority. There is rtprio(RTP_SET) for a process, and rtprio_thread(RTP_SET) for a thread.

I am not sure what would be the right fix here. It might be needed to replace pthread_setschedparam -> rtprio_thread.

0EVSG commented

Hi Yuri, closing this because

  • FreeBSD ports moved on to jack2.
  • FreeBSD will soon have a MAC policy to grant realtime privileges to non-root users.
  • If the user is privileged, pthread_setschedparam() approach works.
  • Realtime privileges are also needed for the JACK clients, not only the server.

Regards, Florian