Bug 238415

Summary: [GTK4] Frequent UI process hangs
Product: WebKit Reporter: Michael Catanzaro <mcatanzaro>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WORKSFORME    
Severity: Normal CC: bugs-noreply, mcatanzaro
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 210100, 245783    

Description Michael Catanzaro 2022-03-26 07:12:18 PDT
I'm noticing frequent UI process hangs with GTK 4. (It's quite rare for this to occur with GTK 3.)

Getting a good backtrace is a little difficult because it's inside the flatpak environment, but host gdb was able to give me this:

#0  0x00007f77b505ae1d in __futex_abstimed_wait_common64 () from target:/usr/lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007f77b50545b4 in pthread_cond_wait () from target:/usr/lib/x86_64-linux-gnu/libpthread.so.0
#2  0x00007f77aec5d12b in wl_display_read_events () from target:/usr/lib/x86_64-linux-gnu/libwayland-client.so.0
#3  0x00007f77aec5db29 in wl_display_dispatch_queue () from target:/usr/lib/x86_64-linux-gnu/libwayland-client.so.0
#4  0x00007f77b5678e0f in gdk_wayland_toplevel_focus () from target:/usr/lib/x86_64-linux-gnu/libgtk-4.so.1
#5  0x00007f77b5ede7dd in ?? () from target:/app/lib/epiphany/libephymain.so
#6  0x00007f77b5c8ba19 in g_timeout_dispatch () from target:/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#7  0x00007f77b5c8aceb in g_main_context_dispatch () from target:/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#8  0x00007f77b5c8b1f8 in g_main_context_iterate.constprop () from target:/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#9  0x00007f77b5c8b2c4 in g_main_context_iteration () from target:/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#10 0x00007f77b5b3404d in g_application_run () from target:/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#11 0x000055df12d970f6 in main ()

Probably that's not enough to fix this, but at least it's a hint. Looks like GTK 4 might be deadlocking when dispatching Wayland events. I wonder why.
Comment 1 Michael Catanzaro 2022-11-09 10:24:38 PST
Note this is still happening quite regularly, and it's definitely a regression from the switch to GTK 4.
Comment 2 Michael Catanzaro 2022-11-18 07:26:41 PST
Nowadays the hangs I see are almost always associated with web process hangs while a page is loading, which frequently happen when loading several pages at the same time. E.g. open cnn.com or arstechnica.com and middle click on a bunch of links to open several articles in new tabs. Almost always, one tab's load will stall and continue indefinitely. Attempting to close the out of control tab will then cause a UI process hang.

I'm not confident these hangs correspond to the backtrace that I posted in comment #0, but I *am* confident it's the only UI process hang that I'm encountering frequently right now. So if it's *not* the original issue here, then the original one doesn't matter anymore.
Comment 3 Michael Catanzaro 2022-11-18 10:57:40 PST
Hit it just now... the web process crashed due to bug #247628, which triggered an Epiphany crash that is an Epiphany bug. The UI process appears to hang for a while before the crash. Pretty sure it's not this issue, so I'll close this because it's not useful to keep open if it's no longer happening.
Comment 4 Michael Catanzaro 2022-11-18 11:01:19 PST
(In reply to Michael Catanzaro from comment #3)
> Hit it just now... the web process crashed due to bug #247628, which
> triggered an Epiphany crash that is an Epiphany bug.

https://gitlab.gnome.org/GNOME/epiphany/-/issues/1878