From aef3d02173d162b7dfce495da9f04d8722d43811 Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Sun, 31 May 2026 15:42:41 +0200 Subject: [PATCH] module-rt: Use a sane timeout for DBus messages The default of 30s (* 3 for the 3 lookups), makes the mainloop block for a very long time if anything is wrong with RTKit. --- src/modules/module-rt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/module-rt.c b/src/modules/module-rt.c index b1bc817e3..30e0846ec 100644 --- a/src/modules/module-rt.c +++ b/src/modules/module-rt.c @@ -185,6 +185,8 @@ static const struct spa_dict_item module_props[] = { #define XDG_PORTAL_OBJECT_PATH "/org/freedesktop/portal/desktop" #define XDG_PORTAL_INTERFACE "org.freedesktop.portal.Realtime" +#define DBUS_TIMEOUT_MSEC 2000 /* max time to block on any single message */ + /** \cond */ struct pw_rtkit_bus { DBusConnection *bus; @@ -370,7 +372,7 @@ static long long rtkit_get_int_property(struct impl *impl, const char *propname, spa_auto(DBusError) error = DBUS_ERROR_INIT; - if (!(r = dbus_connection_send_with_reply_and_block(connection->bus, m, -1, &error))) + if (!(r = dbus_connection_send_with_reply_and_block(connection->bus, m, DBUS_TIMEOUT_MSEC, &error))) return translate_error(error.name); if (dbus_set_error_from_message(&error, r)) @@ -1134,7 +1136,7 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args) } if (IS_VALID_NICE_LEVEL(impl->nice_level)) { - if (set_nice(impl, impl->nice_level, !use_rtkit) < 0) + if (set_nice(impl, impl->nice_level, !use_rtkit) < 0) use_rtkit = can_use_rtkit; } if (!use_rtkit)