Bug 228953

Summary: [GTK][Wayland] wlExternalApiLock: Assertion `!"failed to lock pthread mutex"' failed
Product: WebKit Reporter: Makoto Kato <m_kato>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED MOVED    
Severity: Normal CC: bugs-noreply, mcatanzaro
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Linux   

Description Makoto Kato 2021-08-10 07:21:40 PDT
This is copy of https://gitlab.gnome.org/GNOME/epiphany/-/issues/1575

Epiphany is 3.38.2 and NVIDIA driver is 470.57.02.
When using wayland + NVIDIA proprietary driver, epiphany won't be always started on my Debian/sid env by the following SIGABRT.


[Detaching after fork from child process 1115599]
epiphany: ../src/wayland-thread.c:87: wlExternalApiLock: Assertion `!"failed to lock pthread mutex"' failed.

Thread 1 "epiphany" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff7023537 in __GI_abort () at abort.c:79
#2  0x00007ffff702340f in __assert_fail_base
    (fmt=0x7ffff718c128 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x7fffe663d1e0 "!\"failed to lock pthread mutex\"", file=0x7fffe663d0c2 "../src/wayland-thread.c", line=87, function=<optimized out>) at assert.c:92
#3  0x00007ffff7032662 in __GI___assert_fail
    (assertion=0x7fffe663d1e0 "!\"failed to lock pthread mutex\"", file=0x7fffe663d0c2 "../src/wayland-thread.c", line=87, function=0x7fffe663d270 "wlExternalApiLock") at assert.c:101
#4  0x00007fffe6637719 in  () at /lib/x86_64-linux-gnu/libnvidia-egl-wayland.so.1
#5  0x00007fffe663c1a7 in  () at /lib/x86_64-linux-gnu/libnvidia-egl-wayland.so.1
#6  0x00007fffe495ead5 in  () at /lib/x86_64-linux-gnu/libEGL_nvidia.so.0
#7  0x00007fffe49005ed in  () at /lib/x86_64-linux-gnu/libEGL_nvidia.so.0
#8  0x00007fffe66393a2 in  () at /lib/x86_64-linux-gnu/libnvidia-egl-wayland.so.1
#9  0x00007fffe6637ee1 in  () at /lib/x86_64-linux-gnu/libnvidia-egl-wayland.so.1
#10 0x00007fffe4963ed9 in  () at /lib/x86_64-linux-gnu/libEGL_nvidia.so.0
#11 0x00007fffe4903a0a in  () at /lib/x86_64-linux-gnu/libEGL_nvidia.so.0
#12 0x00007ffff0768718 in WS::ImplEGL::initialize(void*) (this=0x55555584d800, eglDisplay=0x5555558de490) at ../src/ws-egl.cpp:140
#13 0x00007ffff3eac3c8 in tryInitializeEGL () at ../Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:111
#14 WebKit::AcceleratedBackingStoreWayland::checkRequirements() () at ../Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:155
#15 0x00007ffff3eb64db in WebKit::HardwareAccelerationManager::HardwareAccelerationManager() ()
    at ../Source/WebKit/UIProcess/gtk/HardwareAccelerationManager.cpp:60
#16 0x00007ffff3eb655c in WTF::NeverDestroyed<WebKit::HardwareAccelerationManager, WTF::AnyThreadsAccessTraits>::NeverDestroyed<>() ()
    at DerivedSources/ForwardingHeaders/wtf/NeverDestroyed.h:67
#17 WebKit::HardwareAccelerationManager::singleton() () at ../Source/WebKit/UIProcess/gtk/HardwareAccelerationManager.cpp:36
#18 0x00007ffff3ebabb9 in WebKit::WebPreferences::platformInitializeStore() () at ../Source/WebKit/UIProcess/gtk/WebPreferencesGtk.cpp:42
#19 0x00007ffff3d70292 in WebKit::WebPreferences::create(WTF::String const&, WTF::String const&, WTF::String const&) ()
    at ../Source/WebKit/UIProcess/WebPreferences.cpp:45
#20 0x00007ffff3d7077f in WebKit::WebPreferences::createWithLegacyDefaults(WTF::String const&, WTF::String const&, WTF::String const&) ()
    at ../Source/WebKit/UIProcess/WebPreferences.cpp:50
