<?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>210561</bug_id>
          
          <creation_ts>2020-04-15 11:46:57 -0700</creation_ts>
          <short_desc>[GTK] excessive wakeups/polling due to gdk_frame_clock_begin_updating</short_desc>
          <delta_ts>2020-04-29 23:37:39 -0700</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>Other</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <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="Tomáš Janoušek">webkit</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>berto</cc>
    
    <cc>bugs-noreply</cc>
    
    <cc>calestyo</cc>
    
    <cc>cgarcia</cc>
    
    <cc>clopez</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>mcrha</cc>
    
    <cc>pnormand</cc>
    
    <cc>svillar</cc>
    
    <cc>zan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1641899</commentid>
    <comment_count>0</comment_count>
    <who name="Tomáš Janoušek">webkit</who>
    <bug_when>2020-04-15 11:46:57 -0700</bug_when>
    <thetext>Since upgrading to 2.28, /usr/lib/x86_64-linux-gnu/webkit2gtk-4.0/WebKitWebProcess drains my laptop battery like crazy:

$ ps axfu
[...]
tomi      243322 15.0  0.2 102683612 96224 ?     Sl   17:53   0:00 liferea
tomi      243332  4.7  0.2 102722076 90816 ?     SLl  17:53   0:00  \_ /usr/lib/x86_64-linux-gnu/webkit2gtk-4.0/WebKitWebProcess 7 19
tomi      243333  1.5  0.1 103007620 53204 ?     SLl  17:53   0:00  \_ /usr/lib/x86_64-linux-gnu/webkit2gtk-4.0/WebKitNetworkProcess 8 1

$ LANG=C strace -f -p 243332
strace: Process 243332 attached with 11 threads
[pid 243360] restart_syscall(&lt;... resuming interrupted read ...&gt; &lt;unfinished ...&gt;
[pid 243359] restart_syscall(&lt;... resuming interrupted read ...&gt; &lt;unfinished ...&gt;
[pid 243357] restart_syscall(&lt;... resuming interrupted read ...&gt; &lt;unfinished ...&gt;
[pid 243356] restart_syscall(&lt;... resuming interrupted read ...&gt; &lt;unfinished ...&gt;
[pid 243355] restart_syscall(&lt;... resuming interrupted read ...&gt; &lt;unfinished ...&gt;
[pid 243344] restart_syscall(&lt;... resuming interrupted read ...&gt; &lt;unfinished ...&gt;
[pid 243343] restart_syscall(&lt;... resuming interrupted read ...&gt; &lt;unfinished ...&gt;
[pid 243342] restart_syscall(&lt;... resuming interrupted read ...&gt; &lt;unfinished ...&gt;
[pid 243341] restart_syscall(&lt;... resuming interrupted read ...&gt; &lt;unfinished ...&gt;
[pid 243340] futex(0x7f14fb18c7cc, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt;
[pid 243332] restart_syscall(&lt;... resuming interrupted read ...&gt;) = 0
[pid 243332] recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
[pid 243332] poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}], 2, 17) = 0 (Timeout)
[pid 243332] recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
[pid 243332] poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}], 2, 16) = 0 (Timeout)
[pid 243332] recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
[pid 243332] poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}], 2, 16) = 0 (Timeout)
[pid 243332] recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
[pid 243332] poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}], 2, 16) = 0 (Timeout)
[pid 243332] recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
[pid 243332] poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}], 2, 15) = 0 (Timeout)
[pid 243332] recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
[pid 243332] poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}], 2, 16) = 0 (Timeout)
[pid 243332] recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
[pid 243332] poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}], 2, 16) = 0 (Timeout)

It&apos;s not necessary to run liferea, it&apos;s reproducible just by &quot;surf about:blank&quot;, so I tried to gdb the process to see what&apos;s going on. By breaking at ../../../glib/gmain.c:3677 and looking for small enough source_timeout, I found this:

