Blowing assertion when unplugging monitor
Setup
- Alpine Linux edge
- sway 1.8.1
- wlroots 0.16.2
Exact version output
$ sway --version
sway version 1.8.1
$ apk info sway
sway-1.8.1-r1 description:
i3-compatible window manager for Wayland
sway-1.8.1-r1 webpage:
https://swaywm.org/
sway-1.8.1-r1 installed size:
792 KiB
$ apk info wlroots
wlroots-0.16.2-r2 description:
Modular Wayland compositor library
wlroots-0.16.2-r2 webpage:
https://gitlab.freedesktop.org/wlroots/wlroots
wlroots-0.16.2-r2 installed size:
900 KiB
Steps to reproduce
- Connect an external monitor
- Capture the output of the external monitor, e.g. using
wl-mirror HDMI-A-1
- Unplug the external monitor
Expected Result
The disconnection is gracefully handled, applications capturing the contents of the no longer existing output (here wl-mirror
) have a chance to gracefully handle that.
Actual Result
#0 __restore_sigs (set=set@entry=0x7ffce5014540) at ./arch/x86_64/syscall_arch.h:40
#1 0x00007fcea557bea5 in raise (sig=sig@entry=6) at src/signal/raise.c:11
#2 0x00007fcea554efa8 in abort () at src/exit/abort.c:11
#3 0x00007fcea554f057 in __assert_fail (expr=expr@entry=0x7fcea5048fb6 "output->attach_render_locks > 0", file=<optimized out>, line=line@entry=279, func=func@entry=0x7fcea504a050 <__func__.2.lto_priv.21> "wlr_output_lock_attach_render")
at src/exit/assert.c:7
#4 0x00007fcea500059f in wlr_output_lock_attach_render (output=<optimized out>, lock=<optimized out>) at ../types/output/render.c:279
#5 wlr_output_lock_attach_render (output=<optimized out>, lock=<optimized out>) at ../types/output/render.c:275
#6 0x00007fcea500ea25 in frame_destroy (frame=0x7fce97aa9360) at ../types/wlr_export_dmabuf_v1.c:37
#7 0x00007fcea5087e60 in ?? () from /usr/lib/libwayland-server.so.0
#8 0x00007fcea5084ac0 in ?? () from /usr/lib/libwayland-server.so.0
#9 0x00007fcea5088329 in wl_client_destroy () from /usr/lib/libwayland-server.so.0
#10 0x00007fcea5088648 in ?? () from /usr/lib/libwayland-server.so.0
#11 0x00007fcea5088031 in wl_event_loop_dispatch () from /usr/lib/libwayland-server.so.0
#12 0x00007fcea5088457 in wl_display_run () from /usr/lib/libwayland-server.so.0
#13 0x000055faa237b149 in server_run (server=<optimized out>) at ../sway/server.c:313
#14 0x000055faa2371058 in main (argc=<optimized out>, argv=0x7ffce5014b58) at ../sway/main.c:415
The location in the code where the assert()
blows is:
void wlr_output_lock_attach_render(struct wlr_output *output, bool lock) {
if (lock) {
++output->attach_render_locks;
} else {
assert(output->attach_render_locks > 0); // <--- HERE
--output->attach_render_locks;
}
wlr_log(WLR_DEBUG, "%s direct scan-out on output '%s' (locks: %d)",
lock ? "Disabling" : "Enabling", output->name,
output->attach_render_locks);
}
Note: This triggers not 100% reliable, but 2 out of 3 instances. If you connect your machine to a projector with a flaky HDMI cable and are using wl-mirror
to see what you are presenting, it feels like sitting on dynamite ;)