View Single Post
Old 07-05-2024, 04:05 PM  
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 5,108
Default SIGKILLs on Linux with PipeWire

REAPER is unavoidably killed via SIGKILL if the main thread is busy for 200ms or longer in the default configuration of many Linux distributions.

This happens because REAPER calls jack_client_open (EDIT: jack_activate) from the main thread and PipeWire's libjack implementation enables realtime scheduling on the calling thread via the RT module.

If the system is configured to allow the user to set a thread's realtime priority, by default PipeWire sets RLIMIT_RTTIME to RLIM_INFINITY (user-configurable via rt.time.{soft,hard}). However, if it's not allowed, PipeWire fallbacks to using the RTKit daemon instead. RTKit sets RLIMIT_RTTIME to 200ms by default (user-configurable via --rttime-usec-max)!

The latter scenario is what happens out-of-the-box on many common distributions with RTKit being often pre-installed.

(EDIT: The problem is specific to the RTKit path combined with jack_set_thread_creator resulting in the thread that calls jack_active becoming realtime.)



This prints "initialized using RTKit" instead of "initialized using regular realtime scheduling":

Code:
PIPEWIRE_DEBUG=mod.rt:D reaper
The RTKit fallback may be disabled via the configuration file for PipeWire's RT module or temporarily via an environment variable:

Code:
DISABLE_RTKIT=1 reaper
To temporarily disable realtime permissions and have PipeWire do the problematic RTKit fallback:

Code:
prlimit --rtprio=0 reaper
This issue is the cause behind many bug reports:
The main thread should not have realtime scheduling!

Last edited by cfillion; 07-05-2024 at 10:55 PM.
cfillion is offline   Reply With Quote