(gdb) print *source
$8 = {callback_data = 0x562da2385070, callback_funcs = 0x7f4824f32280 &lt;g_source_callback_funcs&gt;, source_funcs =
    0x7f4824f32340 &lt;g_timeout_funcs&gt;, ref_count = 2, context = 0x562da20fa910, priority = 120, flags = 1, source_id = 29853,
  poll_fds = 0x0, prev = 0x0, next = 0x0, name = 0x562da243f320 &quot;[gtk+] gdk_frame_clock_paint_idle&quot;, priv = 0x562da239ead0}

So it seems something is calling gdk_frame_clock_begin_updating without a matching gdk_frame_clock_end_updating... Well, there&apos;s just one call to gdk_frame_clock_begin_updating in the entire webkit source and no call to gdk_frame_clock_end_updating so we just need to find why that&apos;s getting called:

Thread 2.1 &quot;WebKitWebProces&quot; hit Breakpoint 2, gdk_frame_clock_begin_updating (frame_clock=0x555abd120590 [GdkFrameClockIdle])
    at ../../../../gdk/gdkframeclock.c:319
(gdb) bt
#0  gdk_frame_clock_begin_updating (frame_clock=0x555abd120590 [GdkFrameClockIdle]) at ../../../../gdk/gdkframeclock.c:319
#1  0x00007f34a3b15e49 in WebCore::DisplayRefreshMonitorGtk::requestRefreshCallback() ()
    at ../Source/WebCore/platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp:67
#2  0x00007f34a39afa4a in WebCore::RenderingUpdateScheduler::scheduleTimedRenderingUpdate() ()
    at ../Source/WebCore/page/RenderingUpdateScheduler.cpp:59
#3  WebCore::RenderingUpdateScheduler::scheduleTimedRenderingUpdate() () at ../Source/WebCore/page/RenderingUpdateScheduler.cpp:45
#4  0x00007f34a3982129 in WTF::Function&lt;void (WebCore::Document&amp;)&gt;::operator()(WebCore::Document&amp;) const ()
    at DerivedSources/ForwardingHeaders/wtf/Function.h:84
#5  WebCore::Page::forEachDocument(WTF::Function&lt;void (WebCore::Document&amp;)&gt; const&amp;) const () at ../Source/WebCore/page/Page.cpp:2843
#6  0x00007f34a398225b in WebCore::Page::updateStyleAfterChangeInEnvironment() () at ../Source/WebCore/page/Page.cpp:574
#7  0x00007f34a39822e5 in WebCore::Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment() ()
    at ../Source/WebCore/page/Page.cpp:586
#8  0x00007f34a2992656 in WebKit::WebPage::themeDidChange(WTF::String&amp;&amp;) ()
    at ../Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp:167
