Skip to content

Apps built on hyprtoolkit die by signal on compositor disconnect at session end (hyprpaper SIGSEGV, hyprpolkitagent SIGABRT) #134

Closed

Description

@VirInvictus

Two hyprtoolkit clients crash when the compositor disconnects at session end. The toolkit event loop logs failed to read Wayland events: 32 (EPIPE) and the process then dies by signal instead of exiting cleanly. Both apps link libhyprtoolkit and print the same first error line, which points the failure at the shared library rather than the apps. Other toolkit clients probably behave the same, but the two below are what I have direct evidence for. On this system it happens on every session end: 6 crashes over 4 days, exactly one per logout/shutdown.

Other Wayland clients on the same session (swaync, xdg-desktop-portal-gtk/kde, Qt apps) all see the same broken pipe and exit normally.

Environment

Component Version
Fedora 44
Hyprland 0.56.2 (Fedora package)
hyprpaper 0.8.4-3.fc44
hyprpolkitagent 0.2.0-1.fc44
hyprtoolkit 0.6.0-1.fc44 (libhyprtoolkit.so.6)

Both binaries link libhyprtoolkit.so.6. Before filing I diffed upstream main against the v0.6.0 tag: tip is f8cbaf4 ("version: bump to 0.6.0", 2026-09-09) and the trees are identical, so this is not already fixed on main.

Evidence

hyprpaper, at session end (2026-09-15 23:41:20):

Sep 15 23:41:20 fedora hyprpaper[1849]: ERR from hyprtoolkit ]: failed to read Wayland events: 32
Sep 15 23:41:20 fedora systemd[1611]: hyprpaper.service: Main process exited, code=dumped, status=11/SEGV
Sep 15 23:41:20 fedora systemd[1611]: hyprpaper.service: Failed with result 'core-dump'.

hyprpolkitagent, same second, same first line, different second-level failure:

Sep 15 23:41:20.129185 fedora hyprpolkitagent[1855]: ERR ]: failed to read Wayland events: 32
Sep 15 23:41:20.147173 fedora hyprpolkitagent[1855]: terminate called after throwing an instance of 'sdbus::Error'
Sep 15 23:41:20.147173 fedora hyprpolkitagent[1855]:   what():  [System.Error.EBADF] Failed to notify event descriptor (Bad file descriptor)
Sep 15 23:41:20 fedora systemd[1611]: hyprpolkitagent.service: Main process exited, code=dumped, status=6/ABRT

hyprpaper's Restart=on-failure then restarts it into the already-dead session:

Sep 15 23:41:20 fedora systemd[1611]: hyprpaper.service: Scheduled restart job, restart counter is at 1.
Sep 15 23:41:20 fedora hyprpaper[392996]: ERR from hyprtoolkit ]: Wayland platform cannot start: wl_display_connect failed (is a wayland compositor running?)

Reproduction

  1. Start a Hyprland session with hyprpaper and hyprpolkitagent running (any hyprtoolkit client should behave the same).
  2. End the session: logout, hyprctl dispatch exit, or poweroff.
  3. Check journalctl --user -b: the client logs failed to read Wayland events: 32 and terminates by signal.

What I checked in the source (v0.6.0)

src/core/Backend.cpp, CBackend::dispatchWayland() (the error line is at Backend.cpp:568). The read-failure path looks correct: it clears the fd source mask, calls terminate(), and returns. flushWayland() follows the same pattern. CBackend::enterLoop() then runs cleanup(), which tears down sources, the executor, the renderer/OpenGL state, backend services, the Wayland platform, config, and logger in that order.

Since the loop-side handling terminates the loop cleanly, the signal lands downstream: in that cleanup chain, or in app code after enterLoop() returns. Without a backtrace I can't name the frame (next section). The comment in ~CBackend() about static-destruction order being a known hazard is part of why I suspect the cleanup chain.

For history: pre-rewrite hyprpaper 0.7.x died on the same trigger with SIGABRT via its own assertion, so crash-on-disconnect in hyprpaper is not new. What changed in 0.8 is that the identical error line now comes from the shared event loop, and both apps linked against it hit it.

Sep 10 11:16:56 fedora hyprpaper[1864]: ASSERTION FAILED!
Sep 10 11:16:56 fedora hyprpaper[1864]: [core] Disconnected from pollfd id 0
Sep 10 11:16:56 fedora systemd[1612]: hyprpaper.service: Main process exited, code=dumped, status=6/ABRT

Why there is no backtrace

Every observed crash coincides with session teardown. On shutdown, systemd-coredump logs processing... for the process and the machine powers off before the dump lands, so coredumpctl has no entries for either binary. I have not yet collected a dump from a logout; I can do that and attach the backtrace if useful.

Impact

Teardown-only: no functional loss, nothing to recover. The cost is that every session end marks both units failed with core-dump, restarts hyprpaper into a dead session, and shows users a segfault line at shutdown.

Activity

  1. UncleJ4ck commented on Nov 9, 2026

    @UncleJ4ck
    Contributor

    had a look. the loop side is clean on main like you found, dispatchWayland terminates and returns, so the signal is downstream.

    the two look like separate app-side teardown bugs the clean exit just exposes:

    • hyprpolkitagent's sdbus::Error [EBADF] Failed to notify event descriptor is sdbus tearing its connection down after the loop fd is gone, that's agent-side destructor order (we had a related one in hyprpolkitagent#75). not the toolkit.
    • hyprpaper's SIGSEGV is either hyprpaper's own teardown or a UAF in cleanup() (Backend.cpp:663). the order looks fine from reading, but a UAF there won't show without a frame.

    i tried to isolate the toolkit side under cage, but it aborts at startup first on this box (the gbm/drmFD thing from #129, plus cage ships an old xdg_wm_base), so no clean teardown repro yet. once #154 lands i can retry under cage. if you can grab a dump for the hyprpaper one with Restart=no + hyprctl dispatch exit so it lands before poweroff, then coredumpctl info, i'll chase the exact frame.

  2. UncleJ4ck commented on Nov 11, 2026

    @UncleJ4ck
    Contributor

    got a clean repro under a nested hyprland and it is the toolkit after all, so my earlier read was wrong. apps keep their windows and outputs alive past enterLoop(), but cleanup() has already disconnected the display by then, so destroying them marshals on a dead connection. hyprpaper dies in ~CCWlOutput, same as your trace.

    fix in #160. hyprpaper went from segfaulting 3/3 to exiting 0 3/3 on compositor kill. haven't rechecked the hyprpolkitagent sdbus abort against it yet.

  3. UncleJ4ck commented on Nov 11, 2026

    @UncleJ4ck
    Contributor

    rechecked the hyprpolkitagent half, that one is agent-side. 0.2.0 dies in ~CPolkitListener making a D-Bus call during static teardown at exit, the same with and without #160. hyprwm/hyprpolkitagent#75 dropped that call, and from that commit on the agent exits 0 on compositor kill against both. #75 landed after 0.2.0 though, so it needs an agent release.

    on my private test bus it segfaults in that destructor rather than throwing your EBADF, so i couldn't reproduce the exact signal, but it's the same call.

  4. added a commit that references this issue on Nov 18, 2026
    bf6c2e7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions