noctalia-shell icon indicating copy to clipboard operation
noctalia-shell copied to clipboard

[BUG] PipeWireService never calls pw_loop_enter()/pw_loop_leave() — no audio device on PipeWire ≥ 1.7

Open Qaaxaap opened this issue 3 months ago • 0 comments

Submission checklist

  • [x] I have searched existing issues and confirmed this is not a duplicate.
  • [x] I am using the latest available version of Noctalia.

Bug description

noctalia does not adhere to pipewire's usage contract. After this pipewire commit, incorrect usage is no longer tolerated by default.

Steps to reproduce

Update pipewire to master.

Expected behavior

Adjust volume normally.

Actual behavior

Unable to adjust volume through noctalia.

Logs / error output

'impl->enter_count > 0' failed at ../pipewire/spa/plugins/support/loop.c:817 loop_iterate()

Noctalia version

a4324409f4f07001d33fbf902be49377ee6b62e2

Compositor

Niri

Distribution

Arch-based

Environment information

source build

Additional context

pipewire commit 1bfb1d922 (2018-06-01, "loop: return number of dispatched fds and update docs") In spa/include/spa/support/loop.h, the usage contract for the event loop control interface (spa_loop_control_*) was established:

spa_loop_control_enter(loop);
while (running) {
spa_loop_control_iterate(loop, -1);
}
spa_loop_control_leave(loop);

For the "attach to an existing event loop" scenario (i.e., the get_fd + iterate(0) pattern used by noctalia), the documentation also states:

/** Enter a loop
 * \param object the control
 *
 * This function should be called before calling iterate and is
 * typically used to capture the thread that this loop will run in.
 * It should ideally be called once from the thread that will run
 * the loop. This function will lock the loop.
 */
void (*enter) (void *object);

/** Leave a loop
 * \param object the control
 *
 * It should ideally be called once after calling iterate when the loop
 * will no longer be iterated from the thread that called enter().
 *
 * This function will unlock the loop.
 */
void (*leave) (void *object);

That is, the correct usage is: call enter once before entering the loop (lock + record the thread), call iterate repeatedly during the loop, and call leave once before exiting (unlock).

commit a661f14d2 (2026-03-09, Barnabás Pőcze, "spa: support: loop: check enter_count before iterating"), At the beginning of loop_iterate() in spa/plugins/support/loop.c, the following was added:

spa_return_val_if_fail(impl->enter_count > 0, -EPERM);

Whereas previous versions did not perform an explicit check, so this incorrect usage could run silently.

In stable 1.6.8's loop_iterate() (loop.c:790), this check is not present. (Only loop_enter/loop_leave have the enter_count check), so on most machines using the stable version of pipewire noctalia works fine.

noctalia does not use any pw_loop_enter() / pw_loop_leave(), does not follow the convention, and will have issues on newer versions that explicitly check.

Disclaimer: I am not a native English speaker and used an LLM to assist with the translation.

Qaaxaap avatar Aug 24 '26 12:08 Qaaxaap