#9  0x00007f34a2974f79 in WebKit::WebPage::WebPage(WTF::ObjectIdentifier&lt;WebCore::PageIdentifierType&gt;, WebKit::WebPageCreationParameters&amp;&amp;) () at ../Source/WebKit/WebProcess/WebPage/WebPage.cpp:604
#10 0x00007f34a29757fe in WebKit::WebPage::create(WTF::ObjectIdentifier&lt;WebCore::PageIdentifierType&gt;, WebKit::WebPageCreationParameters&amp;&amp;) () at ../Source/WebKit/WebProcess/WebPage/WebPage.cpp:379
#11 0x00007f34a27e36fc in WebKit::WebProcess::createWebPage(WTF::ObjectIdentifier&lt;WebCore::PageIdentifierType&gt;, WebKit::WebPageCreationParameters&amp;&amp;) () at ../Source/WebKit/WebProcess/WebProcess.cpp:685
#12 0x00007f34a24307d7 in IPC::callMemberFunctionImpl&lt;WebKit::WebProcess, void (WebKit::WebProcess::*)(WTF::ObjectIdentifier&lt;WebCore::PageIdentifierType&gt;, WebKit::WebPageCreationParameters&amp;&amp;), std::tuple&lt;WTF::ObjectIdentifier&lt;WebCore::PageIdentifierType&gt;, WebKit::WebPageCreationParameters&gt;, 0ul, 1ul&gt;(WebKit::WebProcess*, void (WebKit::WebProcess::*)(WTF::ObjectIdentifier&lt;WebCore::PageIdentifierType&gt;, WebKit::WebPageCreationParameters&amp;&amp;), std::tuple&lt;WTF::ObjectIdentifier&lt;WebCore::PageIdentifierType&gt;, WebKit::WebPageCreationParameters&gt;&amp;&amp;, std::integer_sequence&lt;unsigned long, 0ul, 1ul&gt;) () at ../Source/WebKit/Platform/IPC/HandleMessage.h:41
#13 IPC::callMemberFunction&lt;WebKit::WebProcess, void (WebKit::WebProcess::*)(WTF::ObjectIdentifier&lt;WebCore::PageIdentifierType&gt;, WebKit::WebPageCreationParameters&amp;&amp;), std::tuple&lt;WTF::ObjectIdentifier&lt;WebCore::PageIdentifierType&gt;, WebKit::WebPageCreationParameters&gt;, std::integer_sequence&lt;unsigned long, 0ul, 1ul&gt; &gt;(std::tuple&lt;WTF::ObjectIdentifier&lt;WebCore::PageIdentifierType&gt;, WebKit::WebPageCreationParameters&gt;&amp;&amp;, WebKit::WebProcess*, void (WebKit::WebProcess::*)(WTF::ObjectIdentifier&lt;WebCore::PageIdentifierType&gt;, WebKit::WebPageCreationParameters&amp;&amp;)) () at ../Source/WebKit/Platform/IPC/HandleMessage.h:47
#14 IPC::handleMessage&lt;Messages::WebProcess::CreateWebPage, WebKit::WebProcess, void (WebKit::WebProcess::*)(WTF::ObjectIdentifier&lt;WebCore::PageIdentifierType&gt;, WebKit::WebPageCreationParameters&amp;&amp;)&gt;(IPC::Decoder&amp;, WebKit::WebProcess*, void (WebKit::WebProcess::*)(WTF::ObjectIdentifier&lt;WebCore::PageIdentifierType&gt;, WebKit::WebPageCreationParameters&amp;&amp;)) ()
    at ../Source/WebKit/Platform/IPC/HandleMessage.h:120
#15 0x00007f34a2429c5b in WebKit::WebProcess::didReceiveWebProcessMessage(IPC::Connection&amp;, IPC::Decoder&amp;) ()
    at DerivedSources/WebKit/WebProcessMessageReceiver.cpp:291
#16 0x00007f34a2580460 in IPC::Connection::dispatchMessage(IPC::Decoder&amp;) () at ../Source/WebKit/Platform/IPC/Connection.cpp:1008
#17 0x00007f34a25817d5 in IPC::Connection::dispatchMessage(std::unique_ptr&lt;IPC::Decoder, std::default_delete&lt;IPC::Decoder&gt; &gt;) ()
    at ../Source/WebKit/Platform/IPC/Connection.cpp:1077
#18 0x00007f34a2581e9b in IPC::Connection::dispatchOneIncomingMessage() () at ../Source/WebKit/Platform/IPC/Connection.cpp:1146
#19 0x00007f34a03c4cac in WTF::RunLoop::performWork() () at /usr/lib/x86_64-linux-gnu/libjavascriptcoregtk-4.0.so.18
#20 0x00007f34a0412ae9 in  () at /usr/lib/x86_64-linux-gnu/libjavascriptcoregtk-4.0.so.18
#21 0x00007f34a0b9f4de in g_main_dispatch (context=0x555abd114690) at ../../../glib/gmain.c:3309
#22 g_main_context_dispatch (context=context@entry=0x555abd114690) at ../../../glib/gmain.c:3974
#23 0x00007f34a0b9f890 in g_main_context_iterate
    (context=0x555abd114690, block=block@entry=1, dispatch=dispatch@entry=1, self=&lt;optimized out&gt;) at ../../../glib/gmain.c:4047
