<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>260856</bug_id>
          
          <creation_ts>2023-08-29 06:42:43 -0700</creation_ts>
          <short_desc>[GTK] Another crash when terminating EGL displays in exit handler: &quot;Couldn&apos;t find current GLX or EGL context.&quot;</short_desc>
          <delta_ts>2026-01-05 07:20:25 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKitGTK</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugzilla.redhat.com/show_bug.cgi?id=2235574</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=274389</see_also>
    
    <see_also>https://bugzilla.redhat.com/show_bug.cgi?id=2332507</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=279368</see_also>
    
    <see_also>https://bugzilla.redhat.com/show_bug.cgi?id=2379857</see_also>
    
    <see_also>https://bugzilla.redhat.com/show_bug.cgi?id=2325254</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=298025</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=303336</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Catanzaro">mcatanzaro</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>braden</cc>
    
    <cc>bugs-noreply</cc>
    
    <cc>mcatanzaro</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1974190</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2023-08-29 06:42:43 -0700</bug_when>
    <thetext>Here&apos;s one more entry in our history of crashes when trying to destroy EGL displays in our exit handler:

#0  __pthread_kill_implementation (threadid=&lt;optimized out&gt;, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
        tid = &lt;optimized out&gt;
        ret = 0
        pd = &lt;optimized out&gt;
        old_mask = {__val = {140735778634240}}
        ret = &lt;optimized out&gt;
#1  0x00007fcc462b08b3 in __pthread_kill_internal (signo=6, threadid=&lt;optimized out&gt;) at pthread_kill.c:78
No locals.
#2  0x00007fcc4625fabe in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
        ret = &lt;optimized out&gt;
#3  0x00007fcc4624887f in __GI_abort () at abort.c:79
        save_stage = 1
        act = {__sigaction_handler = {sa_handler = 0x20, sa_sigaction = 0x20}, sa_mask = {__val = {872, 94670570367024, 94670570367024, 110, 1, 0, 2871196877827735040, 8589934592, 18446744073709551456, 2, 94670570367008, 872, 140515387250512, 140735778634464, 140515327341006, 140515328620192}}, sa_flags = 1178547808, sa_restorer = 0x7fff9a17bae0}
#4  0x00007fcc4624879b in __assert_fail_base (fmt=0x7fcc463c4a98 &quot;%s%s%s:%u: %s%sAssertion `%s&apos; failed.\n%n&quot;, assertion=assertion@entry=0x7fcc49be1750 &quot;0 &amp;&amp; \&quot;Couldn&apos;t find current GLX or EGL context.\\n\&quot;&quot;, file=file@entry=0x7fcc49be1841 &quot;../src/dispatch_common.c&quot;, line=line@entry=872, function=function@entry=0x7fcc49be1ca0 &lt;__PRETTY_FUNCTION__.0.lto_priv.0&gt; &quot;epoxy_get_proc_address&quot;) at assert.c:92
        str = 0x561a35b7a830 &quot;\252\313-T\037V&quot;
        total = 4096
#5  0x00007fcc46258147 in __assert_fail (assertion=assertion@entry=0x7fcc49be1750 &quot;0 &amp;&amp; \&quot;Couldn&apos;t find current GLX or EGL context.\\n\&quot;&quot;, file=file@entry=0x7fcc49be1841 &quot;../src/dispatch_common.c&quot;, line=line@entry=872, function=function@entry=0x7fcc49be1ca0 &lt;__PRETTY_FUNCTION__.0.lto_priv.0&gt; &quot;epoxy_get_proc_address&quot;) at assert.c:101
No locals.
#6  0x00007fcc49bbde4b in epoxy_get_proc_address (name=0x7fcc49bc605d &lt;entrypoint_strings.lto_priv+1405&gt; &quot;glBindFramebuffer&quot;) at ../src/dispatch_common.c:872
        egl_api = &lt;optimized out&gt;
        __PRETTY_FUNCTION__ = &quot;epoxy_get_proc_address&quot;
