mate-settings-daemon crashes due to misbehavior in Qt's clipboard implementation
ilya-fedin opened this issue · 3 comments
Expected behaviour
No crash
Actual behaviour
I have such lines in journalctl
апр 13 06:10:54 nixos xsession[343766]: QXcbClipboard: Unable to receive an event from the clipboard manager in a reasonable time
апр 13 06:10:54 nixos .mate-settings-[1266]: The program 'mate-settings-daemon' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadWindow (invalid Window parameter)'.
(Details: serial 134515 error_code 3 request_code 18 (core protocol) minor_code 0)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the GDK_SYNCHRONIZE environment
variable to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
And such a backtrace:
#0 0x00007fe782c25917 in g_log_writer_default () from /nix/store/pa5zrzvsblhlw3dkka4q4hkxh4yrbdab-glib-2.70.3/lib/libglib-2.0.so.0
No symbol table info available.
#1 0x00007fe782c239e7 in g_log_structured_array () from /nix/store/pa5zrzvsblhlw3dkka4q4hkxh4yrbdab-glib-2.70.3/lib/libglib-2.0.so.0
No symbol table info available.
#2 0x00007fe782c244f2 in g_log_structured_standard () from /nix/store/pa5zrzvsblhlw3dkka4q4hkxh4yrbdab-glib-2.70.3/lib/libglib-2.0.so.0
No symbol table info available.
#3 0x00007fe7833049da in _gdk_x11_display_error_event () from /nix/store/l6qjw55i0jjbzr5bxcxvw0q18nz5d4zz-gtk+3-3.24.31/lib/libgdk-3.so.0
No symbol table info available.
#4 0x00007fe783311c83 in gdk_x_error () from /nix/store/l6qjw55i0jjbzr5bxcxvw0q18nz5d4zz-gtk+3-3.24.31/lib/libgdk-3.so.0
No symbol table info available.
#5 0x00007fe7827e8784 in _XError () from /nix/store/9wvss92s8hd5pn8n3ksgqfhinlk55hcp-libX11-1.7.2/lib/libX11.so.6
No symbol table info available.
#6 0x00007fe7827e5447 in handle_error () from /nix/store/9wvss92s8hd5pn8n3ksgqfhinlk55hcp-libX11-1.7.2/lib/libX11.so.6
No symbol table info available.
#7 0x00007fe7827e54e5 in handle_response () from /nix/store/9wvss92s8hd5pn8n3ksgqfhinlk55hcp-libX11-1.7.2/lib/libX11.so.6
No symbol table info available.
#8 0x00007fe7827e653d in _XReply () from /nix/store/9wvss92s8hd5pn8n3ksgqfhinlk55hcp-libX11-1.7.2/lib/libX11.so.6
No symbol table info available.
--Type <RET> for more, q to quit, c to continue without paging--c
#9 0x00007fe7827e1d1b in XSync () from /nix/store/9wvss92s8hd5pn8n3ksgqfhinlk55hcp-libX11-1.7.2/lib/libX11.so.6
No symbol table info available.
#10 0x00007fe77c594d21 in send_selection_notify () from /nix/store/lhc5ys5wf8s6pkg7vqgba5awhp4b444r-mate-settings-daemon-1.26.0/lib/mate-settings-daemon/libclipboard.so
No symbol table info available.
#11 0x00007fe77c5954d6 in clipboard_manager_event_filter () from /nix/store/lhc5ys5wf8s6pkg7vqgba5awhp4b444r-mate-settings-daemon-1.26.0/lib/mate-settings-daemon/libclipboard.so
No symbol table info available.
#12 0x00007fe78330bf1f in gdk_event_apply_filters () from /nix/store/l6qjw55i0jjbzr5bxcxvw0q18nz5d4zz-gtk+3-3.24.31/lib/libgdk-3.so.0
No symbol table info available.
#13 0x00007fe78330c274 in _gdk_x11_display_queue_events () from /nix/store/l6qjw55i0jjbzr5bxcxvw0q18nz5d4zz-gtk+3-3.24.31/lib/libgdk-3.so.0
No symbol table info available.
#14 0x00007fe7832b0660 in gdk_display_get_event () from /nix/store/l6qjw55i0jjbzr5bxcxvw0q18nz5d4zz-gtk+3-3.24.31/lib/libgdk-3.so.0
No symbol table info available.
#15 0x00007fe78330bfb2 in gdk_event_source_dispatch () from /nix/store/l6qjw55i0jjbzr5bxcxvw0q18nz5d4zz-gtk+3-3.24.31/lib/libgdk-3.so.0
No symbol table info available.
#16 0x00007fe782c1cacb in g_main_context_dispatch () from /nix/store/pa5zrzvsblhlw3dkka4q4hkxh4yrbdab-glib-2.70.3/lib/libglib-2.0.so.0
No symbol table info available.
#17 0x00007fe782c1cd78 in g_main_context_iterate.constprop () from /nix/store/pa5zrzvsblhlw3dkka4q4hkxh4yrbdab-glib-2.70.3/lib/libglib-2.0.so.0
No symbol table info available.
#18 0x00007fe782c1d06b in g_main_loop_run () from /nix/store/pa5zrzvsblhlw3dkka4q4hkxh4yrbdab-glib-2.70.3/lib/libglib-2.0.so.0
No symbol table info available.
#19 0x00007fe78357c2a5 in gtk_main () from /nix/store/l6qjw55i0jjbzr5bxcxvw0q18nz5d4zz-gtk+3-3.24.31/lib/libgtk-3.so.0
No symbol table info available.
#20 0x0000000000404e9f in main ()
No symbol table info available.
It seems there's some bug in Qt and any clipboard operation can trigger mate-settings-daemon's crash. I believe m-s-d should be able to better handle this.
Here's the code that prints the warning on Qt side: https://github.com/qt/qtbase/blob/v5.15.3-lts-lgpl/src/plugins/platforms/xcb/qxcbclipboard.cpp#L268
Steps to reproduce the behaviour
Just using any Qt application that means frequent clipboard operations apparently (e.g. a messenger like Telegram or NeoChat)
MATE general version
1.26.0
Package version
1.26.0
Linux Distribution
NixOS
Link to bugreport of your Distribution (requirement)
None
@ilya-fedin please give #385 a shot, it might or might not help. Actually I don't really think it should do much, unless the default display changes on us somehow -- or maybe I'm missing something regarding how the events are fiddled with. Anyhow, it tries and sanitize on which display errors are trapped, so it could help.
It also fixes a unpaired trap/untrap pair, so maybe that helps as well.
Anyhow if that's not enough, we're gonna need a better backtrace (with debugging symbols & all).
I applied the patch, will see how it goes :)
@ilya-fedin any news on this?