Skip to content

xdph crashes (SEGV) and causes a restart loop on normal Hyprland exit #330

@lingyaochu

Description

@lingyaochu

problem description

When Hyprland is exited normally (e.g., via the SUPER+M keybinding or the hyprctl dispatch exit command), the xdg-desktop-portal-hyprland (xdph) service crashes with a Segmentation Fault (SEGV).

Due to its systemd service file being configured with Restart=on-failure, systemd attempts to restart the service. However, since the Wayland compositor (Hyprland) is no longer running at this point, the restarted xdph instances fail to connect to the Wayland compositor (logging "couldn't connect to a wayland compositor") and consequently fail again (or crash).

This results in a restart loop until systemd gives up due to "Start request repeated too quickly," leaving the xdg-desktop-portal-hyprland service in a failed state. This also impacts subsequent Hyprland sessions as the portal service becomes unavailable.

The core issue appears to be xdg-desktop-portal-hyprland not gracefully handling the shutdown of its dependent Wayland compositor, leading to the initial crash.

step to reproduce

  • Reboot the system and start Hyprland from a TTY (using Hyprland command).
  • Ensure the xdg-desktop-portal-hyprland service is active (e.g., by checking systemctl --user status xdg-desktop-portal-hyprland.service).
  • Exit Hyprland normally (e.g., using the default SUPER+M keybinding or by executing hyprctl dispatch exit).
  • Observe the systemd user journal (journalctl --user -xe | grep hyprland).

expected behavior

  • xdg-desktop-portal-hyprland crashes with an SEGV immediately after or during Hyprland's exit process.
  • Systemd attempts to restart the xdph service.
  • The restarted xdph instances log errors like "couldn't connect to a wayland compositor" and then fail.
  • This loop continues until systemd logs "Start request repeated too quickly" and stops trying to restart the service, leaving it in a failed state.

enviroment

  • OS: Arch Linux
  • Hyprland Version: 0.49.0
  • xdg-desktop-portal-hyprland Version: 1.3.9-9
  • GPU & Driver: NVIDIA GeForce RTX 2060, nvidia-open driver with version 570.144-5
  • Launch Method: From TTY using Hyprland command

relevant logs (after exiting Hyprland normally, produced by journalctl --user)

May 17 23:18:29 personal xdg-desktop-por[867]: Error reading events from display: Broken pipe
May 17 23:18:29 personal systemd[760]: xdg-desktop-portal-gtk.service: Main process exited, code=exited, status=1/FAILURE
May 17 23:18:29 personal systemd[760]: xdg-desktop-portal-gtk.service: Failed with result 'exit-code'.
May 17 23:18:30 personal systemd-coredump[999]: [🡕] Process 888 (xdg-desktop-por) of user 1000 dumped core.

                                                Stack trace of thread 888:
                                                #0  0x0000796f40ffc8ac n/a (libwayland-client.so.0 + 0x58ac)
                                                #1  0x0000796f40ffca21 n/a (libwayland-client.so.0 + 0x5a21)
                                                #2  0x0000796f40ffe7d7 wl_proxy_marshal_array_flags (libwayland-client.so.0 + 0x77d7)
                                                #3  0x0000796f40fff3cb wl_proxy_marshal_flags (libwayland-client.so.0 + 0x83cb)
                                                #4  0x000057f10152db78 n/a (/usr/lib/xdg-desktop-portal-hyprland + 0x25b78)
                                                #5  0x000057f10153a841 n/a (/usr/lib/xdg-desktop-portal-hyprland + 0x32841)
                                                #6  0x000057f10153acbd n/a (/usr/lib/xdg-desktop-portal-hyprland + 0x32cbd)
                                                #7  0x0000796f4092b5e1 n/a (libc.so.6 + 0x405e1)
                                                #8  0x0000796f4092b6be exit (libc.so.6 + 0x406be)
                                                #9  0x0000796f409126bc n/a (libc.so.6 + 0x276bc)
                                                #10 0x0000796f40912769 __libc_start_main (libc.so.6 + 0x27769)
                                                #11 0x000057f10151fb05 n/a (/usr/lib/xdg-desktop-portal-hyprland + 0x17b05)
                                                ELF object binary architecture: AMD x86-64