#7  0x00007fcc49b6606a in epoxy_glBindFramebuffer_resolver () at src/gl_generated_dispatch.c:76680
        providers = &lt;optimized out&gt;
        entrypoints = &lt;optimized out&gt;
#8  epoxy_glBindFramebuffer_global_rewrite_ptr (target=36160, framebuffer=0) at src/gl_generated_dispatch.c:49049
No locals.
#9  0x00007fcc4824fe2b in WebCore::GLContextEGL::~GLContextEGL (this=&lt;optimized out&gt;, this=&lt;optimized out&gt;) at /usr/src/debug/webkitgtk-2.40.5-1.fc38.x86_64/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp:442
        display = 0x561a35a3a8b0
        display = &lt;optimized out&gt;
#10 0x00007fcc48250055 in WebCore::GLContextEGL::~GLContextEGL (this=&lt;optimized out&gt;, this=&lt;optimized out&gt;) at /usr/src/debug/webkitgtk-2.40.5-1.fc38.x86_64/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp:456
No locals.
#11 0x00007fcc482352ff in std::default_delete&lt;WebCore::GLContext&gt;::operator() (__ptr=&lt;optimized out&gt;, this=&lt;optimized out&gt;, this=&lt;optimized out&gt;, __ptr=&lt;optimized out&gt;) at /usr/include/c++/13/bits/unique_ptr.h:93
No locals.
#12 std::__uniq_ptr_impl&lt;WebCore::GLContext, std::default_delete&lt;WebCore::GLContext&gt; &gt;::reset (__p=&lt;optimized out&gt;, this=&lt;optimized out&gt;, this=&lt;optimized out&gt;, __p=&lt;optimized out&gt;) at /usr/include/c++/13/bits/unique_ptr.h:211
        __old_p = &lt;optimized out&gt;
        __old_p = &lt;optimized out&gt;
#13 std::unique_ptr&lt;WebCore::GLContext, std::default_delete&lt;WebCore::GLContext&gt; &gt;::reset (__p=&lt;optimized out&gt;, this=&lt;optimized out&gt;, this=&lt;optimized out&gt;, __p=&lt;optimized out&gt;) at /usr/include/c++/13/bits/unique_ptr.h:509
No locals.
#14 std::unique_ptr&lt;WebCore::GLContext, std::default_delete&lt;WebCore::GLContext&gt; &gt;::operator=(decltype(nullptr)) (this=&lt;optimized out&gt;, this=&lt;optimized out&gt;) at /usr/include/c++/13/bits/unique_ptr.h:442
No locals.
#15 WebCore::PlatformDisplay::clearSharingGLContext (this=0x7fcc0e004180) at /usr/src/debug/webkitgtk-2.40.5-1.fc38.x86_64/Source/WebCore/platform/graphics/PlatformDisplay.cpp:224
No locals.
#16 WebCore::PlatformDisplay::terminateEGLDisplay (this=this@entry=0x7fcc0e004180) at /usr/src/debug/webkitgtk-2.40.5-1.fc38.x86_64/Source/WebCore/platform/graphics/PlatformDisplay.cpp:325
No locals.
#17 0x00007fcc48235438 in operator() (__closure=0x0) at /usr/src/debug/webkitgtk-2.40.5-1.fc38.x86_64/Source/WebCore/platform/graphics/PlatformDisplay.cpp:312
        display = 0x7fcc0e004180
#18 _FUN () at /usr/src/debug/webkitgtk-2.40.5-1.fc38.x86_64/Source/WebCore/platform/graphics/PlatformDisplay.cpp:314
No locals.
#19 0x00007fcc462621a6 in __run_exit_handlers (status=0, listp=&lt;optimized out&gt;, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:111
        atfct = &lt;optimized out&gt;
        onfct = &lt;optimized out&gt;
        cxafct = &lt;optimized out&gt;
        arg = &lt;optimized out&gt;
        f = &lt;optimized out&gt;
        new_exitfn_called = 2464
        cur = 0x561a35a03840
        restart = &lt;optimized out&gt;
