[Webkit-unassigned] [Bug 274261] New: [GTK] Excessive CPU usage from cached web process after closing nbcnews.com page, failure to display web content after reopening page
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu May 16 08:25:51 PDT 2024
https://bugs.webkit.org/show_bug.cgi?id=274261
Bug ID: 274261
Summary: [GTK] Excessive CPU usage from cached web process
after closing nbcnews.com page, failure to display web
content after reopening page
Product: WebKit
Version: WebKit Nightly Build
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: WebKitGTK
Assignee: webkit-unassigned at lists.webkit.org
Reporter: mcatanzaro at redhat.com
CC: bugs-noreply at webkitgtk.org
Reproducer: visit https://www.nbcnews.com/nbc-out/out-news/florida-teen-says-was-denied-entry-prom-wearing-suit-rcna152440 in Epiphany Tech Preview with WebKitGTK 2.45.2. Close the page. When the page is closed, the associated web process keeps running (because it enters the web process cache) and begins excessively churning CPU, which is terrible for the user's battery life. If I then reload the same page in a different web view, WebKit is unable to render anything because the cached web process is out of control. I only noticed because my system fans start running at a higher speed when this happens.
(Cached web processes are supposed to be suspended, but this has never actually worked, bug #262794. It's also not really relevant, because even if the process was properly suspended and then resumed, that would surely only defer this bug such that it doesn't occur until the page is reopened.)
I tried taking a few backtraces of the out-of-control web process. Unfortunately most of them point to polling in the main context, which is not useful. But here are some that show the web process doing basically random web process stuff:
(gdb) bt
#0 0x00007f6676f3747e in WebCore::HTMLMediaElement::mediaPlayerReadyStateChanged() () from target:/usr/lib/x86_64-linux-gnu/libwebkitgtk-6.0.so.4
#1 0x00007f6676d0fbaf in WebCore::EventLoop::run(std::optional<WTF::ApproximateTime>) () from target:/usr/lib/x86_64-linux-gnu/libwebkitgtk-6.0.so.4
#2 0x00007f6676db2a0c in WebCore::WindowEventLoop::didReachTimeToRun() () from target:/usr/lib/x86_64-linux-gnu/libwebkitgtk-6.0.so.4
#3 0x00007f6677483e4f in WebCore::ThreadTimers::sharedTimerFiredInternal() () from target:/usr/lib/x86_64-linux-gnu/libwebkitgtk-6.0.so.4
#4 0x00007f66743f6b75 in WTF::RunLoop::TimerBase::TimerBase(WTF::RunLoop&)::$_0::__invoke(void*) ()
from target:/usr/lib/x86_64-linux-gnu/libjavascriptcoregtk-6.0.so.1
#5 0x00007f66743f5c31 in WTF::RunLoop::$_0::__invoke(_GSource*, int (*)(void*), void*) ()
from target:/usr/lib/x86_64-linux-gnu/libjavascriptcoregtk-6.0.so.1
#6 0x00007f667080f767 in g_main_dispatch () from target:/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#7 0x00007f6670811907 in g_main_context_iterate_unlocked.isra () from target:/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#8 0x00007f66708123a7 in g_main_loop_run () from target:/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#9 0x00007f66743f6211 in WTF::RunLoop::run() () from target:/usr/lib/x86_64-linux-gnu/libjavascriptcoregtk-6.0.so.1
#10 0x00007f6675bbae47 in int WebKit::AuxiliaryProcessMain<WebKit::WebProcessMainGtk>(int, char**) ()
from target:/usr/lib/x86_64-linux-gnu/libwebkitgtk-6.0.so.4
#11 0x00007f6674c3b08a in __libc_start_call_main () from target:/usr/lib/x86_64-linux-gnu/libc.so.6
#12 0x00007f6674c3b14b in __libc_start_main () from target:/usr/lib/x86_64-linux-gnu/libc.so.6
#13 0x000055c267573085 in _start ()
Why is HTMLMediaElement doing anything when there is no web view? It shouldn't even possible for an HTMLMediaElement to still exist because surely the WebPage object should have been destroyed. There shouldn't be any DOM left. Maybe it's been leaked? I got multiple backtraces that look like this, so this was
(gdb) bt
#0 0x00007f2f16db5bf8 in WTF::Detail::CallableWrapper<WebCore::WindowEventLoop::didReachTimeToRun()::$_0, bool, WebCore::ScriptExecutionContext&>::call(WebCore::ScriptExecutionContext&) () from target:/usr/lib/x86_64-linux-gnu/libwebkitgtk-6.0.so.4
#1 0x00007f2f16d10190 in WebCore::EventLoop::findMatchingAssociatedContext(WTF::Function<bool (WebCore::ScriptExecutionContext&)> const&) ()
from target:/usr/lib/x86_64-linux-gnu/libwebkitgtk-6.0.so.4
#2 0x00007f2f16db2a30 in WebCore::WindowEventLoop::didReachTimeToRun() () from target:/usr/lib/x86_64-linux-gnu/libwebkitgtk-6.0.so.4
#3 0x00007f2f17483e4f in WebCore::ThreadTimers::sharedTimerFiredInternal() () from target:/usr/lib/x86_64-linux-gnu/libwebkitgtk-6.0.so.4
#4 0x00007f2f145f6b75 in WTF::RunLoop::TimerBase::TimerBase(WTF::RunLoop&)::$_0::__invoke(void*) ()
from target:/usr/lib/x86_64-linux-gnu/libjavascriptcoregtk-6.0.so.1
#5 0x00007f2f145f5c31 in WTF::RunLoop::$_0::__invoke(_GSource*, int (*)(void*), void*) ()
from target:/usr/lib/x86_64-linux-gnu/libjavascriptcoregtk-6.0.so.1
#6 0x00007f2f10918767 in g_main_dispatch () from target:/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#7 0x00007f2f1091a907 in g_main_context_iterate_unlocked.isra () from target:/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#8 0x00007f2f1091b3a7 in g_main_loop_run () from target:/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#9 0x00007f2f145f6211 in WTF::RunLoop::run() () from target:/usr/lib/x86_64-linux-gnu/libjavascriptcoregtk-6.0.so.1
#10 0x00007f2f15bbae47 in int WebKit::AuxiliaryProcessMain<WebKit::WebProcessMainGtk>(int, char**) ()
from target:/usr/lib/x86_64-linux-gnu/libwebkitgtk-6.0.so.4
#11 0x00007f2f14c3b08a in __libc_start_call_main () from target:/usr/lib/x86_64-linux-gnu/libc.so.6
#12 0x00007f2f14c3b14b in __libc_start_main () from target:/usr/lib/x86_64-linux-gnu/libc.so.6
#13 0x000055f3a2709085 in _start ()
A timer is firing. It's probably about to run the HTMLMediaElement code? I also got a backtrace where it looks like the timer just finished firing.
(gdb) bt
#0 0x00007f2f16d82640 in void WebCore::SelectorDataList::execute<WebCore::Element*>(WebCore::ContainerNode&, WebCore::Element*&) const ()
from target:/usr/lib/x86_64-linux-gnu/libwebkitgtk-6.0.so.4
#1 0x00007f2f16d81ada in WebCore::SelectorDataList::queryFirst(WebCore::ContainerNode&) const ()
from target:/usr/lib/x86_64-linux-gnu/libwebkitgtk-6.0.so.4
#2 0x00007f2f16c73e82 in WebCore::ContainerNode::querySelector(WTF::String const&) () from target:/usr/lib/x86_64-linux-gnu/libwebkitgtk-6.0.so.4
#3 0x00007f2f15eff8e6 in WebCore::jsDocumentPrototypeFunction_querySelector(JSC::JSGlobalObject*, JSC::CallFrame*) ()
from target:/usr/lib/x86_64-linux-gnu/libwebkitgtk-6.0.so.4
#4 0x00007f2eabe0c038 in ?? ()
#5 0x00007ffe862e8130 in ?? ()
#6 0x00007f2eaca10314 in ?? ()
#7 0x0000000000000000 in ?? ()
This looks like the cached process is executing miscellaneous JavaScript code.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240516/066cfa09/attachment-0001.htm>
More information about the webkit-unassigned
mailing list