#24 0x00007f34a0b9fb63 in g_main_loop_run (loop=0x555abd159c50) at ../../../glib/gmain.c:4241
#25 0x00007f34a0413548 in WTF::RunLoop::run() () at /usr/lib/x86_64-linux-gnu/libjavascriptcoregtk-4.0.so.18
#26 0x00007f34a299af8f in WebKit::AuxiliaryProcessMain&lt;WebKit::WebProcess, WebKit::WebProcessMainGtk&gt;(int, char**) ()
    at ../Source/WebKit/Shared/AuxiliaryProcessMain.h:68
#27 0x00007f34a1a2de0b in __libc_start_main (main=
    0x555abb1ef760 &lt;main()&gt;, argc=3, argv=0x7ffcb4760f68, init=&lt;optimized out&gt;, fini=&lt;optimized out&gt;, rtld_fini=&lt;optimized out&gt;, stack_end=0x7ffcb4760f58) at ../csu/libc-start.c:308
#28 0x0000555abb1ef7ea in _start ()

The document.scheduleTimedRenderingUpdate invocation in Page::updateStyleAfterChangeInEnvironment is definitely new in 2.28, but it does seem weird that any scheduleTimedRenderingUpdate invocation across webkit would lead to 60 wakeups per second forever and ever... Indeed, it seems that opening https://en.wikipedia.org/wiki/GIF#/media/File:Rotating_earth_(large).gif invokes scheduleTimedRenderingUpdate and even after switching to about:blank, this process continues waking up more than 60 times per second. So this is not really a 2.28 regression, it just got worse and is triggered by any web page, not just those that actually move.

Perhaps DisplayRefreshMonitorGtk::~DisplayRefreshMonitorGtk should call gdk_frame_clock_end_updating? But then, when I browse for a while and then attach gdb, break on gdk_frame_clock_paint_idle and print *priv, I get:

$2 = {frame_time = 51614508992, min_next_frame_time = 51614525659, sleep_serial = 7357, freeze_time = 0, flush_idle_id = 0, 
  paint_idle_id = 11239, freeze_count = 0, updating_count = 1, requested = GDK_FRAME_CLOCK_PHASE_NONE, 
  phase = GDK_FRAME_CLOCK_PHASE_NONE, in_paint_idle = 0}

updating_count is 1, so it doesn&apos;t seem like gdk_frame_clock_begin_updating is getting called multiple times, and thus calling gdk_frame_clock_end_updating is unlikely to help.
But it seems WebCore::RenderingUpdateScheduler::scheduleTimedRenderingUpdate (and thus also WebCore::DisplayRefreshMonitorGtk::requestRefreshCallback) _is_ getting called fairly often, so maybe this whole gdk_frame_clock_begin_updating is actually a mistake and we should be calling gdk_frame_clock_request_phase instead? More info about that here:

