Bug 238244 - [GTK] Upgrading to 2.36.0 causes all webviews to be blank
Summary: [GTK] Upgrading to 2.36.0 causes all webviews to be blank
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: Other
Hardware: PC Linux
: P2 Major
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-22 22:43 PDT by Adrian Vovk
Modified: 2023-04-28 01:01 PDT (History)
13 users (show)

See Also:


Attachments
Full backtrace of running MiniBrowser webkit://gpu (931.12 KB, text/x-log)
2022-04-22 20:39 PDT, Haelwenn (lanodan) Monnier
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Vovk 2022-03-22 22:43:23 PDT
In a recent mass upgrade in my distro, I upgraded WebKitGTK to 2.36.0 (among other packages). I'm now finding that the webview is blank in all the apps that use it (epiphany, Yelp). The web inspector shows up fine, and when I move the cursor around the screen it changes as if it were hovering over the actual web content. Running either yelp or epiphany with WEBKIT_DISABLE_COMPOSITING_MODE=1 makes the webviews work correctly again, so I suspect this is an issue with the accelerated hardware compositing. Not sure what libraries are involved with that, so I don't know which versions to give you. I'm happy to provide whatever you need to track down the bug!
Comment 1 Adrian Vovk 2022-03-22 22:54:55 PDT
Not sure if this is related, but when I start epiphany w/o the environment variable, I get this warning and xdg-desktop-portal segfaults while trying to handle MakeThreadRealtimeWithPID

$ epiphany 
(WebKitWebProcess:2): Gdk-WARNING **: 01:48:32.563: Failed to read portal settings: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name is not activatable
(WebKitWebProcess:2): Gdk-WARNING **: 01:48:32.563: Failed to read portal settings: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name is not activatable

when the environment variable is set, the crash still seems to happen, but the warning becomes hit-or-miss (either happening once or none at all) and epiphany starts rendering webpages correctly.
Comment 2 Patrick Griffis 2022-03-23 06:42:19 PDT
> I get this warning and xdg-desktop-portal segfaults while trying to handle MakeThreadRealtimeWithPID

