sway
sway copied to clipboard
swaylock crashing Sway in wlr_xdg_toplevel_set_size
Relevant part of the log
#6 0x00007b9ae69932d4 in wlr_xdg_toplevel_set_size (toplevel=0x5b7d528d0640, width=-4, height=-29) at ../subprojects/wlroots/types/xdg_shell/wlr_xdg_toplevel.c:558
__PRETTY_FUNCTION__ = "wlr_xdg_toplevel_set_size"
#7 0x00005b7d51271e5c in configure (view=0x5b7d526da1b0, lx=10882, ly=27, width=-4, height=-29) at ../sway/desktop/xdg_shell.c:164
xdg_shell_view = 0x5b7d526da1b0
#8 0x00005b7d512b37cc in view_configure (view=0x5b7d526da1b0, lx=10882, ly=27, width=-4, height=-29) at ../sway/tree/view.c:185
#9 0x00005b7d51271250 in transaction_commit (transaction=0x5b7d52f3f080) at ../sway/desktop/transaction.c:803
instruction = 0x5b7d53098f40
node = 0x5b7d5253d560
hidden = false
i = 21
#10 0x00005b7d51271451 in transaction_commit_pending () at ../sway/desktop/transaction.c:855
transaction = 0x5b7d52f3f080
#11 0x00005b7d512717ee in _transaction_commit_dirty (server_request=true) at ../sway/desktop/transaction.c:932
#12 0x00005b7d51271804 in transaction_commit_dirty () at ../sway/desktop/transaction.c:936
#13 0x00005b7d5126e8d7 in handle_new_output (listener=0x5b7d512e8bc0 <server+96>, data=0x5b7d52be77f0) at ../sway/desktop/output.c:519
server = 0x5b7d512e8b60 <server>
wlr_output = 0x5b7d52be77f0
scene_output = 0x5b7d52d1c270
output = 0x5b7d5302b500
oc = 0x5b7d52781580
That negative size is odd. @vyivel didnt something about negative sizes got merged in wlroots recently?
Yeah, wlroots now asserts that the size is non-negative. This is a Sway bug.
A new output might be spawning initially with a 0x0 mode. When sway tries to arrange a surface it will subtract the title bar and also borders and generate negative numbers.
I don't think this is a regression of scene-graph
Sway will not try to arrange layer surfaces on a disabled output though.
I'm attaching Sway asan log and dmesg log in case they have any useful info.
Same issue here.
swaymsg -t get_outputs:
swaymsg -t get_outputs
Output eDP-1 'LG Display 0x06EB Unknown'
Current mode: 2560x1600 @ 59.994 Hz
Power: on
Position: 0,500
Scale factor: 1.000000
Scale filter: nearest
Subpixel hinting: unknown
Transform: normal
Workspace: 3
Max render time: off
Adaptive sync: disabled
Available modes:
2560x1600 @ 59.994 Hz
Output HDMI-A-1 'Dell Inc. DELL U2718Q T4YR885E13ML' (focused)
Current mode: 3840x2160 @ 60.000 Hz
Power: on
Position: 2560,0
Scale factor: 1.000000
Scale filter: nearest
Subpixel hinting: unknown
Transform: normal
Workspace: 4
Max render time: off
Adaptive sync: disabled
Available modes: omitted
Version
Name : sway-im-git
Version : r7292.d19810eba895-2
Name : wlroots-git
Version : 0.18.0.r6893.842093bb8-1
Coredump syslog:
Feb 19 10:45:06 gram systemd[1]: Started Process Core Dump (PID 188627/UID 0).
Feb 19 10:45:06 gram systemd-coredump[188628]: [🡕] Process 132774 (sway) of user 1000 dumped core.
Stack trace of thread 132774:
#0 0x000072ee7a05e32c n/a (libc.so.6 + 0x8d32c)
#1 0x000072ee7a00d6c8 raise (libc.so.6 + 0x3c6c8)
#2 0x000072ee79ff54b8 abort (libc.so.6 + 0x244b8)
#3 0x000072ee79ff53dc n/a (libc.so.6 + 0x243dc)
#4 0x000072ee7a005d46 __assert_fail (libc.so.6 + 0x34d46)
#5 0x000072ee7a2be225 wlr_xdg_toplevel_set_size (libwlroots.so.13 + 0x7e225)
#6 0x0000556d4923c08d n/a (sway + 0x2608d)
#7 0x0000556d4923dda8 n/a (sway + 0x27da8)
#8 0x0000556d4923bc6a n/a (sway + 0x25c6a)
#9 0x000072ee7a36a01e wl_signal_emit_mutable (libwayland-server.so.0 + 0xa01e)
#10 0x000072ee7a36a01e wl_signal_emit_mutable (libwayland-server.so.0 + 0xa01e)
#11 0x000072ee7a293425 n/a (libwlroots.so.13 + 0x53425)
#12 0x000072ee7a36a01e wl_signal_emit_mutable (libwayland-server.so.0 + 0xa01e)
#13 0x000072ee7a28cd29 n/a (libwlroots.so.13 + 0x4cd29)
#14 0x000072ee7a36bae2 wl_event_loop_dispatch (libwayland-server.so.0 + 0xbae2)
#15 0x000072ee7a36c2d7 wl_display_run (libwayland-server.so.0 + 0xc2d7)
#16 0x0000556d4922b695 n/a (sway + 0x15695)
#17 0x000072ee79ff6cd0 n/a (libc.so.6 + 0x25cd0)
#18 0x000072ee79ff6d8a __libc_start_main (libc.so.6 + 0x25d8a)
#19 0x0000556d4922b895 n/a (sway + 0x15895)
Stack trace of thread 132783:
#0 0x000072ee7a058ebe n/a (libc.so.6 + 0x87ebe)
#1 0x000072ee7a05b750 pthread_cond_wait (libc.so.6 + 0x8a750)
#2 0x000072ee76e8686c n/a (iris_dri.so + 0x8686c)
#3 0x000072ee76e9e83c n/a (iris_dri.so + 0x9e83c)
#4 0x000072ee7a05c55a n/a (libc.so.6 + 0x8b55a)
#5 0x000072ee7a0d9a3c n/a (libc.so.6 + 0x108a3c)
Stack trace of thread 132784:
#0 0x000072ee7a058ebe n/a (libc.so.6 + 0x87ebe)
#1 0x000072ee7a05b750 pthread_cond_wait (libc.so.6 + 0x8a750)
#2 0x000072ee76e8686c n/a (iris_dri.so + 0x8686c)
#3 0x000072ee76e9e83c n/a (iris_dri.so + 0x9e83c)
#4 0x000072ee7a05c55a n/a (libc.so.6 + 0x8b55a)
#5 0x000072ee7a0d9a3c n/a (libc.so.6 + 0x108a3c)
Stack trace of thread 132787:
#0 0x000072ee7a058ebe n/a (libc.so.6 + 0x87ebe)
#1 0x000072ee7a05b750 pthread_cond_wait (libc.so.6 + 0x8a750)
#2 0x000072ee76e8686c n/a (iris_dri.so + 0x8686c)
#3 0x000072ee76e9e83c n/a (iris_dri.so + 0x9e83c)
#4 0x000072ee7a05c55a n/a (libc.so.6 + 0x8b55a)
#5 0x000072ee7a0d9a3c n/a (libc.so.6 + 0x108a3c)
Stack trace of thread 132785:
#0 0x000072ee7a058ebe n/a (libc.so.6 + 0x87ebe)
#1 0x000072ee7a05b750 pthread_cond_wait (libc.so.6 + 0x8a750)
#2 0x000072ee76e8686c n/a (iris_dri.so + 0x8686c)
#3 0x000072ee76e9e83c n/a (iris_dri.so + 0x9e83c)
#4 0x000072ee7a05c55a n/a (libc.so.6 + 0x8b55a)
#5 0x000072ee7a0d9a3c n/a (libc.so.6 + 0x108a3c)
Stack trace of thread 132786:
#0 0x000072ee7a058ebe n/a (libc.so.6 + 0x87ebe)
#1 0x000072ee7a05b750 pthread_cond_wait (libc.so.6 + 0x8a750)
#2 0x000072ee76e8686c n/a (iris_dri.so + 0x8686c)
#3 0x000072ee76e9e83c n/a (iris_dri.so + 0x9e83c)
#4 0x000072ee7a05c55a n/a (libc.so.6 + 0x8b55a)
#5 0x000072ee7a0d9a3c n/a (libc.so.6 + 0x108a3c)
Stack trace of thread 132789:
#0 0x000072ee7a0d788d syscall (libc.so.6 + 0x10688d)
#1 0x000072ee7a577337 g_cond_wait (libglib-2.0.so.0 + 0xb3337)
#2 0x000072ee7a4e91b4 n/a (libglib-2.0.so.0 + 0x251b4)
#3 0x000072ee7a4e921c g_async_queue_pop (libglib-2.0.so.0 + 0x2521c)
#4 0x000072ee797e5d08 n/a (libpangoft2-1.0.so.0 + 0x8d08)
#5 0x000072ee7a54fa45 n/a (libglib-2.0.so.0 + 0x8ba45)
#6 0x000072ee7a05c55a n/a (libc.so.6 + 0x8b55a)
#7 0x000072ee7a0d9a3c n/a (libc.so.6 + 0x108a3c)
Stack trace of thread 132788:
#0 0x000072ee7a058ebe n/a (libc.so.6 + 0x87ebe)
#1 0x000072ee7a05b750 pthread_cond_wait (libc.so.6 + 0x8a750)
#2 0x000072ee76e8686c n/a (iris_dri.so + 0x8686c)
#3 0x000072ee76e9e83c n/a (iris_dri.so + 0x9e83c)
#4 0x000072ee7a05c55a n/a (libc.so.6 + 0x8b55a)
#5 0x000072ee7a0d9a3c n/a (libc.so.6 + 0x108a3c)
ELF object binary architecture: AMD x86-64
Feb 19 10:45:06 gram systemd[1]: [email protected]: Deactivated successfully.
Feb 19 10:45:06 gram seatd[775]: 08:25:53.527 [INFO] [seatd/client.c:471] Client disconnected
Feb 19 10:45:06 gram greetd[131392]: pam_unix(greetd:session): session closed for user cherrot
dumped core: core.zip
Same issue, are there any solutions before 1.10 to bypass this problem ? Thanks
I hit this same crash.
#0 0x000070933444532c in ?? () from /usr/lib/libc.so.6
[Current thread is 1 (Thread 0x7093336399c0 (LWP 952))]
(gdb) bt full
#0 0x000070933444532c in ??? () at /usr/lib/libc.so.6
#1 0x00007093343f46c8 in raise () at /usr/lib/libc.so.6
#2 0x00007093343dc4b8 in abort () at /usr/lib/libc.so.6
#3 0x00007093343dc3dc in ??? () at /usr/lib/libc.so.6
#4 0x00007093343ecd46 in __assert_fail () at /usr/lib/libc.so.6
#5 0x0000709334d28e9d in wlr_xdg_toplevel_set_size (toplevel=0x5f05d8173710, width=0, height=-22) at ../subprojects/wlroots/types/xdg_shell/wlr_xdg_toplevel.c:558
__PRETTY_FUNCTION__ = "wlr_xdg_toplevel_set_size"
#6 0x00005f05d567e663 in configure (view=0x5f05d8442670, lx=0, ly=22, width=0, height=-22) at ../sway/desktop/xdg_shell.c:164
xdg_shell_view = 0x5f05d8442670
#7 0x00005f05d56c0929 in view_configure (view=0x5f05d8442670, lx=0, ly=22, width=0, height=-22) at ../sway/tree/view.c:185
#8 0x00005f05d567da57 in transaction_commit (transaction=0x5f05d909be40) at ../sway/desktop/transaction.c:812
instruction = 0x5f05d9161fc0
node = 0x5f05d816aaa0
hidden = false
i = 38
#9 0x00005f05d567dc58 in transaction_commit_pending () at ../sway/desktop/transaction.c:864
transaction = 0x5f05d909be40
#10 0x00005f05d567dff5 in _transaction_commit_dirty (server_request=true) at ../sway/desktop/transaction.c:941
#11 0x00005f05d567e00b in transaction_commit_dirty () at ../sway/desktop/transaction.c:945
#12 0x00005f05d567af4d in handle_new_output (listener=0x5f05d56f5c38 <server+216>, data=0x5f05d83f76a0) at ../sway/desktop/output.c:512
server = 0x5f05d56f5b60 <server>
wlr_output = 0x5f05d83f76a0
scene_output = 0x5f05d8e3cf60
output = 0x5f05d91a4b00
oc = 0x5f05d8562780
#13 0x000070933463001e in wl_signal_emit_mutable () at /usr/lib/libwayland-server.so.0
#14 0x0000709334cfcbb0 in new_output_reemit (listener=0x5f05d76657c8, data=0x5f05d83f76a0) at ../subprojects/wlroots/backend/multi/backend.c:146
state = 0x5f05d76657a0
#15 0x000070933463001e in wl_signal_emit_mutable () at /usr/lib/libwayland-server.so.0
#16 0x0000709334cede45 in scan_drm_connectors (drm=0x5f05d766f060, event=0x7fff9feaad2c) at ../subprojects/wlroots/backend/drm/drm.c:1609
conn = 0x5f05d83f76a0
i = 0
res = 0x5f05d89419a0
seen_len = 4
seen = {true, true, true, true, false}
new_outputs_len = 1
new_outputs = {0x5f05d83f76a0, 0x7fff9feaab60, 0x7fff9feaac20, 0x7fff9feaac60, 0x7fff9feaad28}
conn = 0x5f05d766eed8
tmp_conn = 0x5f05d83e6360
index = 0
#17 0x0000709334ce8bdb in handle_dev_change (listener=0x5f05d766f118, data=0x7fff9feaad28) at ../subprojects/wlroots/backend/drm/backend.c:148
drm = 0x5f05d766f060
change = 0x7fff9feaad28
#18 0x000070933463001e in wl_signal_emit_mutable () at /usr/lib/libwayland-server.so.0
#19 0x0000709334ce6270 in handle_udev_event (fd=8, mask=1, data=0x5f05d76586a0) at ../subprojects/wlroots/backend/session/session.c:213
event = {type = WLR_DEVICE_HOTPLUG, {hotplug = {connector_id = 113, prop_id = 0}}}
devnum = 57857
dev = 0x5f05d764d4f0
session = 0x5f05d76586a0
udev_dev = 0x5f05d82790c0
sysname = 0x5f05d83adcb0 "card1"
devnode = 0x5f05d8035000 "/dev/dri/card1"
action = 0x709334aaffb5 "change"
seat = 0x709334da14ff "seat0"
__PRETTY_FUNCTION__ = "handle_udev_event"
#20 0x0000709334631ae2 in wl_event_loop_dispatch () at /usr/lib/libwayland-server.so.0
#21 0x00007093346322d7 in wl_display_run () at /usr/lib/libwayland-server.so.0
#22 0x00005f05d5676bf9 in server_run (server=0x5f05d56f5b60 <server>) at ../sway/server.c:452
#23 0x00005f05d567552e in main (argc=2, argv=0x7fff9feab0f8) at ../sway/main.c:374
verbose = false
debug = false
validate = false
config_path = 0x0
c = -1
This happened when I came back to my computer after it has been locked (swaylock and screens powered off) and I turned on the chrome cast that's connected to the HDMI port on one of my monitors. Looks like my computer connected through DP noticed and crashed sway.
Inspecting the program state, wlroots seems to think the monitor is has a width and height of 0. Is this a wlroots problem and we just shouldn't advertise a monitor that is 0x0 or should we add some if statements to sway and call it a day?
Weird, 0x0 would typically indicate that the output is disabled. It seems wrong to expose disabled outputs.
That width=-4 looks suspicious. @J0nnyMak0 do you by any chance use border pixel 2 in your config?
If so, then this might be caused by similar circumstances as #7977, with cmd_border() or something similar calling arrange_container() directly on something that wasn't intended to be arranged at this point.
The stack trace above is not very helpful in this case, since the actual crash happens rather far away from the location where the negative size is set. My best guess is that this is view_autoconfigure() again.
This might become much easier to root cause with this assert in view_autoconfigure():
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 1c1c8ee8..756d000c 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -367,6 +367,7 @@ void view_autoconfigure(struct sway_view *view) {
con->pending.content_y = y;
con->pending.content_width = width;
con->pending.content_height = height;
+ sway_assert(width >= 0 && height >= 0, "configuring a view with negative size");
}
void view_set_activated(struct sway_view *view, bool activated) {
@J0nnyMak0 can you try reproducing the crash with this patch?
EDIT: I just noticed this likely doesn't work in this case, especially if your crash has to do with layer shell surfaces, which IIUC use another configure function and not view_autoconfigure. A similar assert would have to be added to those functions, but I'm not completely sure.
EDIT2: looking at the stack trace and the conversation again, this looks like an xdg_shell surface triggering the final crash, not a layer shell surface. I also can't reproduce this crash on my end.
@Ferdi265 Thanks for the patch. I'll give it a shot.
I can reproduce this at will when building from sway and wlroots HEAD using command:
swaymsg "output * power off" ; sleep 10 ; swaymsg "output * power on"
stderr:
00:00:05.388 [ERROR] [wlr] [types/xdg_shell/wlr_xdg_surface.c:169] A configure is scheduled for an uninitialized xdg_surface 0x646cdd9c0520
sway: types/xdg_shell/wlr_xdg_toplevel.c:550: wlr_xdg_toplevel_set_size: Assertion `width >= 0 && height >= 0' failed.
Io error: wl_display_dispatch: Broken pipe
Broken pipe (os error 32)
Io error: Broken pipe (os error 32)
i3status: exiting due to signal.
Io error: Broken pipe (os error 32)
Error: ExitFailure(1)
Warning: Zero outputs support gamma adjustment.
Error: Wayland connection experienced a fatal error: -1
Error: Temperature adjustment failed.
Backtrace:
Program terminated with signal SIGABRT, Aborted.
#0 __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
44 return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
[Current thread is 1 (Thread 0x7554b718b680 (LWP 24063))]
(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 0x00007554b7d82eb3 in __pthread_kill_internal (threadid=<optimized out>, signo=6) at pthread_kill.c:78
#2 0x00007554b7d2aa30 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3 0x00007554b7d124c3 in __GI_abort () at abort.c:79
#4 0x00007554b7d123df in __assert_fail_base (fmt=0x7554b7e9db68 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7554b871c7fa "width >= 0 && height >= 0",
file=file@entry=0x7554b871c5a0 "types/xdg_shell/wlr_xdg_toplevel.c", line=line@entry=550, function=function@entry=0x7554b871ca00 <__PRETTY_FUNCTION__.4> "wlr_xdg_toplevel_set_size")
at assert.c:94
#5 0x00007554b7d22c67 in __assert_fail (assertion=0x7554b871c7fa "width >= 0 && height >= 0", file=0x7554b871c5a0 "types/xdg_shell/wlr_xdg_toplevel.c", line=550,
function=0x7554b871ca00 <__PRETTY_FUNCTION__.4> "wlr_xdg_toplevel_set_size") at assert.c:103
#6 0x00007554b86991ff in wlr_xdg_toplevel_set_size (toplevel=0x646cdd3c97e0, width=-4, height=-27) at ../subprojects/wlroots/types/xdg_shell/wlr_xdg_toplevel.c:550
#7 0x0000646cbd93e6de in configure (view=0x646cdd95c390, lx=2, ly=25, width=-4, height=-27) at ../sway/desktop/xdg_shell.c:174
#8 0x0000646cbd98191b in view_configure (view=0x646cdd95c390, lx=2, ly=25, width=-4, height=-27) at ../sway/tree/view.c:186
#9 0x0000646cbd93da45 in transaction_commit (transaction=0x646cdd3b2530) at ../sway/desktop/transaction.c:797
#10 0x0000646cbd93dc46 in transaction_commit_pending () at ../sway/desktop/transaction.c:849
#11 0x0000646cbd93dfe3 in _transaction_commit_dirty (server_request=true) at ../sway/desktop/transaction.c:926
#12 0x0000646cbd93dff9 in transaction_commit_dirty () at ../sway/desktop/transaction.c:930
#13 0x0000646cbd93b02f in handle_new_output (listener=0x646cbd9b7ca0 <server+96>, data=0x646cdd932780) at ../sway/desktop/output.c:530
#14 0x00007554b7f6e42e in wl_signal_emit_mutable (signal=<optimized out>, data=0x646cdd932780) at ../wayland-1.23.0/src/wayland-server.c:2314
#15 0x00007554b866cbe0 in new_output_reemit (listener=0x646cdc9fa328, data=0x646cdd932780) at ../subprojects/wlroots/backend/multi/backend.c:208
#16 0x00007554b7f6e42e in wl_signal_emit_mutable (signal=<optimized out>, data=0x646cdd932780) at ../wayland-1.23.0/src/wayland-server.c:2314
#17 0x00007554b865cedd in scan_drm_connectors (drm=0x646cdca06810, event=0x7ffe54c4758c) at ../subprojects/wlroots/backend/drm/drm.c:1723
#18 0x00007554b8657183 in handle_dev_change (listener=0x646cdca068e8, data=0x7ffe54c47588) at ../subprojects/wlroots/backend/drm/backend.c:138
#19 0x00007554b7f6e42e in wl_signal_emit_mutable (signal=<optimized out>, data=0x7ffe54c47588) at ../wayland-1.23.0/src/wayland-server.c:2314
#20 0x00007554b86544f5 in handle_udev_event (fd=9, mask=1, data=0x646cdc9f05c0) at ../subprojects/wlroots/backend/session/session.c:212
#21 0x00007554b7f700a2 in wl_event_loop_dispatch (loop=0x646cdc9ef820, timeout=<optimized out>, timeout@entry=-1) at ../wayland-1.23.0/src/event-loop.c:1105
#22 0x00007554b7f7210f in wl_display_run (display=0x646cdc9ef730) at ../wayland-1.23.0/src/wayland-server.c:1530
#23 0x0000646cbd936ab2 in server_run (server=0x646cbd9b7c40 <server>) at ../sway/server.c:495
#24 0x0000646cbd9351e6 in main (argc=1, argv=0x7ffe54c47998) at ../sway/main.c:373
Let me know if you want me to try any patch. I have 1 external display connected.
Edit: reproduces also with Arch linux default config /etc/sway/config.
Does this help? https://github.com/swaywm/sway/pull/8217
Does this help? #8217
It does, I cannot crash sway anymore using output power on/off commands. I've attached stderr for residual errors left (start sway, output power off, on, exit sway). stderr.txt