Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[aquamarine] Startup freeze on FreeBSD #6842

Closed
jbeich opened this issue Jul 11, 2024 · 11 comments
Closed

[aquamarine] Startup freeze on FreeBSD #6842

jbeich opened this issue Jul 11, 2024 · 11 comments
Labels
bug Something isn't working

Comments

@jbeich
Copy link
Contributor

jbeich commented Jul 11, 2024

Regression?

Yes

System Info and Version

System/Version info
$ hyprctl systeminfo -c
Hyprland, built from branch main at commit 8b37e81374928856d8fd859b95a62c8bf4211901 portbld (?).
Date: Fri  9 Aug 2024 21:58:02 UTC
Tag: v0.42.0-4-g8b37e813 (aquamarine v0.3.1), commits: ?

flags: (if any)


System Information:
System name: FreeBSD
Node name: foo.bar
Release: 15.0-CURRENT
Version: FreeBSD 15.0-CURRENT #0 main-n271236-b3bbc6cc79a3: Wed Jul 17 22:47:30 UTC 2024 [email protected]:/usr/obj/usr/src/amd64.amd64/sys/MYKERNEL


GPU information: 
vgapci1@pci0:0:2:0:	class=0x030000 rev=0x06 hdr=0x00 vendor=0x8086 device=0x1912 subvendor=0x1462 subdevice=0x7968
    vendor     = 'Intel Corporation'
    device     = 'HD Graphics 530'
    class      = display
    subclass   = VGA


os-release: NAME=FreeBSD
VERSION="15.0-CURRENT"
VERSION_ID="15.0"
ID=freebsd
ANSI_COLOR="0;31"
PRETTY_NAME="FreeBSD 15.0-CURRENT"
CPE_NAME="cpe:/o:freebsd:freebsd:15.0"
HOME_URL="https://FreeBSD.org/"
BUG_REPORT_URL="https://bugs.FreeBSD.org/"


plugins:

======Config-Start======


Config File: /tmp/hyprland.conf: Read Succeeded
debug {
      enable_stdout_logs = true
      disable_logs = false
}

exec-once = foot
exec-once = vkcube-xcb

======Config-End========

Description

Split from #6608. FreeBSD regressions cannot block merges.

Launching Hyprland manages to show default wallpaper but no windows appear. Neither mouse nor keyboard (including VT switch) work. Exiting Hyprland requires killing by timeout(1) or from another machine (e.g., serial console, ssh).

Affects DRM (Hyprland on VT console) but not Wayland (aquamarine-Hyprland on wlroots-Hyprland 0.41.2) session. AQ_NO_ATOMIC=1 doesn't help. Starting from a different VT doesn't help. Starting without Sway in background doesn't help.

How to reproduce

Start Hyprland from VT console such as /dev/ttyv0.

Crash reports, logs, images, videos

Runtime log and stacktrace

@jbeich jbeich added the bug Something isn't working label Jul 11, 2024
freebsd-git pushed a commit to freebsd/freebsd-ports that referenced this issue Aug 7, 2024
@vaxerski
Copy link
Member

vaxerski commented Aug 9, 2024

well it looks like a hang in udev_monitor_receive_device if I am reading it correctly but I have little clue as to what could be causing this.

libudev is likely compiled in release and thus some of the stack is missing but it looke like somewhere here
image

@jbeich
Copy link
Contributor Author

jbeich commented Aug 9, 2024

  • FreeBSD uses libudev-devd instead of systemd
  • libudev-devd was built with debug symbols, so the stacktrace in the log shows line numbers
  • udev_monitor_receive_device usage in aquamarine is similar to wlroots (where it works fine)
  • Hyprland shows wallpaper, so monitor stuff is likely a false positive

Could this be related to DMABUF instead? For example, FreeBSD currently lacks explicit sync.

@vaxerski
Copy link
Member

vaxerski commented Aug 9, 2024

yeah but your stacktrace shows it being stuck in udev_monitor_receive_device in a read syscall. Unless the stacktrace is wrong?

I'd assume it's stuck somewhere because the log is clearly empty in your case right after the event loop starts, unless you truncated the log.

Could this be related to DMABUF instead? For example, FreeBSD currently freebsd/drm-kmod#278.

Explicit sync is disabled with render:explicit_sync = no which should not require any further action.

can you post a trace log? AQ_TRACE=1 HYPRLAND_TRACE=1 Hyprland and make sure debug:disable_logs = false before you launch

@vaxerski
Copy link
Member

vaxerski commented Aug 9, 2024

My guess is that there is nothing pollable and we dispatch outstanding once, which in sysd doesn't block but in BSD might. Try this hl patch:
patch.txt

unsure if this is correct, but it might work.

@jbeich
Copy link
Contributor Author

jbeich commented Aug 9, 2024

I've updated OP with the new log. After applying your patch Hyprland no longer hangs.

@vaxerski
Copy link
Member

vaxerski commented Aug 9, 2024

I assume the log is from patched, as it seems to run normally

@vaxerski
Copy link
Member

vaxerski commented Aug 9, 2024

I'll apply the patch, if anything happens after it and people report issues I'll just revert it. Doesn't hurt to try

vaxerski added a commit that referenced this issue Aug 9, 2024
ref #6842, BSD blocks in udev on no event apparently
@vaxerski
Copy link
Member

vaxerski commented Aug 9, 2024

FWIW, according to https://www.man7.org/linux/man-pages/man3/udev_monitor_enable_receiving.3.html udev_monitor_receive_device should return null if anything goes wrong (which I assume includes no event) so unless that manpage is sysd only that sounds like a bug in udev?

@jbeich
Copy link
Contributor Author

jbeich commented Aug 9, 2024

unless that manpage is sysd only that sounds like a bug in udev?

Need a smaller test case to reproduce without Hyprland. Other Wayland compositors (wlroots, smithay, kwin) didn't bump into this issue. Even Xorg uses udev_monitor_receive_device on FreeBSD: modesetting DDX and xf86-video-intel.

I'm not familar with libudev API myself.

nanorkyo pushed a commit to nanorkyo/freebsd-ports that referenced this issue Aug 10, 2024
@vaxerski
Copy link
Member

at any rate, if the freeze is gone now on -git I'd consider this fixed

@jbeich
Copy link
Contributor Author

jbeich commented Aug 10, 2024

Agree. I've applied it downstream.

@jbeich jbeich closed this as completed Aug 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants