swaywm / wlroots

A modular Wayland compositor library
https://gitlab.freedesktop.org/wlroots/wlroots/
MIT License
2.15k stars 343 forks source link

xwayland/xwm: hang in xwm_get_atom_name #2285

Open quantum5 opened 4 years ago

quantum5 commented 4 years ago

Using wlroots master and sway master from 3 days ago, sway hangs inside xwm_get_atom_name, and the entire UI is unresponsive. This happens during daily usage, unsure what the trigger is. But in any case, this should not lock up the entire session.

killall Xwayland unlocks the entire session.

Stack trace:

(gdb) bt full
#0  0x00007f3c98dd4819 in __GI___poll (fds=fds@entry=0x7ffe40361bf8, nfds=nfds@entry=1, timeout=timeout@entry=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
        resultvar = 18446744073709551100
        sc_cancel_oldtype = 0
#1  0x00007f3c98ec3cf7 in poll (__timeout=-1, __nfds=1, __fds=0x7ffe40361bf8) at /usr/include/x86_64-linux-gnu/bits/poll2.h:46
        ret = <optimized out>
        fd = {fd = 25, events = 1, revents = 0}
#2  0x00007f3c98ec3cf7 in _xcb_conn_wait (c=c@entry=0x556af9a2de80, cond=cond@entry=0x7ffe40361d10, vector=vector@entry=0x0, count=count@entry=0x0) at ../../src/xcb_conn.c:479
        ret = <optimized out>
        fd = {fd = 25, events = 1, revents = 0}
#3  0x00007f3c98ec563f in wait_for_reply (c=c@entry=0x556af9a2de80, request=7997151, e=e@entry=0x0) at ../../src/xcb_in.c:516
        cond = 
          {__data = {{__wseq = 0, __wseq32 = {__low = 0, __high = 0}}, {__g1_start = 0, __g1_start32 = {__low = 0, __high = 0}}, __g_refs = {0, 0}, __g_size = {0, 0}, __g1_orig_size = 0, __wrefs = 0, __g_signals = {0, 0}}, __size = '\000' <repeats 47 times>, __align = 0}
        reader = {request = 7997151, data = 0x7ffe40361d10, next = 0x0}
        ret = 0x0
#4  0x00007f3c98ec5752 in xcb_wait_for_reply (c=0x556af9a2de80, request=7997151, e=e@entry=0x0) at ../../src/xcb_in.c:532
        ret = <optimized out>
#5  0x00007f3c98ecb445 in xcb_get_atom_name_reply (c=<optimized out>, cookie=..., e=e@entry=0x0) at xproto.c:3383
#6  0x00007f3c98f95805 in xwm_get_atom_name (xwm=xwm@entry=0x556af9a13250, atom=<optimized out>) at ../xwayland/xwm.c:674
        name_cookie = <optimized out>
        name_reply = <optimized out>
        len = <optimized out>
        buf = <optimized out>
        name = <optimized out>
#7  0x00007f3c98f92dd2 in xwm_handle_selection_request (xwm=0x556af9a13250, req=0x556b0cbc0590) at ../xwayland/selection/outgoing.c:393
        selection_name = <optimized out>
        selection = 0x556af9a13428
#8  0x00007f3c98f93565 in xwm_handle_selection_event (xwm=xwm@entry=0x556af9a13250, event=event@entry=0x556b0cbc0590) at ../xwayland/selection/selection.c:130
#9  0x00007f3c98f963a2 in x11_event_handler (fd=<optimized out>, mask=<optimized out>, data=0x556af9a13250) at ../xwayland/xwm.c:1323
        count = 3982255
        event = 0x556b0cbc0590
        xwm = 0x556af9a13250
#10 0x00007f3c98fde36a in wl_event_loop_dispatch (loop=0x556af8c5e940, timeout=timeout@entry=-1) at ../src/event-loop.c:1027
        ep = 
              {{events = 1, data = {ptr = 0x556af99a08c0, fd = -107345728, u32 = 4187621568, u64 = 93917942515904}}, {events = 1, data = {ptr = 0x556af9bc8840, fd = -105084864, u32 = 4189882432, u64 = 93917944776768}}, {events = 797433600, data = {ptr = 0x556a3ec4f645, fd = 1053095493, u32 = 1053095493, u64 = 93914807989829}}, {events = 4, data = {ptr = 0x18, fd = 24, u32 = 24, u64 = 24}}, {events = 4189213152, data = {ptr = 0x40361fe00000556a, fd = 21866, u32 = 21866, u64 = 4626920714102920554}}, {events = 32766, data = {ptr = 0x556af9b281f8, fd = -105741832, u32 = 4189225464, u64 = 93917944119800}}, {events = 4189217256, data = {ptr = 0x403620200000556a, fd = 21866, u32 = 21866, u64 = 4626920988980827498}}, {events = 32766, data = {ptr = 0x7f3c98fdeacd <wl_connection_flush+365>, fd = -1728189747, u32 = 2566777549, u64 = 139898241542861}}, {events = 24, data = {ptr = 0x4036205000000000, fd = 0, u32 = 0, u64 = 4626921195139235840}}, {events = 32766, data = {ptr = 0x7ffe40362040, fd = 1077289024, u32 = 1077289024, u64 = 140729975709760}}, {events = 1, data = {ptr = 0x1d468, fd = 119912, u32 = 119912, u64 = 119912}}, {events = 0, data = {ptr = 0x556a00000000, fd = 0, u32 = 0, u64 = 93913754894336}}, {events = 1077288992, data = {ptr = 0x100007ffe, fd = 32766, u32 = 32766, u64 = 4295000062}}, {events = 0, data = {ptr = 0x0, fd = 0, u32 = 0, u64 = 0}}, {events = 0, data = {ptr = 0x0, fd = 0, u32 = 0, u64 = 0}}, {events = 0, data = {ptr = 0x3ec4f6452f87df00, fd = 797433600, u32 = 797433600, u64 = 4523010702797430528}}, {events = 4189218384, data = {ptr = 0x180000556a, fd = 21866, u32 = 21866, u64 = 103079236970}}, {events = 0, data = {ptr = 0x556af9b261e8, fd = -105750040, u32 = 4189217256, u64 = 93917944111592}}, {events = 48, data = {ptr = 0x1400000000, fd = 0, u32 = 0, u64 = 85899345920}}, {events = 0, data = {ptr = 0x100000001, fd = 1, u32 = 1, u64 = 4294967297}}, {events = 127, data = {ptr = 0x8600000084, fd = 132, u32 = 132, u64 = 575525617796}}, {events = 137, data = {ptr = 0xef000000d9, fd = 217, u32 = 217, u64 = 1026497183961}}, {events = 261, data = {ptr = 0x1310000011b, fd = 283, u32 = 283, u64 = 1309965025563}}, {events = 327, data = {ptr = 0x1730000015d, fd = 349, u32 = 349, u64 = 1593432867165}}, {events = 393, data = {ptr = 0x1b50000019f, fd = 415, u32 = 415, u64 = 1876900708767}}, {events = 210, data = {ptr = 0x1bf00000156, fd = 342, u32 = 342, u64 = 1919850381654}}, {events = 469, data = {ptr = 0x201000001eb, fd = 491, u32 = 491, u64 = 2203318223339}}, {events = 535, data = {ptr = 0x2430000022d, fd = 557, u32 = 557, u64 = 2486786064941}}, {events = 4186028848, data = {ptr = 0x2f87df000000556a, fd = 21866, u32 = 21866, u64 = 3424951232731567466}}, {events = 1053095493, data = {ptr = 0x556af8c6ad70, fd = -121197200, u32 = 4173770096, u64 = 93917928664432}}, {events = 797433600, data = {ptr = 0x53ec4f645, fd = 1053095493, u32 = 1053095493, u64 = 22527931973}}, {events = 21866, data = {ptr = 0x556af9b30d80, fd = -105706112, u32 = 4189261184, u64 = 93917944155520}}}
        source = <optimized out>
        i = <optimized out>
        count = <optimized out>
        has_timers = <optimized out>
#11 0x00007f3c98fdc9ba in wl_display_run (display=0x556af8c5ee00) at ../src/wayland-server.c:1351
#12 0x0000556af79d8881 in main (argc=1, argv=0x7ffe403622b8) at ../sway/main.c:410
        verbose = 0
        debug = 0
        validate = 0
        allow_unsupported_gpu = 0
        long_options = {{name = 0x556af7a2444b "help", has_arg = 0, flag = 0x0, val = 104}, {name = 0x556af7a27da9 "config", has_arg = 1, flag = 0x0, val = 99}, {name = 0x556af7a24450 "validate", has_arg = 0, flag = 0x0, val = 67}, {name = 0x556af7a24459 "debug", has_arg = 0, flag = 0x0, val = 100}, {name = 0x556af7a243af "version", has_arg = 0, flag = 0x0, val = 118}, {name = 0x556af7a2348d "verbose", has_arg = 0, flag = 0x0, val = 86}, {name = 0x556af7a2445f "get-socketpath", has_arg = 0, flag = 0x0, val = 112}, {name = 0x556af7a2446e "unsupported-gpu", has_arg = 0, flag = 0x0, val = 117}, {name = 0x556af7a2447e "my-next-gpu-wont-be-nvidia", has_arg = 0, flag = 0x0, val = 117}, {name = 0x0, has_arg = 0, flag = 0x0, val = 0}}
        config_path = 0x0
        usage = 0x556af7a247f0 "Usage: sway [options] [command]\n\n  -h, --help", ' ' <repeats 13 times>, "Show help message and quit.\n  -c, --config <config>  Specify a config file.\n  -C, --validate         Check the validity of the config file, th"...
        c = <optimized out>

wlroots has migrated to gitlab.freedesktop.org. This issue has been moved to:

https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/2285

emersion commented 4 years ago

Your bug report is missing debug logs. Please add a link to the full debug log file.

quantum5 commented 4 years ago

I managed to reproduce this bug in a short session, but unfortunately it generates a 1.8 GB log file that I cannot upload. Most of the log seems to be repetition of the same message, however. Here's the log file with the repetition removed: https://gist.github.com/quantum5/33aa9e6f8559be9d8bda5fbc0cd3f463

The actual reproduction only involved wayland applications (with Xwayland applications running in the background): opening find in Sublime Text in a text search for a string, and hold down the enter key so that it cycles through all matches. After a while, switching focus to Firefox causes the entire session to hang.

quantum5 commented 4 years ago

Okay the hang only happens when fcitx is running.

tobiasjakobi commented 4 years ago

I experienced a similar problem. I have a top bar and a bottom bar. The top bar is the native sway one, the bottom one is waybar. When the problem hits the top bar freezes. Most of the time also some application crashes simultanously, usually Firefox.

I have disabled fcitx for now, and I haven't encountered the problem since then.

I should mention that a lot of copy&pasting usually triggers the problem for me.