You need `xdg-desktop-portal` 1.12.2 or 1.14.0 to fix that.
Comment 3 Michael Catanzaro 2022-03-23 06:54:11 PDT
(In reply to Adrian Vovk from comment #0)
> Running either yelp or epiphany with
> WEBKIT_DISABLE_COMPOSITING_MODE=1 makes the webviews work correctly again,
> so I suspect this is an issue with the accelerated hardware compositing. 

I agree.

> Not
> sure what libraries are involved with that, so I don't know which versions
> to give you. I'm happy to provide whatever you need to track down the bug!

Try loading webkit://gpu and paste the output here. The flaw in this plan is that it probably won't load unless you use WEBKIT_DISABLE_COMPOSITING_MODE=1, which will impact the results it shows, but we'll just have to keep that in mind.
Comment 4 Adrian Vovk 2022-03-23 09:27:10 PDT
> You need `xdg-desktop-portal` 1.12.2 or 1.14.0 to fix that.

I'm using xdg-desktop-portal 1.14.1

> Try loading webkit://gpu and paste the output here

This causes epiphany to segfault, no matter if the environment variable is set. Here's the backtrace of this crash:

#0  0x00007f9f4c1b534e _ZN6WebKit21WebKitProtocolHandler9handleGPUEP23_WebKitURISchemeRequest (libwebkit2gtk-4.0.so.37 + 0xba634e)
#1  0x00007f9f4c1b57ab _ZN6WebKit21WebKitProtocolHandler13handleRequestEP23_WebKitURISchemeRequest (libwebkit2gtk-4.0.so.37 + 0xba67ab)
#2  0x00007f9f4c1cf69e _ZN22WebKitURISchemeHandler17platformStartTaskERN6WebKit12WebPageProxyERNS0_16WebURLSchemeTaskE (libwebkit2gtk-4.0.so.37 + 0xbc069e)
#3  0x00007f9f4c119a50 _ZN6WebKit12WebPageProxy24startURLSchemeTaskSharedEON3WTF3RefINS_15WebProcessProxyENS1_12RawPtrTraitsIS3_EEEENS1_16ObjectIdentifierIN7WebCore18PageIdentifierT>
#4  0x00007f9f4c119b3a _ZN6WebKit12WebPageProxy18startURLSchemeTaskEONS_23URLSchemeTaskParametersE (libwebkit2gtk-4.0.so.37 + 0xb0ab3a)
#5  0x00007f9f4bdac8f3 _ZN3IPC13handleMessageIN8Messages12WebPageProxy18StartURLSchemeTaskEN6WebKit12WebPageProxyEMS5_FvONS4_23URLSchemeTaskParametersEEEEvRNS_10ConnectionERNS_7Deco>
#6  0x00007f9f4bd9f404 _ZN6WebKit12WebPageProxy17didReceiveMessageERN3IPC10ConnectionERNS1_7DecoderE (libwebkit2gtk-4.0.so.37 + 0x790404)
#7  0x00007f9f4c01868b _ZN3IPC18MessageReceiverMap15dispatchMessageERNS_10ConnectionERNS_7DecoderE (libwebkit2gtk-4.0.so.37 + 0xa0968b)
#8  0x00007f9f4c0cf4d0 _ZN6WebKit15WebProcessProxy17didReceiveMessageERN3IPC10ConnectionERNS1_7DecoderE (libwebkit2gtk-4.0.so.37 + 0xac04d0)
#9  0x00007f9f4c010fe5 _ZN3IPC10Connection15dispatchMessageESt10unique_ptrINS_7DecoderESt14default_deleteIS2_EE (libwebkit2gtk-4.0.so.37 + 0xa01fe5)
#10 0x00007f9f4c0131c9 _ZN3IPC10Connection24dispatchIncomingMessagesEv (libwebkit2gtk-4.0.so.37 + 0xa041c9)
#11 0x00007f9f4b24c98d _ZN3WTF7RunLoop11performWorkEv (libjavascriptcoregtk-4.0.so.18 + 0x136298d)
#12 0x00007f9f4b2acc5d _ZZN3WTF7RunLoopC4EvENUlPvE_4_FUNES1_ (libjavascriptcoregtk-4.0.so.18 + 0x13c2c5d)
#13 0x00007f9f4b2ad64d _ZN3WTF7RunLoopUlP8_GSourcePFiPvES3_E_4_FUNES2_S5_S3_ (libjavascriptcoregtk-4.0.so.18 + 0x13c364d)
#14 0x00007f9f4f89f17c g_main_context_dispatch (libglib-2.0.so.0 + 0x5717c)
#15 0x00007f9f4f8f5a98 g_main_context_iterate.constprop.0 (libglib-2.0.so.0 + 0xada98)
#16 0x00007f9f4f89c824 g_main_context_iteration (libglib-2.0.so.0 + 0x54824)
#17 0x00007f9f4fac5b3d g_application_run (libgio-2.0.so.0 + 0xe7b3d)
#18 0x000055621937601f main (epiphany + 0x501f)
#19 0x00007f9f4f50874a n/a (libc.so.6 + 0x2d74a)
#20 0x00007f9f4f508806 __libc_start_main (libc.so.6 + 0x2d806)
#21 0x0000556219376335 _start (epiphany + 0x5335)

However, I can still give you all the version numbers it would give

WebKit version: 2.36.0 (tarball)
Operating system (uname -a): Linux adrians-macbook 5.16.16-mainline #1 SMP PREEMPT Mon Mar 21 19:34:18 UTC 2022 x86_64 GNU/Linux
Desktop ($XDG_CURRENT_DESKTOP): graphite:Wayfire:GNOME
Cairo version: 1.16.0
GStreamer version: 1.20.1
GTK version: 3.24.33
libwpe version: 1.12.0
wpebackend-fdo version: 1.12.0
Mesa version: 22.0.0
GL renderer: Mesa Intel(R) Iris(R) Graphics 6100 (BDW GT3)
Comment 5 Michael Catanzaro 2022-03-23 10:07:01 PDT
(In reply to Adrian Vovk from comment #4)
> This causes epiphany to segfault, no matter if the environment variable is
> set. Here's the backtrace of this crash:

Uh... might be related, could you post a backtrace with `bt full` please? Then we can decide whether it requires a separate bug report or not.
Comment 6 Adrian Vovk 2022-03-23 10:54:47 PDT
> post a backtrace with `bt full`

Sure! Here it is

(gdb) bt full
#0  0x00007ffff3c5734e in WebKit::WebKitProtocolHandler::handleGPU(_WebKitURISchemeRequest*) () at /usr/lib/libwebkit2gtk-4.0.so.37
#1  0x00007ffff3c577ab in WebKit::WebKitProtocolHandler::handleRequest(_WebKitURISchemeRequest*) () at /usr/lib/libwebkit2gtk-4.0.so.37
#2  0x00007ffff3c7169e in WebKitURISchemeHandler::platformStartTask(WebKit::WebPageProxy&, WebKit::WebURLSchemeTask&) () at /usr/lib/libwebkit2gtk-4.0.so.37
#3  0x00007ffff3bbba50 in WebKit::WebPageProxy::startURLSchemeTaskShared(WTF::Ref<WebKit::WebProcessProxy, WTF::RawPtrTraits<WebKit::WebProcessProxy> >&&, WTF::ObjectIdentifier<WebCore::PageIdentifierType>, WebKit::URLSchemeTaskParameters&&) () at /usr/lib/libwebkit2gtk-4.0.so.37
#4  0x00007ffff3b42cf0 in WebKit::ProvisionalPageProxy::startURLSchemeTask(WebKit::URLSchemeTaskParameters&&) () at /usr/lib/libwebkit2gtk-4.0.so.37
#5  0x00007ffff3b4d62f in void IPC::handleMessage<Messages::WebPageProxy::StartURLSchemeTask, WebKit::ProvisionalPageProxy, void (WebKit::ProvisionalPageProxy::*)(WebKit::URLSchemeTaskParameters&&)>(IPC::Connection&, IPC::Decoder&, WebKit::ProvisionalPageProxy*, void (WebKit::ProvisionalPageProxy::*)(WebKit::URLSchemeTaskParameters&&)) () at /usr/lib/libwebkit2gtk-4.0.so.37
#6  0x00007ffff3aba68b in IPC::MessageReceiverMap::dispatchMessage(IPC::Connection&, IPC::Decoder&) () at /usr/lib/libwebkit2gtk-4.0.so.37
#7  0x00007ffff3b714d0 in WebKit::WebProcessProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder&) () at /usr/lib/libwebkit2gtk-4.0.so.37
#8  0x00007ffff3ab2fe5 in IPC::Connection::dispatchMessage(std::unique_ptr<IPC::Decoder, std::default_delete<IPC::Decoder> >) ()
--Type <RET> for more, q to quit, c to continue without paging--
   o.37
#9  0x00007ffff3ab51c9 in IPC::Connection::dispatchIncomingMessages() () at /usr/lib/libwebkit2gtk-4.0.so.37
#10 0x00007ffff2cee98d in WTF::RunLoop::performWork() () at /usr/lib/libjavascriptcoregtk-4.0.so.18
#11 0x00007ffff2d4ec5d in WTF::RunLoop::RunLoop()::{lambda(void*)#1}::_FUN(void*) () at /usr/lib/libjavascriptcoregtk-4.0.so.18
#12 0x00007ffff2d4f64d in WTF::RunLoop::{lambda(_GSource*, int (*)(void*), void*)#1}::_FUN(_GSource*, int (*)(void*), void*) () at /usr/lib/libjavascriptcoregtk-4.0.so.18
#13 0x00007ffff734117c in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#14 0x00007ffff7397a98 in g_main_context_iterate.constprop () at /usr/lib/libglib-2.0.so.0
#15 0x00007ffff733e824 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#16 0x00007ffff7567b3d in g_application_run () at /usr/lib/libgio-2.0.so.0
#17 0x000055555555901f in main ()
Comment 7 Adrian Vovk 2022-03-23 11:06:35 PDT
I took a look at the disassembly @ the point of the crash:

   0x00007ffff3c57342 <+882>:	call   0x7ffff53c62a0 <_ZN7WebCore9GLContext22createOffscreenContextEPNS_15PlatformDisplayE>
   0x00007ffff3c57347 <+887>:	mov    -0x1d0(%rbp),%rdi
=> 0x00007ffff3c5734e <+894>:	mov    (%rdi),%rax
   0x00007ffff3c57351 <+897>:	call   *0x10(%rax)

So it seems to be crashing somewhere between these two lines: https://github.com/WebKit/WebKit/blob/b65babf43267b620de1c5720a8624e766af525c2/Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.cpp#L374-L375
Comment 8 Michael Catanzaro 2022-03-23 11:59:38 PDT
I suppose you're hitting bug #201507 and/or bug #233578. I suspect this bug may be a duplicate of one or the other. Or both.
Comment 9 Adrian Vovk 2022-03-23 13:21:30 PDT
Not sure what the path forward here is? Those issues don't look super similar to me, especially since the assembly snippet I've posted seems to be throwing out the result of createOffscreenContext, dereferencing some random variable, and calling it as a function. However, I might be missing something and I'm sure you know better. Do you think those two bugs are related to the blank webviews? I don't see segfaults then

Additional context: The flatpak'd wip/exalm/gtk4 branch of epiphany (using the same version of webkitgtk) works perfectly fine on the same system
Comment 10 Michael Catanzaro 2022-03-23 14:35:24 PDT
(In reply to Michael Catanzaro from comment #8)
> I suppose you're hitting bug #201507 and/or bug #233578. I suspect this bug
> may be a duplicate of one or the other. Or both.

I just assumed it's the same because these bugs are related to errors when causing makeContextCurrent. It's caused multiple crashes in the past, if you're brave enough to wade through the history of those bugs....
Comment 11 Michael Catanzaro 2022-03-23 15:03:30 PDT
(In reply to Adrian Vovk from comment #9)
> Not sure what the path forward here is?

BTW I don't know either. Needs help from graphics folks.
Comment 12 seb128 2022-03-28 03:36:00 PDT
The issue also got reported on launchpad for the incoming Ubuntu
https://bugs.launchpad.net/webkit/+bug/1966418

It is only an issue under wayland, login into an x11 session makes things work again
Comment 13 Jeremy Bicha 2022-03-28 05:16:41 PDT
I believe the Ubuntu bug I'm experiencing was triggered by the update to mesa 22.0. I am using Intel graphics.
Comment 14 Michael Catanzaro 2022-03-28 06:55:43 PDT
(In reply to seb128 from comment #12)
> The issue also got reported on launchpad for the incoming Ubuntu
> https://bugs.launchpad.net/webkit/+bug/1966418
> 
> It is only an issue under wayland, login into an x11 session makes things
> work again

You have different/additional information in that downstream bug. I'm not convinced that it's the same as this issue. In your downstream bug, you are seeing:

EGLDisplay Initialization failed: EGL_NOT_INITIALIZED
Cannot create EGL context: invalid display (last error: EGL_SUCCESS)

But Adrian has not reported this error. Adrian, do you see that anywhere? If not, we'll need a separate bug report for them.
Comment 15 Adrian Vovk 2022-03-28 09:28:17 PDT
I don't compile WebKit w/ X11 support so I can't tell you if running epiphany w/ GDK_BACKEND=x11 helps anything

---

I do not see those EGL errors when I run epiphany on the host. However, if I run the Epiphany flatpak with FLATPAK_GL_DRIVERS=host, I get

EGLDisplay Initialization failed: EGL_BAD_PARAMETER
Cannot create EGL context: invalid display (last error: EGL_SUCCESS)

but the webviews still show up (they're just sluggish). When running with FLATPAK_GL_DRIVERS=host, the epiphany flatpak starts crashing when opening about:gpu

---

Downgrading to Mesa 21.3.8 on the host does not solve the issue for me. Not sure what's going on here, because Epiphany from Flathub (using Mesa 21.3.8, WebKitGTK 2.36.0) works perfectly fine in my environment
Comment 16 Adrian Vovk 2022-03-28 14:44:22 PDT
OK I found a way to fix it @ package time! I previously built webkitgtk with -DENABLE_X11_TARGET=OFF. I tried building with -DENABLE_X11_TARGET=ON (since this is the major difference between my build and the gnome-build-meta build, aside from Mesa version), and now it works properly

Seems like disabling the x11 backend also accidentally disables parts of the Wayland backend somewhere
Comment 17 Michael Catanzaro 2022-03-28 14:48:45 PDT
OK, then for sure this bug is not the problem that Ubuntu users are seeing. Hi Ubuntu, please file a separate bug. Thanks!
Comment 18 Carlos Garcia Campos 2022-03-29 00:53:50 PDT
If works with x11 enabled, that's probably because we messed it up with the gl platform includes in the gl detection patches.
Comment 19 Jim Mason 2022-04-03 06:51:43 PDT
Could also be related to Bug 236438.

Are you using NVIDIA drivers?
Comment 20 Adrian Vovk 2022-04-03 09:00:54 PDT
No, I'm using an Intel iGPU. I've provided the Mesa version & GL renderer string earlier in this thread
Comment 21 Adrian Vovk 2022-04-03 09:03:41 PDT
Though, looking at that bug you linked, may be the issue because I experienced this bug when I compiled out support for GLX
Comment 22 Haelwenn (lanodan) Monnier 2022-04-22 20:39:13 PDT
Created attachment 458196 [details]
Full backtrace of running MiniBrowser webkit://gpu

Hi,

It looks like I got the same issue here, seems also related to WebKit w/o X11 as on a similar setup with X11 present it works fine. I'm also dbus-less on both so no xdg-desktop-portal.

And the bug isn't present with rollbacking to WebKit 2.34.6, which is I what I did at first. Passing WEBKIT_DISABLE_COMPOSITING_MODE=1 also fixes it.

In case it helps, also attached the backtrace of going to webkit://gpu

CPU+GPU: AMD Ryzen 5 PRO 3500U
Mesa: 22.0.1
Distro: Gentoo
Comment 23 Michael Catanzaro 2022-04-23 08:17:38 PDT
(In reply to Haelwenn (lanodan) Monnier from comment #22)
> Distro: Gentoo

Did you build with -DENABLE_WPE_RENDERER=OFF?
Comment 24 Haelwenn (lanodan) Monnier 2022-04-23 13:33:28 PDT
(In reply to Michael Catanzaro from comment #23)
> (In reply to Haelwenn (lanodan) Monnier from comment #22)
> > Distro: Gentoo
> 
> Did you build with -DENABLE_WPE_RENDERER=OFF?

Nah, it's ON, WPE is actually one of the first things that I checked as being present and up-to-date.

Build recipe that I use is https://hacktivis.me/git/overlay/file/net-libs/webkit-gtk/webkit-gtk-2.36.1-r100.ebuild.html and it's built with USE="avif egl examples gamepad gstreamer introspection jpeg2k jumbo-build (seccomp) spell wayland -X (-aqua) -debug -geolocation -gles2-only -gnome-keyring (-gtk-doc) -lcms -libnotify -systemd -test"
Comment 25 Adrian Perez 2022-05-30 14:34:31 PDT
There is a decent chance that this issue was fixed by one of the
fixes that I backported for te 2.36.3 release, released a few days
ago: https://webkitgtk.org/2022/05/28/webkitgtk2.36.3-released.html

Would you mind trying to update to 2.36.3?
Comment 26 Adrian Vovk 2022-06-02 18:43:58 PDT
I tried setting my build back to `-DENABLE_X11_TARGET=OFF` and updating to 2.36.3. Unfortunately, it looks like the issue isn't fixed...
Comment 27 Haelwenn (lanodan) Monnier 2023-04-03 04:18:48 PDT
This seems to be fixed in 2.40.0, at least I no longer need the WEBKIT_DISABLE_COMPOSITING_MODE=1 workaround.
Comment 28 Michael Catanzaro 2023-04-03 06:08:30 PDT
Adrian, any luck? Notably, 2.40 no longer uses GLX.
Comment 29 Adrian Vovk 2023-04-27 16:41:11 PDT
I gave it a test (gtk4 build of 2.40) and it seems to work when I disable the X11 backend. Thanks!
Comment 30 Adrian Perez 2023-04-28 01:01:12 PDT
Great, thanks both to Adrian and Haelwenn for confirming 2.40.x is
working well for you =)