#20 0x00007fcc462622ee in __GI_exit (status=&lt;optimized out&gt;) at exit.c:141
No locals.
#21 0x00007fcc46f05a55 in WebKit::failedToGetNetworkProcessConnection () at /usr/src/debug/webkitgtk-2.40.5-1.fc38.x86_64/Source/WebKit/WebProcess/WebProcess.cpp:1162
No locals.

See downstream bug https://bugzilla.redhat.com/show_bug.cgi?id=2235574 for the full backtrace.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2081920</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2024-12-15 18:13:35 -0800</bug_when>
    <thetext>Still broken in 2.46.4</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2131123</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2025-07-18 06:38:23 -0700</bug_when>
    <thetext>We&apos;ve also received two bug reports where instead of crashing, it deadlocks in WebCore::PlatformDisplay::invalidateSkiaGLContexts. My opinion hasn&apos;t changed here: we&apos;re not going to get this to work safely and should just stop trying to call terminateEGLDisplay.

#14 0x00007f9bff3bdb5a in WTF::BinarySemaphore::wait (this=0x7ffe626b7e1d) at WTF/Headers/wtf/threads/BinarySemaphore.h:51
#15 WebCore::SkiaGLContext::invalidate (this=0x7f9bd160c870) at /usr/src/debug/webkitgtk-2.46.3-1.fc41.x86_64/Source/WebCore/platform/graphics/skia/PlatformDisplaySkia.cpp:140
        semaphore = {m_isSet = false, m_lock = {static isHeldBit = 1 &apos;\001&apos;, static hasParkedBit = 2 &apos;\002&apos;, m_byte = {value = std::atomic&lt;unsigned char&gt; = { 0 &apos;\000&apos; }}}, m_condition = {m_hasWaiters = {value = std::atomic&lt;bool&gt; = { true }}}}
#16 0x00007f9bff3ba599 in WebCore::PlatformDisplay::invalidateSkiaGLContexts()::$_0::operator()&lt;WebCore::SkiaGLContext&gt;(WebCore::SkiaGLContext&amp;) const (context=..., this=&lt;optimized out&gt;) at /usr/src/debug/webkitgtk-2.46.3-1.fc41.x86_64/Source/WebCore/platform/graphics/skia/PlatformDisplaySkia.cpp:221
#17 WTF::ThreadSafeWeakHashSet&lt;WebCore::SkiaGLContext&gt;::forEach&lt;WebCore::PlatformDisplay::invalidateSkiaGLContexts()::$_0&gt;(WebCore::PlatformDisplay::invalidateSkiaGLContexts()::$_0 const&amp;) const (this=0x7ffe626b7e78, callback=&lt;optimized out&gt;) at WTF/Headers/wtf/ThreadSafeWeakHashSet.h:184
        item = @0x7f9b4a14c0f0: {static isRef = &lt;optimized out&gt;, m_ptr = 0x7f9bd160c870}
        __range3 = @0x7ffe626b7e68: {&lt;WTF::VectorBuffer&lt;WTF::Ref&lt;WebCore::SkiaGLContext, WTF::RawPtrTraits&lt;WebCore::SkiaGLContext&gt;, WTF::DefaultRefDerefTraits&lt;WebCore::SkiaGLContext&gt; &gt;, 0ul, WTF::FastMalloc&gt;&gt; = {&lt;WTF::VectorBufferBase&lt;WTF::Ref&lt;WebCore::SkiaGLContext, WTF::RawPtrTraits&lt;WebCore::SkiaGLContext&gt;, WTF::DefaultRefDerefTraits&lt;WebCore::SkiaGLContext&gt; &gt;, WTF::FastMalloc&gt;&gt; = {m_buffer = 0x7f9b4a14c0f0, m_capacity = 1, m_size = 1}, &lt;No data fields&gt;}, &lt;No data fields&gt;}
        __begin0 = 0x7f9b4a14c0f0
        __end0 = &lt;optimized out&gt;
        __range3 = &lt;optimized out&gt;
        __begin0 = &lt;optimized out&gt;
        __end0 = &lt;optimized out&gt;
        item = &lt;optimized out&gt;