https://developer.gnome.org/gdk3/stable/GdkFrameClock.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1642183</commentid>
    <comment_count>1</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2020-04-16 02:04:50 -0700</bug_when>
    <thetext>Thanks for the so detailed bug report. We have noticed this, but it wasn&apos;t always reproducible for me. I assumed we were leaking a DisplayRefreshMonitor at some point, but it seems we don&apos;t, and maybe the problem is the way we use the GdkFrameClock.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1642186</commentid>
    <comment_count>2</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2020-04-16 02:42:54 -0700</bug_when>
    <thetext>The reason why we don&apos;t call end_updating is because we assume the frame clock is destroyed when the offscreen window is destroyed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1642190</commentid>
    <comment_count>3</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2020-04-16 03:32:34 -0700</bug_when>
    <thetext>I&apos;ve tried to reproduce this again with MiniBrowser, evolution and liferea and I still can&apos;t reproduce it :-(</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1642191</commentid>
    <comment_count>4</comment_count>
    <who name="Tomáš Janoušek">webkit</who>
    <bug_when>2020-04-16 04:09:20 -0700</bug_when>
    <thetext>&gt; I&apos;ve tried to reproduce this again with MiniBrowser, evolution and liferea and I still can&apos;t reproduce it :-(

Weird. :-/

I can reproduce it with 2.28.1 just by launching liferea, or by launching surf about:blank and then stracing the WebKitWebProcess. With 2.26.4 surf about:blank is okay, but surf https://en.wikipedia.org/wiki/GIF#/media/File:Rotating_earth_(large).gif triggers it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1642192</commentid>
    <comment_count>5</comment_count>
    <who name="Tomáš Janoušek">webkit</who>
    <bug_when>2020-04-16 04:09:42 -0700</bug_when>
    <thetext>I should also say that my system is amd64 Debian testing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1642214</commentid>
    <comment_count>6</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2020-04-16 05:48:05 -0700</bug_when>
    <thetext>Just to be clear, I see the GdkFrameClock being used, but it&apos;s correctly destroyed as expected.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1642216</commentid>
    <comment_count>7</comment_count>
    <who name="Tomáš Janoušek">webkit</who>
    <bug_when>2020-04-16 05:57:09 -0700</bug_when>
    <thetext>Perhaps you have a different version of gtk that fixed/worked around this? Or maybe it&apos;s a difference between X11 and Wayland backends? I&apos;m using X11 and gtk 3.24.18.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1642218</commentid>
    <comment_count>8</comment_count>
    <who name="Tomáš Janoušek">webkit</who>
    <bug_when>2020-04-16 06:03:42 -0700</bug_when>
    <thetext>Anyway, if you want the offscreen window destruction to clean things up, perhaps https://developer.gnome.org/gtk3/unstable/GtkWidget.html#gtk-widget-add-tick-callback is better than gdk_frame_clock_begin_updating?

(BTW, if you want a more interactive communication channel, I&apos;m Liskni_si on freenode and @Liskni_si on Twitter.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1642249</commentid>
    <comment_count>9</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2020-04-16 07:33:32 -0700</bug_when>
    <thetext>(In reply to Tomáš Janoušek from comment #7)
&gt; Perhaps you have a different version of gtk that fixed/worked around this?
&gt; Or maybe it&apos;s a difference between X11 and Wayland backends? I&apos;m using X11
&gt; and gtk 3.24.18.

Maybe, I don&apos;t think it&apos;s X11 or wayland specific, because other people reported the problem with evolution under wayland.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1642250</commentid>
    <comment_count>10</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2020-04-16 07:34:39 -0700</bug_when>
    <thetext>(In reply to Tomáš Janoušek from comment #8)
&gt; Anyway, if you want the offscreen window destruction to clean things up,
&gt; perhaps
&gt; https://developer.gnome.org/gtk3/unstable/GtkWidget.html#gtk-widget-add-tick-
&gt; callback is better than gdk_frame_clock_begin_updating?

I&apos;ve checked the GdkFrameClock is properly destroyed.

&gt; (BTW, if you want a more interactive communication channel, I&apos;m Liskni_si on
&gt; freenode and @Liskni_si on Twitter.)

I&apos;ll ping you tomorrow on IRC then. Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1643445</commentid>
    <comment_count>11</comment_count>
    <who name="Christoph Anton Mitterer">calestyo</who>
    <bug_when>2020-04-20 07:39:28 -0700</bug_when>
    <thetext>Hey.

Probably the following has nothing to do with this bug (which I&apos;m also experiencing in at least Evolution):


Could it be that this issue is somehow caused by a kernel change (specifically something that happened in kernels &gt;5.2)?


I see this pattern of fast:
pid 243332] recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
[pid 243332] poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}], 2, 17) = 0 (Timeout)

in quite a number of applications (e.g. diodon is one: https://bugs.launchpad.net/diodon/+bug/1871008 ... and I&apos;ve also noticed it in cinnamon https://github.com/linuxmint/cinnamon/issues/9085#issuecomment-615543487 )

These in turn are all programs which might play a part in a bigger issue I suffer since kernels &gt;5.2, namely some massive increase of CPU temperature respectively power consumption for GPU but also non-GPU intensive workloads:
see:
https://bugzilla.kernel.org/show_bug.cgi?id=207245
(with links to other related bug reports)
for more details.



Cheers,
Chris.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1643454</commentid>
    <comment_count>12</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2020-04-20 08:21:03 -0700</bug_when>
    <thetext>If I were you, I would try bisecting the kernel.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1643468</commentid>
    <comment_count>13</comment_count>
    <who name="Tomáš Janoušek">webkit</who>
    <bug_when>2020-04-20 09:04:11 -0700</bug_when>
    <thetext>Christoph Anton Mitterer, yeah, if you&apos;re running several apps that each use WebKitGtk and suffer from this issue, that would indeed make your CPU considerably hotter. I&apos;m lucky to just be running one and I still had to downgrade. :-)

Anyway, I added a reply here as well: https://gitlab.freedesktop.org/drm/intel/-/issues/953#note_470483 because I think the kernel issue may not be fully fixed either, and might be making it worse.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1644637</commentid>
    <comment_count>14</comment_count>
    <who name="Christoph Anton Mitterer">calestyo</who>
    <bug_when>2020-04-22 19:56:31 -0700</bug_when>
    <thetext>@Michael: Well that&apos;s probably the next thing on the road.

@Tomáš: Thanks for your comments, though I kinda doubt that the WebKit issue is the only reason for my problems (see e.g. my extensive tests, which show that even without Evolution or any GUI activity, there&apos;s a huge difference between 5.2 and 5.5 (worse)... and within each between intel_pstate being enabled (worse) and not.

Having e.g. Evolution run with some WebKit process being in the state of high CPU utilisation (which is likely this bug), just makes it worse.


Could anyone else check whether he sees *this* issue here, with much older kernels (i.e. 5.2 and below)?

Also, any fix for this on the horizon? :-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1644689</commentid>
    <comment_count>15</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2020-04-22 22:29:57 -0700</bug_when>
    <thetext>(In reply to Christoph Anton Mitterer from comment #14)
&gt; @Michael: Well that&apos;s probably the next thing on the road.
&gt; 
&gt; @Tomáš: Thanks for your comments, though I kinda doubt that the WebKit issue
&gt; is the only reason for my problems (see e.g. my extensive tests, which show
&gt; that even without Evolution or any GUI activity, there&apos;s a huge difference
&gt; between 5.2 and 5.5 (worse)... and within each between intel_pstate being
&gt; enabled (worse) and not.
&gt; 
&gt; Having e.g. Evolution run with some WebKit process being in the state of
&gt; high CPU utilisation (which is likely this bug), just makes it worse.
&gt; 
&gt; 
&gt; Could anyone else check whether he sees *this* issue here, with much older
&gt; kernels (i.e. 5.2 and below)?
&gt; 
&gt; Also, any fix for this on the horizon? :-)

I need to reproduce it to fix it. Or some help from someone who can reproduce it to debug the issue and understand the problem. Another solution might be to forget about GdkFrameClock and use a simple timer at 60fps.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1644707</commentid>
    <comment_count>16</comment_count>
    <who name="Tomáš Janoušek">webkit</who>
    <bug_when>2020-04-23 01:14:55 -0700</bug_when>
    <thetext>&gt; I need to reproduce it to fix it. Or some help from someone who can reproduce it to debug the issue and understand the problem. Another solution might be to forget about GdkFrameClock and use a simple timer at 60fps.

I&apos;d love to help but I don&apos;t know what else I can do here. Any ideas?
Last week you said you&apos;d ping me on IRC on Friday... :-/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1644756</commentid>
    <comment_count>17</comment_count>
      <attachid>397337</attachid>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2020-04-23 07:08:54 -0700</bug_when>
    <thetext>Created attachment 397337
Patch

Finally found the problem with help from Tomáš. Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1644761</commentid>
    <comment_count>18</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2020-04-23 07:33:31 -0700</bug_when>
    <thetext>Committed r260567: &lt;https://trac.webkit.org/changeset/260567&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1644762</commentid>
    <comment_count>19</comment_count>
      <attachid>397337</attachid>
    <who name="Sergio Villar Senin">svillar</who>
    <bug_when>2020-04-23 07:33:52 -0700</bug_when>
    <thetext>Comment on attachment 397337
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=397337&amp;action=review

Awesome!

&gt; Source/WebCore/platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp:50
&gt; +    gtk_widget_destroy(m_window);

Do we really need the destroy? Isn&apos;t it enough with calling _end_updating()</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1644763</commentid>
    <comment_count>20</comment_count>
    <who name="Sergio Villar Senin">svillar</who>
    <bug_when>2020-04-23 07:34:50 -0700</bug_when>
    <thetext>(In reply to Sergio Villar Senin from comment #19)
&gt; Comment on attachment 397337 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=397337&amp;action=review
&gt; 
&gt; Awesome!
&gt; 
&gt; &gt; Source/WebCore/platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp:50
&gt; &gt; +    gtk_widget_destroy(m_window);
&gt; 
&gt; Do we really need the destroy? Isn&apos;t it enough with calling _end_updating()

Beh, I&apos;ve just realized that we&apos;re already calling it, nevermind.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1644789</commentid>
    <comment_count>21</comment_count>
    <who name="Milan Crha">mcrha</who>
    <bug_when>2020-04-23 09:08:39 -0700</bug_when>
    <thetext>Is it good idea to:

   ASSERT(frameClock);

on both places? The gtk_widget_get_frame_clock() can return NULL, according to its documentation.

You can also use g_signal_handlers_disconnect_by_data(), which was added in glib 2.32. I do not see which version of glib WebKitGTK depends on (not from FindGLIB.cmake at least).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1644796</commentid>
    <comment_count>22</comment_count>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2020-04-23 09:22:00 -0700</bug_when>
    <thetext>(In reply to Milan Crha from comment #21)

&gt; You can also use g_signal_handlers_disconnect_by_data(), which was added in
&gt; glib 2.32. I do not see which version of glib WebKitGTK depends on (not from
&gt; FindGLIB.cmake at least).

It&apos;s currently set to 2.44 in

Source/cmake/OptionsGTK.cmake:find_package(GLIB 2.44.0 REQUIRED COMPONENTS gio gio-unix gobject gthread gmodule)

And it would be OK to raise that minimum version to 2.56 (its what ships Ubuntu-18.04)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1644798</commentid>
    <comment_count>23</comment_count>
    <who name="Milan Crha">mcrha</who>
    <bug_when>2020-04-23 09:24:24 -0700</bug_when>
    <thetext>(In reply to Carlos Alberto Lopez Perez from comment #22)
&gt; ...And it would be OK to raise that minimum version...

No need to raise it, from my point of view. As long as you use API in the old version it&apos;s all fine.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1645121</commentid>
    <comment_count>24</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2020-04-24 01:17:55 -0700</bug_when>
    <thetext>(In reply to Milan Crha from comment #21)
&gt; Is it good idea to:
&gt; 
&gt;    ASSERT(frameClock);
&gt; 
&gt; on both places? The gtk_widget_get_frame_clock() can return NULL, according
&gt; to its documentation.

Yes, but in this case we are creating a toplevel that we manually realize, so the frame clock is already created for sure.

&gt; You can also use g_signal_handlers_disconnect_by_data(), which was added in
&gt; glib 2.32. I do not see which version of glib WebKitGTK depends on (not from
&gt; FindGLIB.cmake at least).

I guess it doesn&apos;t matter unless it&apos;s more efficient.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1645124</commentid>
    <comment_count>25</comment_count>
    <who name="Milan Crha">mcrha</who>
    <bug_when>2020-04-24 01:33:21 -0700</bug_when>
    <thetext>(In reply to Carlos Garcia Campos from comment #24)
&gt; I guess it doesn&apos;t matter unless it&apos;s more efficient.

I doubt it&apos;s more efficient. I suggested it rather for readability/convenience. Nothing important.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1647222</commentid>
    <comment_count>26</comment_count>
    <who name="Christoph Anton Mitterer">calestyo</who>
    <bug_when>2020-04-29 17:31:19 -0700</bug_when>
    <thetext>Hey guys.

I&apos;ve got the fix no with some recent Debian package,... and the extreme CPU utilisations are in fact fixed.

However, I still see some little sporadic CPU utilisation from Evolution&apos;s WebKit processes every now and then... really nothing dramatic, most of the time they&apos;re 0%, however they do go up to say 2-3,3% every once in a while, *even though nothing happens at Evolution* (like I do not select any other mail, so that content would have to be re-drawn, nor are there any animated GIFs or so). It even happens when Evolution is minimised.

Is this kinda expected or something that one should follow up.

Thanks,
Chris.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1647298</commentid>
    <comment_count>27</comment_count>
    <who name="Milan Crha">mcrha</who>
    <bug_when>2020-04-29 23:37:39 -0700</bug_when>
    <thetext>Evolution can invoke repaint of the message preview, indirectly, when the theme style changes. It can happen also when the window gets focus or loses it. I currently do not know what else could cause that, not periodically. Maybe install debuginfo for (or build with it) the evolution itself (not WebKit, it&apos;s too huge) and when it happens, supposing there will be enough time to do it, catch a series of backtraces of the offending process, which may or may not shed a bit of light on this. I catch backtraces with this command:

   for i in {1..10}; do gdb --batch --ex &quot;t a a bt&quot; -pid=`pidof evolution` &amp;&gt;bt$i.txt; sleep 0.1; done

You can tweak the delay between them with the sleep command (set to 100ms in the command). The backtraces may not expose any private information, but, please, check the files for any private information, like passwords, email address, server addresses,... I usually search for &quot;pass&quot; at least (quotes for clarity only). Just in case.

I do not know whether we should keep this here, as the bug itself is fixed. Feel free to open a new bug on the evolution side and we can investigate there [1].

[1] https://gitlab.gnome.org/GNOME/evolution/issues/new</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>397337</attachid>
            <date>2020-04-23 07:08:54 -0700</date>
            <delta_ts>2020-04-23 07:14:54 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>wkgtk-frame-clock.diff</filename>
            <type>text/plain</type>
            <size>2884</size>
            <attacher name="Carlos Garcia Campos">cgarcia</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZyBiL1NvdXJjZS9XZWJDb3JlL0No
YW5nZUxvZwppbmRleCA2MGY1NTNjMDYwNTAuLjVmMjdiNWMyNjRmNCAxMDA2NDQKLS0tIGEvU291
cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCisrKyBiL1NvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwpAQCAt
MSwzICsxLDIzIEBACisyMDIwLTA0LTIzICBDYXJsb3MgR2FyY2lhIENhbXBvcyAgPGNnYXJjaWFA
aWdhbGlhLmNvbT4KKworICAgICAgICBbR1RLXSBleGNlc3NpdmUgd2FrZXVwcy9wb2xsaW5nIGR1
ZSB0byBnZGtfZnJhbWVfY2xvY2tfYmVnaW5fdXBkYXRpbmcKKyAgICAgICAgaHR0cHM6Ly9idWdz
LndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTIxMDU2MQorC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lQ2xvY2ssICJ1cGRhdGUiLCBH
X0NBTExCQUNLKG9uRnJhbWVDbG9ja1VwZGF0ZSksIHRoaXMpOwogICAgICAgICBnZGtfZnJhbWVf
Y2xvY2tfYmVnaW5fdXBkYXRpbmcoZnJhbWVDbG9jayk7Cg==
</data>
<flag name="review"
          id="412729"
          type_id="1"
          status="+"
          setter="zan"
    />
          </attachment>
      

    </bug>

</bugzilla>