#21 0x00007ffff3d50149 in WebKit::WebPageGroup::WebPageGroup(WTF::String const&) () at ../Source/WebKit/UIProcess/WebPageGroup.cpp:85
#22 0x00007ffff3d503e2 in WebKit::WebPageGroup::create(WTF::String const&) () at ../Source/WebKit/UIProcess/WebPageGroup.cpp:59
#23 0x00007ffff3d89109 in WebKit::WebProcessPool::WebProcessPool(API::ProcessPoolConfiguration&) ()
    at ../Source/WebKit/UIProcess/WebProcessPool.cpp:275
#24 0x00007ffff3d89927 in WebKit::WebProcessPool::create(API::ProcessPoolConfiguration&) () at ../Source/WebKit/UIProcess/WebProcessPool.cpp:196
#25 0x00007ffff3e07879 in webkitWebContextConstructed() () at ../Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp:404
#26 0x00007ffff74bb6f7 in  () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#27 0x00007ffff74bd264 in g_object_new_valist () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#28 0x00007ffff74bd5c9 in g_object_new () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#29 0x00007ffff7f7221a in  () at /usr/lib/x86_64-linux-gnu/epiphany-browser/libephymain.so
#30 0x00007ffff74bb6f7 in  () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#31 0x00007ffff74bd264 in g_object_new_valist () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#32 0x00007ffff74bd5c9 in g_object_new () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#33 0x00007ffff7f4ba82 in _ephy_shell_create_instance () at /usr/lib/x86_64-linux-gnu/epiphany-browser/libephymain.so
#34 0x0000555555558af6 in  ()
Comment 1 Michael Catanzaro 2021-08-10 08:02:53 PDT
> /lib/x86_64-linux-gnu/libnvidia-egl-wayland.so.1

It seems this library is open source. Can you install debug symbols for it and take the backtrace again, please?

Upstream seems to be https://github.com/NVIDIA/egl-wayland/issues so we might need to report it there.
Comment 2 Michael Catanzaro 2021-08-10 08:28:34 PDT
Looks very similar to https://bugzilla.redhat.com/show_bug.cgi?id=1842473 aka https://github.com/NVIDIA/egl-wayland/issues/27, but that one is supposedly already fixed.
Comment 3 Makoto Kato 2021-08-10 16:17:46 PDT
Adding libnvidia-egl-wayland dbgsym.

