Hyprland icon indicating copy to clipboard operation
Hyprland copied to clipboard

Crashes in multi-monitor setup when a monitor disconnects

Open proycon opened this issue 2 years ago • 4 comments

This past month I noticed a significant regression in stability in my dual monitor setup. I haveswayidle setup to start swaylock and to eventually dpms off the monitors after I leave my place:

swayidle timeout 300 '/home/proycon/dotfiles/lock.sh' \
                 timeout 900 'hyprctl dispatch dpms off'  \
                 resume 'hyprctl dispatch dpms on'

When I return I often find Hyprland crashed. Sometimes I still see swaylock for a sec after 'wake'/dpms on but then it crashes, (note: the machine doesn't do any actual suspension), and sometimes already find myself thrown back into the console when I return.

I regularly update Hyprland from the latest git version, this occurred on hyprland-git r2336.428063f-1 (428063ff2304962387803fd59e5da8b9b82710cc). I'll see one possibly relevant new commit since then so I'll upgrade and try if that works.

Some relevant hyprland.log excerpts. First during startup:

[LOG] Instance Signature: 428063ff2304962387803fd59e5da8b9b82710cc_1674128852
[LOG] Hyprland PID: 3650617
[LOG] ===== SYSTEM INFO: =====
[LOG] System name: Linux
[LOG] Node name: mhysa
[LOG] Release: 6.1.5-arch2-1
[LOG] Version: #1 SMP PREEMPT_DYNAMIC Thu, 12 Jan 2023 22:42:33 +0000


[LOG] GPU information:
03:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 23 [Radeon RX 6600/6600 XT/6600M] [1002:73ff] (rev c1) (prog-if 00 [VGA controller])


[LOG] os-release:
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://bugs.archlinux.org/"
PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/"
LOGO=archlinux-logo

[LOG] ========================
....
[LOG] Using: OpenGL ES 3.2 Mesa 22.3.3
[LOG] Vendor: AMD
[LOG] Renderer: AMD Radeon RX 6600 XT (navi23, LLVM 14.0.6, DRM 3.49, 6.1.5-arch2-1)
...
[LOG] Adding completely new monitor.
[LOG] Registered signal for owner 260c7d70: 260c86b0 -> 260c7ec0 (owner: )
[LOG] Registered signal for owner 260c7d70: 260c8740 -> 260c7f28 (owner: )
[LOG] Registered signal for owner 260c7d70: 260c8730 -> 260c7f90 (owner: )
[LOG] Applying monitor rule for DP-3
[LOG] Setting preferred mode for DP-3
[LOG] Monitor DP-3 -> destroyed all render data
[LOG] Monitor DP-3 layers arranged: reserved: 0.000000 0.000000 0.000000 0.000000
[LOG] Monitor DP-3 data dump: res [email protected], scale 1.00, transform 0, pos 2160x1680, 10b 0
[LOG] Added new monitor with name DP-3 at 2160,1680 with size 3840x2160, pointer 260c8570
[LOG] New monitor: WORKSPACEID 1, exists: 0
[LOG] Monitor DP-3 layers arranged: reserved: 0.000000 0.000000 0.000000 0.000000
[LOG] Adding completely new monitor.
[LOG] Registered signal for owner 26122390: 260c89e0 -> 261224e0 (owner: )
[LOG] Registered signal for owner 26122390: 260c8a70 -> 26122548 (owner: )
[LOG] Registered signal for owner 26122390: 260c8a60 -> 261225b0 (owner: )
[LOG] Applying monitor rule for DP-4
[LOG] Setting preferred mode for DP-4
[LOG] Monitor DP-4 -> destroyed all render data
[LOG] Monitor DP-4 layers arranged: reserved: 0.000000 0.000000 0.000000 0.000000
[LOG] Monitor DP-4 data dump: res [email protected], scale 1.00, transform 1, pos 0x0, 10b 0
[LOG] Added new monitor with name DP-4 at 0,0 with size 3840x2160, pointer 260c88a0
[LOG] New monitor: WORKSPACEID 10, exists: 0
[LOG] Monitor DP-4 layers arranged: reserved: 0.000000 0.000000 0.000000 0.000000
[LOG] Hyprland is ready, running the event loop!

Then the last bits before crash:

[LOG] Hyprctl: dispatcher dpms : on
[LOG] Destroy called for monitor DP-3
[LOG] onDisconnect called for DP-3
[LOG] Callback 260c7ee8 -> 260c7ee0,  removed.
[LOG] LayerSurface 263a7cd0 unmapped
[LOG] Framebuffer created, status 36053
[LOG] LayerSurface 263a7cd0 destroyed
[LOG] Callback 262f5778 -> 262f5770, layerSurface removed.
[LOG] Callback 262f5640 -> 262f5638, layerSurface removed.
[LOG] Callback 262f56a8 -> 262f56a0, layerSurface removed.
[LOG] Callback 262f5710 -> 262f5708, layerSurface removed.
[LOG] Callback 262f57e0 -> 262f57d8, layerSurface removed.
[LOG] LayerSurface 2643b230 arranged: x: 2160 y: 3810 w: 3840 h: 30 with margins: t: 0 l: 0 r: 0 b: 0
[LOG] LayerSurface 264767e0 arranged: x: 2160 y: 1680 w: 3840 h: 2160 with margins: t: 0 l: 0 r: 0 b: 0
[LOG] Monitor DP-3 layers arranged: reserved: 0.000000 0.000000 0.000000 30.000000
[LOG] LayerSurface 263994d0 unmapped
[LOG] Framebuffer created, status 36053
[LOG] LayerSurface 263994d0 destroyed
[LOG] Callback 2639a2c8 -> 2639a2c0, layerSurface removed.
[LOG] Callback 2639a190 -> 2639a188, layerSurface removed.
[LOG] Callback 2639a1f8 -> 2639a1f0, layerSurface removed.
[LOG] Callback 2639a260 -> 2639a258, layerSurface removed.
[LOG] Callback 2639a330 -> 2639a328, layerSurface removed.
[LOG] LayerSurface 264767e0 arranged: x: 2160 y: 1680 w: 3840 h: 2160 with margins: t: 0 l: 0 r: 0 b: 0
[LOG] Monitor DP-3 layers arranged: reserved: 0.000000 0.000000 0.000000 0.000000
<EOF>

And here the gdb trace from the resulting coredump:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f4402a69594 in wlr_layer_surface_v1_destroy () from /usr/lib/libwlroots.so.12032
[Current thread is 1 (Thread 0x7f4401645980 (LWP 3650617))]
(gdb) bt
#0  0x00007f4402a69594 in wlr_layer_surface_v1_destroy () at /usr/lib/libwlroots.so.12032
#1  0x000055aa23d0501f in CMonitor::onDisconnect() ()
#2  0x000055aa23ceb811 in Events::listener_monitorDestroy(void*, void*) ()
#3  0x000055aa23d07b5c in handleWrapped(wl_listener*, void*) ()
#4  0x00007f44028e6f6e in wl_signal_emit_mutable (signal=<optimized out>, data=0x55aa260c8570) at ../wayland-1.21.0/src/wayland-server.c:2179
#5  0x00007f4402a45082 in wlr_output_destroy () at /usr/lib/libwlroots.so.12032
#6  0x00007f4402a2fdf4 in scan_drm_connectors () at /usr/lib/libwlroots.so.12032
#7  0x00007f44028e6f6e in wl_signal_emit_mutable (signal=<optimized out>, data=0x7ffd99b8a0d0) at ../wayland-1.21.0/src/wayland-server.c:2179
#8  0x00007f4402a29db0 in handle_udev_event () at /usr/lib/libwlroots.so.12032
#9  0x00007f44028e89e2 in wl_event_loop_dispatch (loop=0x55aa25156680, timeout=timeout@entry=-1) at ../wayland-1.21.0/src/event-loop.c:1027
#10 0x00007f44028e9197 in wl_display_run (display=0x55aa25156590) at ../wayland-1.21.0/src/wayland-server.c:1431
#11 0x000055aa23c78ea9 in main ()

proycon avatar Jan 20 '23 16:01 proycon

It may be a bit premature, but it seems the bug may be gone since d8ee624e35f424334fdc439b8ad269455b178004 , I'll keep an eye on it...

proycon avatar Jan 22 '23 11:01 proycon

Status update: bug is not gone yet unfortunately. It just happened again. swaylock showed for a sec after dpms on and then everything crashed. Fresh log excerpt looks the same as before:

[LOG] Keybind handling only locked (inhibitor)
[LOG] Keybind handling only locked (inhibitor)
[LOG] LayerSurface f3eae80 unmapped
[LOG] Framebuffer created, status 36053
[LOG] LayerSurface f3eae80 destroyed
[LOG] Callback f2c4948 -> f2c4940, layerSurface removed.
[LOG] Callback f2c4810 -> f2c4808, layerSurface removed.
[LOG] Callback f2c4878 -> f2c4870, layerSurface removed.
[LOG] Callback f2c48e0 -> f2c48d8, layerSurface removed.
[LOG] Callback f2c49b0 -> f2c49a8, layerSurface removed.
[LOG] LayerSurface f316890 arranged: x: 2160 y: 3810 w: 3840 h: 30 with margins: t: 0 l: 0 r: 0 b: 0
[LOG] LayerSurface f3b7fb0 arranged: x: 2160 y: 1680 w: 3840 h: 2160 with margins: t: 0 l: 0 r: 0 b: 0
[LOG] LayerSurface f1a0fa0 arranged: x: 2160 y: 1680 w: 3840 h: 2160 with margins: t: 0 l: 0 r: 0 b: 0
[LOG] Monitor DP-3 layers arranged: reserved: 0.000000 0.000000 0.000000 30.000000
[LOG] Destroy called for monitor DP-3
[LOG] onDisconnect called for DP-3
[LOG] Callback f195aa8 -> f195aa0,  removed.
[LOG] LayerSurface f17f020 unmapped
[LOG] LayerSurface f17f020 destroyed
[LOG] Callback efa5378 -> efa5370, layerSurface removed.
[LOG] Callback efa5240 -> efa5238, layerSurface removed.
[LOG] Callback efa52a8 -> efa52a0, layerSurface removed.
[LOG] Callback efa5310 -> efa5308, layerSurface removed.
[LOG] Callback efa53e0 -> efa53d8, layerSurface removed.
[LOG] LayerSurface f316890 arranged: x: 2160 y: 3810 w: 3840 h: 30 with margins: t: 0 l: 0 r: 0 b: 0
[LOG] LayerSurface f1a0fa0 arranged: x: 2160 y: 1680 w: 3840 h: 2160 with margins: t: 0 l: 0 r: 0 b: 0
[LOG] Monitor DP-3 layers arranged: reserved: 0.000000 0.000000 0.000000 30.000000
[LOG] LayerSurface f1e7c70 unmapped
[LOG] Framebuffer created, status 36053
[LOG] LayerSurface f1e7c70 destroyed
[LOG] Callback eb7c868 -> eb7c860, layerSurface removed.
[LOG] Callback eb7c730 -> eb7c728, layerSurface removed.
[LOG] Callback eb7c798 -> eb7c790, layerSurface removed.
[LOG] Callback eb7c800 -> eb7c7f8, layerSurface removed.
[LOG] Callback eb7c8d0 -> eb7c8c8, layerSurface removed.
[LOG] LayerSurface f1a0fa0 arranged: x: 2160 y: 1680 w: 3840 h: 2160 with margins: t: 0 l: 0 r: 0 b: 0
[LOG] Monitor DP-3 layers arranged: reserved: 0.000000 0.000000 0.000000 0.000000
(EOF)

proycon avatar Jan 22 '23 21:01 proycon

check with cb6e36d8046aaaede76be4eff2e51e3d35ba3b30 please

vaxerski avatar Jan 23 '23 18:01 vaxerski

Thanks, will do! May take a bit before I can confirm it fixes it as it isn't easily reproduced on demand.

proycon avatar Jan 23 '23 20:01 proycon

Haven't seen the problem since the upgrade anymore so marking this as fixed!

proycon avatar Jan 25 '23 13:01 proycon

I'm reopening this issue, as although it was properly fixed before, it has popped up again now in the latest git version (c2f29be9), so there is probably a regression bug.

New log:

[LOG] Instance Signature: c2f29be9baccd14ced62105f0fc07e34e6f4fd29_1681367262
[LOG] Hyprland PID: 1635679
[LOG] ===== SYSTEM INFO: =====
[LOG] System name: Linux
[LOG] Node name: mhysa
[LOG] Release: 6.2.10-arch1-1
[LOG] Version: #1 SMP PREEMPT_DYNAMIC Fri, 07 Apr 2023 02:10:43 +0000


[LOG] GPU information:
03:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 23 [Radeon RX 6600/6600 XT/6600M] [1002:73ff] (rev c1) (prog-if 00 [VGA controller])


[LOG] os-release:
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://bugs.archlinux.org/"
PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/"
LOGO=archlinux-logo

[LOG] ========================
...
[LOG] Destroy called for monitor DP-4
[LOG] onDisconnect called for DP-4
[LOG] Callback 46120960 -> 46120958,  removed.
[LOG] Callback 46120a98 -> 46120a90,  removed.
[LOG] Callback 46120b00 -> 46120af8,  removed.
[LOG] LayerSurface 4686f9e0 unmapped
[LOG] Framebuffer created, status 36053
[LOG] Callback 468637a8 -> 468637a0, CWLSurface removed.
[LOG] CWLSurface 46863778 called destroy()
[LOG] LayerSurface 4686f9e0 destroyed
[LOG] Callback 46863960 -> 46863958, layerSurface removed.
[LOG] Callback 46863828 -> 46863820, layerSurface removed.
[LOG] Callback 46863890 -> 46863888, layerSurface removed.
[LOG] Callback 468638f8 -> 468638f0, layerSurface removed.
[LOG] Callback 468639c8 -> 468639c0, layerSurface removed.
[LOG] LayerSurface 46828890 arranged: x: 0 y: 3810 w: 2160 h: 30 with margins: t: 0 l: 0 r: 0 b: 0
[LOG] Monitor DP-4 layers arranged: reserved: 0.000000 0.000000 0.000000 30.000000
[LOG] LayerSurface 468380b0 unmapped
[LOG] Framebuffer created, status 36053
[LOG] Callback 46838298 -> 46838290, CWLSurface removed.
[LOG] CWLSurface 46838268 called destroy()
[LOG] LayerSurface 468380b0 destroyed
[LOG] Callback 46838450 -> 46838448, layerSurface removed.
[LOG] Callback 46838318 -> 46838310, layerSurface removed.
[LOG] Callback 46838380 -> 46838378, layerSurface removed.
[LOG] Callback 468383e8 -> 468383e0, layerSurface removed.
[LOG] Callback 468384b8 -> 468384b0, layerSurface removed.
[LOG] Monitor DP-4 layers arranged: reserved: 0.000000 0.000000 0.000000 0.000000
[LOG] Removed monitor DP-4!
[WARN] Unplugged last monitor, entering an unsafe state. Good luck my friend.
[LOG] Callback 46120a30 -> 46120a28,  removed.
[LOG] Callback 461209c8 -> 461209c0,  removed.
[LOG] SessionLockSurface 561f488b2f30 destroyed
[LOG] Callback 488b3038 -> 488b3030, SSessionLockSurface removed.
[LOG] Callback 488b2fd0 -> 488b2fc8, SSessionLockSurface removed.
[LOG] Callback 488b2f68 -> 488b2f60, SSessionLockSurface removed.

gdb backtrace of core dump:

(gdb) bt
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007fe82a1b8953 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
#2  0x00007fe82a169ea8 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007fe82a15353d in __GI_abort () at abort.c:79
#4  0x0000561f44245431 in  ()
#5  0x00007fe82a169f50 in <signal handler called> () at /usr/lib/libc.so.6
#6  0x0000561f442fd74c in CAnimationManager::tick() ()
#7  0x0000561f442ff0a9 in wlTick(void*) ()
#8  0x00007fe82abe5d27 in wl_timer_heap_dispatch (timers=0x561f453e1248) at ../wayland-1.22.0/src/event-loop.c:526
#9  wl_event_loop_dispatch (loop=0x561f453e1200, timeout=timeout@entry=-1) at ../wayland-1.22.0/src/event-loop.c:1020
#10 0x00007fe82abe62d7 in wl_display_run (display=0x561f453e1110) at ../wayland-1.22.0/src/wayland-server.c:1493
#11 0x0000561f44236a4b in main ()

proycon avatar Apr 13 '23 06:04 proycon

The problem does not seem to occur yet in v0.23.0beta the regression was probably introduced later.

proycon avatar Apr 15 '23 11:04 proycon

check with a6d94eafba195f69378098afdc0e4d64b42f4fab

vaxerski avatar Apr 15 '23 11:04 vaxerski

Looks like that fixed it indeed, thanks! Closing again.

proycon avatar Apr 18 '23 14:04 proycon