May 17 23:18:30 personal systemd[760]: xdg-desktop-portal-hyprland.service: Main process exited, code=dumped, status=11/SEGV
May 17 23:18:30 personal systemd[760]: xdg-desktop-portal-hyprland.service: Failed with result 'core-dump'.
May 17 23:18:30 personal systemd[760]: xdg-desktop-portal-hyprland.service: Scheduled restart job, restart counter is at 1.
May 17 23:18:30 personal systemd[760]: Starting Portal service (Hyprland implementation)...
May 17 23:18:30 personal xdg-desktop-portal-hyprland[1019]: [LOG] Initializing xdph...
May 17 23:18:30 personal xdg-desktop-portal-hyprland[1019]: [CRITICAL] Couldn't connect to a wayland compositor
May 17 23:18:30 personal systemd[760]: Started Portal service (Hyprland implementation).
May 17 23:18:30 personal systemd[760]: xdg-desktop-portal-hyprland.service: Main process exited, code=exited, status=1/FAILURE
May 17 23:18:30 personal systemd[760]: xdg-desktop-portal-hyprland.service: Failed with result 'exit-code'.
May 17 23:18:30 personal systemd[760]: xdg-desktop-portal-hyprland.service: Scheduled restart job, restart counter is at 2.
May 17 23:18:30 personal systemd[760]: Starting Portal service (Hyprland implementation)...
May 17 23:18:30 personal xdg-desktop-portal-hyprland[1021]: [LOG] Initializing xdph...
May 17 23:18:30 personal xdg-desktop-portal-hyprland[1021]: [CRITICAL] Couldn't connect to a wayland compositor
May 17 23:18:30 personal systemd[760]: Started Portal service (Hyprland implementation).
May 17 23:18:30 personal systemd[760]: xdg-desktop-portal-hyprland.service: Main process exited, code=exited, status=1/FAILURE
May 17 23:18:30 personal systemd[760]: xdg-desktop-portal-hyprland.service: Failed with result 'exit-code'.
May 17 23:18:30 personal systemd[760]: xdg-desktop-portal-hyprland.service: Scheduled restart job, restart counter is at 3.
May 17 23:18:30 personal systemd[760]: Starting Portal service (Hyprland implementation)...
May 17 23:18:30 personal xdg-desktop-portal-hyprland[1023]: [LOG] Initializing xdph...
May 17 23:18:30 personal xdg-desktop-portal-hyprland[1023]: [CRITICAL] Couldn't connect to a wayland compositor
May 17 23:18:30 personal systemd[760]: Started Portal service (Hyprland implementation).
May 17 23:18:30 personal systemd[760]: xdg-desktop-portal-hyprland.service: Main process exited, code=exited, status=1/FAILURE
May 17 23:18:30 personal systemd[760]: xdg-desktop-portal-hyprland.service: Failed with result 'exit-code'.
May 17 23:18:31 personal systemd[760]: xdg-desktop-portal-hyprland.service: Scheduled restart job, restart counter is at 4.
May 17 23:18:31 personal systemd[760]: Starting Portal service (Hyprland implementation)...
May 17 23:18:31 personal xdg-desktop-portal-hyprland[1025]: [LOG] Initializing xdph...
May 17 23:18:31 personal xdg-desktop-portal-hyprland[1025]: [CRITICAL] Couldn't connect to a wayland compositor
May 17 23:18:31 personal systemd[760]: Started Portal service (Hyprland implementation).
May 17 23:18:31 personal systemd[760]: xdg-desktop-portal-hyprland.service: Main process exited, code=exited, status=1/FAILURE
May 17 23:18:31 personal systemd[760]: xdg-desktop-portal-hyprland.service: Failed with result 'exit-code'.
May 17 23:18:31 personal systemd[760]: xdg-desktop-portal-hyprland.service: Scheduled restart job, restart counter is at 5.
May 17 23:18:31 personal systemd[760]: Starting Portal service (Hyprland implementation)...
May 17 23:18:31 personal xdg-desktop-portal-hyprland[1028]: [LOG] Initializing xdph...
May 17 23:18:31 personal xdg-desktop-portal-hyprland[1028]: [CRITICAL] Couldn't connect to a wayland compositor
May 17 23:18:31 personal systemd[760]: Started Portal service (Hyprland implementation).
May 17 23:18:31 personal systemd[760]: xdg-desktop-portal-hyprland.service: Main process exited, code=exited, status=1/FAILURE
May 17 23:18:31 personal systemd[760]: xdg-desktop-portal-hyprland.service: Failed with result 'exit-code'.
May 17 23:18:31 personal systemd[760]: xdg-desktop-portal-hyprland.service: Scheduled restart job, restart counter is at 6.
May 17 23:18:31 personal systemd[760]: xdg-desktop-portal-hyprland.service: Start request repeated too quickly.
May 17 23:18:31 personal systemd[760]: xdg-desktop-portal-hyprland.service: Failed with result 'exit-code'.
May 17 23:18:31 personal systemd[760]: Failed to start Portal service (Hyprland implementation).

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