[Detaching after fork from child process 1309697]
epiphany: ../src/wayland-thread.c:87: wlExternalApiLock: Assertion `!"failed to lock pthread mutex"' failed.

Thread 1 "epiphany" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff7023537 in __GI_abort () at abort.c:79
#2  0x00007ffff702340f in __assert_fail_base (fmt=0x7ffff718c128 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x7fffe663d1e0 "!\"failed to lock pthread mutex\"", file=0x7fffe663d0c2 "../src/wayland-thread.c", line=87, function=<optimized out>) at assert.c:92
#3  0x00007ffff7032662 in __GI___assert_fail
    (assertion=assertion@entry=0x7fffe663d1e0 "!\"failed to lock pthread mutex\"", file=file@entry=0x7fffe663d0c2 "../src/wayland-thread.c", line=line@entry=87, function=function@entry=0x7fffe663d270 <__PRETTY_FUNCTION__.2> "wlExternalApiLock") at assert.c:101
#4  0x00007fffe6637719 in wlExternalApiLock () at ../src/wayland-thread.c:87
#5  0x00007fffe663c1a7 in wlEglGetInternalHandleExport (dpy=0x555555981b90, type=13233, handle=0x555555981b90) at ../src/wayland-eglhandle.c:146
#6  0x00007fffe495ead5 in  () at /lib/x86_64-linux-gnu/libEGL_nvidia.so.0
#7  0x00007fffe49005ed in  () at /lib/x86_64-linux-gnu/libEGL_nvidia.so.0
#8  0x00007fffe66393a2 in wl_eglstream_display_bind (data=data@entry=0x5555557efbe0, wlDisplay=wlDisplay@entry=0x5555557cb320, eglDisplay=eglDisplay@entry=0x555555981b90) at ../src/wayland-eglstream-server.c:311
#9  0x00007fffe6637ee1 in wlEglBindDisplaysHook (data=0x5555557efbe0, dpy=0x555555981b90, nativeDpy=0x5555557cb320) at ../src/wayland-egldisplay.c:87
#10 0x00007fffe4963ed9 in  () at /lib/x86_64-linux-gnu/libEGL_nvidia.so.0
#11 0x00007fffe4903a0a in  () at /lib/x86_64-linux-gnu/libEGL_nvidia.so.0
#12 0x00007ffff0768718 in WS::ImplEGL::initialize(void*) (this=0x5555558d7b60, eglDisplay=0x555555981b90) at ../src/ws-egl.cpp:140
#13 0x00007ffff3eac3c8 in tryInitializeEGL () at ../Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:111
#14 WebKit::AcceleratedBackingStoreWayland::checkRequirements() () at ../Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:155
#15 0x00007ffff3eb64db in WebKit::HardwareAccelerationManager::HardwareAccelerationManager() () at ../Source/WebKit/UIProcess/gtk/HardwareAccelerationManager.cpp:60
#16 0x00007ffff3eb655c in WTF::NeverDestroyed<WebKit::HardwareAccelerationManager, WTF::AnyThreadsAccessTraits>::NeverDestroyed<>() () at DerivedSources/ForwardingHeaders/wtf/NeverDestroyed.h:67
#17 WebKit::HardwareAccelerationManager::singleton() () at ../Source/WebKit/UIProcess/gtk/HardwareAccelerationManager.cpp:36
#18 0x00007ffff3ebabb9 in WebKit::WebPreferences::platformInitializeStore() () at ../Source/WebKit/UIProcess/gtk/WebPreferencesGtk.cpp:42
#19 0x00007ffff3d70292 in WebKit::WebPreferences::create(WTF::String const&, WTF::String const&, WTF::String const&) () at ../Source/WebKit/UIProcess/WebPreferences.cpp:45
#20 0x00007ffff3d7077f in WebKit::WebPreferences::createWithLegacyDefaults(WTF::String const&, WTF::String const&, WTF::String const&) () at ../Source/WebKit/UIProcess/WebPreferences.cpp:50
#21 0x00007ffff3d50149 in WebKit::WebPageGroup::WebPageGroup(WTF::String const&) () at ../Source/WebKit/UIProcess/WebPageGroup.cpp:85
#22 0x00007ffff3d503e2 in WebKit::WebPageGroup::create(WTF::String const&) () at ../Source/WebKit/UIProcess/WebPageGroup.cpp:59
#23 0x00007ffff3d89109 in WebKit::WebProcessPool::WebProcessPool(API::ProcessPoolConfiguration&) () at ../Source/WebKit/UIProcess/WebProcessPool.cpp:275
#24 0x00007ffff3d89927 in WebKit::WebProcessPool::create(API::ProcessPoolConfiguration&) () at ../Source/WebKit/UIProcess/WebProcessPool.cpp:196
#25 0x00007ffff3e07879 in webkitWebContextConstructed() () at ../Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp:404
#26 0x00007ffff74bb6f7 in  () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#27 0x00007ffff74bd264 in g_object_new_valist () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#28 0x00007ffff74bd5c9 in g_object_new () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#29 0x00007ffff7f7221a in  () at /usr/lib/x86_64-linux-gnu/epiphany-browser/libephymain.so
#30 0x00007ffff74bb6f7 in  () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#31 0x00007ffff74bd264 in g_object_new_valist () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#32 0x00007ffff74bd5c9 in g_object_new () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#33 0x00007ffff7f4ba82 in _ephy_shell_create_instance () at /usr/lib/x86_64-linux-gnu/epiphany-browser/libephymain.so
#34 0x0000555555558af6 in  ()
#35 0x00007ffff7024d0a in __libc_start_main (main=0x555555558570, argc=1, argv=0x7fffffffe168, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe158) at ../csu/libc-start.c:308
#36 0x0000555555558eda in  ()
Comment 4 Makoto Kato 2021-08-10 16:23:54 PDT
Ah, this may be https://github.com/NVIDIA/egl-wayland/commit/9558ec02d0f7bbf30dc1f9ee4c0b06c9b0c49afe. My libnvidia-egl-wayland is 1.1.5
Comment 5 Michael Catanzaro 2021-08-11 06:43:41 PDT
(In reply to Makoto Kato from comment #4)
> Ah, this may be
> https://github.com/NVIDIA/egl-wayland/commit/
> 9558ec02d0f7bbf30dc1f9ee4c0b06c9b0c49afe. My libnvidia-egl-wayland is 1.1.5

OK, it looks pretty similar indeed. Would be curious to know if this is fixed when you get 1.1.6/1.1.7.