#18 WebCore::PlatformDisplay::invalidateSkiaGLContexts (this=&lt;optimized out&gt;) at /usr/src/debug/webkitgtk-2.46.3-1.fc41.x86_64/Source/WebCore/platform/graphics/skia/PlatformDisplaySkia.cpp:220
        contexts = {m_map = {m_impl = {static smallMaxLoadNumerator = 3, static smallMaxLoadDenominator = 4, static largeMaxLoadNumerator = 1, static largeMaxLoadDenominator = 2, static maxSmallTableCapacity = 1024, static minLoad = 6, static tableSizeOffset = -1, static tableSizeMaskOffset = -2, static keyCountOffset = -3, static deletedCountOffset = -4, static metadataSize = 16, {m_table = 0x7f9bd10193b0, m_tableForLLDB = 0x7f9bd10193b0}}}, m_operationCountSinceLastCleanup = 0, m_maxOperationCountWithoutCleanup = 2, m_lock = {static isHeldBit = 1 &apos;\001&apos;, static hasParkedBit = 2 &apos;\002&apos;, m_byte = {value = std::atomic&lt;unsigned char&gt; = { 0 &apos;\000&apos; }}}}
#19 0x00007f9bff3018fc in WebCore::PlatformDisplay::clearSharingGLContext (this=0x7f9bd1008900) at /usr/src/debug/webkitgtk-2.46.3-1.fc41.x86_64/Source/WebCore/platform/graphics/PlatformDisplay.cpp:129
#20 WebCore::PlatformDisplay::terminateEGLDisplay (this=0x7f9bd1008900) at /usr/src/debug/webkitgtk-2.46.3-1.fc41.x86_64/Source/WebCore/platform/graphics/PlatformDisplay.cpp:160
#21 WebCore::PlatformDisplay::PlatformDisplay(std::unique_ptr&lt;WebCore::GLDisplay, std::default_delete&lt;WebCore::GLDisplay&gt; &gt;&amp;&amp;)::$_0::operator()() const (this=&lt;optimized out&gt;) at /usr/src/debug/webkitgtk-2.46.3-1.fc41.x86_64/Source/WebCore/platform/graphics/PlatformDisplay.cpp:106
        display = 0x7f9bd1008900
        display = &lt;optimized out&gt;
#22 WebCore::PlatformDisplay::PlatformDisplay(std::unique_ptr&lt;WebCore::GLDisplay, std::default_delete&lt;WebCore::GLDisplay&gt; &gt;&amp;&amp;)::$_0::__invoke() () at /usr/src/debug/webkitgtk-2.46.3-1.fc41.x86_64/Source/WebCore/platform/graphics/PlatformDisplay.cpp:103
#23 0x00007f9bfcc2a461 in __run_exit_handlers (status=0, listp=0x7f9bfcdf6680 &lt;__exit_funcs&gt;, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
        atfct = &lt;optimized out&gt;
        onfct = &lt;optimized out&gt;
        cxafct = &lt;optimized out&gt;
        arg = &lt;optimized out&gt;
        f = &lt;optimized out&gt;
        new_exitfn_called = 2475
        cur = 0x55748bde5750
        restart = &lt;optimized out&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2139672</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2025-08-29 07:38:50 -0700</bug_when>
    <thetext>Carlos said this might be fixed by https://github.com/WebKit/WebKit/pull/50002 but I guess we are not confident of this, so I&apos;ll leave this bug open.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2169285</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2026-01-05 07:20:25 -0800</bug_when>
    <thetext>Let&apos;s assume this is fixed, unless somebody hits it again.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>