Bug 182869 - drains CPU after visiting pages with Flash
Summary: drains CPU after visiting pages with Flash
Status: RESOLVED UPSTREAM
Alias: None
Product: konqueror
Classification: Applications
Component: nspluginviewer (show other bugs)
Version: 4.2.0
Platform: Debian testing Unspecified
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
: 149022 198470 206604 210148 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-02-02 14:50 UTC by Marcus Better
Modified: 2021-04-20 13:29 UTC (History)
36 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcus Better 2009-02-02 14:50:06 UTC
Version:            (using KDE 4.2.0)
Installed from:    Debian testing/unstable Packages

nspluginviewer regularly hogs the CPU, probably after visiting a page with Flash content. (I am using Debian's flashplugin-nonfree 1:2.4, i.e. Adobe's flash plugin.) 

But what is  worse, the nspluginviewer process is usually left behind when the browser tab in question is closed, thus requiring me to kill it manually.

strace output from the nspluginviewer process amounts to some 300 lines per second of this sort:

14:09:24 read(8, 0x66ed94, 4096)        = -1 EAGAIN (Resource temporarily unavailable)
14:09:25 select(18, [17], [17], NULL, NULL) = 1 (out [17])
14:09:25 writev(17, [{"7\30\5\0!D`\10\236\2`\10\0\0\1\0\0\0\0\0\214\3\n\0\236\2`\10!D`\10\330"..., 68}, {NULL, 0}, {""..., 0}], 3) = 68
14:09:25 read(17, 0x72ccc4, 4096)       = -1 EAGAIN (Resource temporarily unavailable)
14:09:25 poll([{fd=3, events=POLLIN}, {fd=16, events=POLLIN}, {fd=8, events=POLLIN}, {fd=17, events=POLLIN}], 4, 0) = 0 (Timeout)
14:09:25 read(8, 0x66ed94, 4096)        = -1 EAGAIN (Resource temporarily unavailable)
14:09:25 read(8, 0x66ed94, 4096)        = -1 EAGAIN (Resource temporarily unavailable)
14:09:25 read(17, 0x72ccc4, 4096)       = -1 EAGAIN (Resource temporarily unavailable)
14:09:25 poll([{fd=3, events=POLLIN}, {fd=16, events=POLLIN}, {fd=8, events=POLLIN}, {fd=17, events=POLLIN}], 4, 0) = 0 (Timeout)
14:09:25 read(8, 0x66ed94, 4096)        = -1 EAGAIN (Resource temporarily unavailable)
14:09:25 read(8, 0x66ed94, 4096)        = -1 EAGAIN (Resource temporarily unavailable)
14:09:25 read(8, 0x66ed94, 4096)        = -1 EAGAIN (Resource temporarily unavailable)
14:09:25 poll([{fd=8, events=POLLIN}], 1, 0) = 0 (Timeout)
14:09:25 read(8, 0x66ed94, 4096)        = -1 EAGAIN (Resource temporarily unavailable)
14:09:25 read(17, 0x72ccc4, 4096)       = -1 EAGAIN (Resource temporarily unavailable)
14:09:25 poll([{fd=3, events=POLLIN}, {fd=16, events=POLLIN}, {fd=8, events=POLLIN}, {fd=17, events=POLLIN}], 4, 0) = 0 (Timeout)
14:09:25 read(8, 0x66ed94, 4096)        = -1 EAGAIN (Resource temporarily unavailable)
14:09:25 read(8, 0x66ed94, 4096)        = -1 EAGAIN (Resource temporarily unavailable)
14:09:25 read(17, 0x72ccc4, 4096)       = -1 EAGAIN (Resource temporarily unavailable)
14:09:25 poll([{fd=3, events=POLLIN}, {fd=16, events=POLLIN}, {fd=8, events=POLLIN}, {fd=17, events=POLLIN}], 4, 0) = 0 (Timeout)
14:09:25 read(8, 0x66ed94, 4096)        = -1 EAGAIN (Resource temporarily unavailable)
14:09:25 read(8, 0x66ed94, 4096)        = -1 EAGAIN (Resource temporarily unavailable)
14:09:25 read(8, 0x66ed94, 4096)        = -1 EAGAIN (Resource temporarily unavailable)
14:09:25 poll([{fd=8, events=POLLIN}], 1, 0) = 0 (Timeout)
14:09:25 read(8, 0x66ed94, 4096)        = -1 EAGAIN (Resource temporarily unavailable)
14:09:25 read(17, 0x72ccc4, 4096)       = -1 EAGAIN (Resource temporarily unavailable)
Comment 1 Marcus Better 2009-02-02 14:51:09 UTC
(Running Debian amd64 testing.)
Comment 3 Kevin Gilbert 2009-03-11 00:01:37 UTC
I am also experiencing this on Fedora 10. If this cannot be fixed, can nspluginviewer be disabled as this issue is a real PITA.
Comment 4 Magnus Kessler 2009-03-31 16:37:19 UTC
I experience the same issue with KDE 4.2.1 on 64-bit Gentoo and the 64-bit Adobe flash plugin.
Comment 5 Michael Schuerig 2009-04-14 02:42:25 UTC
*** This bug has been confirmed by popular vote. ***
Comment 6 Icekiss 2009-04-18 12:28:41 UTC
I can confirm this for debian unstable running kde 4.2.2.

It is especially annoying since multiple nspluginviewer processes get spawned over time, meaning that even the cpus in my dual core system are maxed out pretty fast just doing whatever for flash animations on tabs which are closed by now...
Comment 7 honda 2009-05-21 08:49:02 UTC
(In reply to comment #6)
> I can confirm this for debian unstable running kde 4.2.2.

Me too. This seems due to many timer events asserted in 3 different widgets in nspluginviwer. If you comment out timer event routines in both glibevents.cpp and  xtevents.cpp, then the problem has gone in my case. Without these timer events, flashplayer seems to be work fine. Anyway this is a hint for us to solve the problem.
Comment 8 José Tomás Atria 2009-06-12 20:16:39 UTC
i can confirm this for kde 4.2.90 on kubuntu 9.04.
Comment 9 honda 2009-06-12 20:42:03 UTC
I investigated this problem much further, and I think now that this is related to Qt's glib support (in paricular, polling of events).
This bug and Bug 154270 (heavy Xorg and KWin cpu usage with Desktop Effects) perhaps comes from the same reason.
So, try to set an enviorment variable:
export QT_NO_GLIB=1
before your kde session start.
Comment 10 Paul Hartman 2009-06-30 22:49:43 UTC
Happens to me too, amd64 architecture, kde 4.2.4, akregator 1.4.4. I didn't get a chance to try the suggestion from comment #9 yet.
Comment 11 Paul Hartman 2009-06-30 23:27:56 UTC
(In reply to comment #9)
> I investigated this problem much further, and I think now that this is related
> to Qt's glib support (in paricular, polling of events).
> This bug and Bug 154270 (heavy Xorg and KWin cpu usage with Desktop Effects)
> perhaps comes from the same reason.
> So, try to set an enviorment variable:
> export QT_NO_GLIB=1
> before your kde session start.

I just tried this, I set it before running akregator from a konsole and the problem seems to be gone! Afterward, I unset and ran akregator again and the excessive CPU usage returned. So I think you are on the right path. Thanks.
Comment 12 FiNeX 2009-07-01 10:47:06 UTC
*** Bug 198470 has been marked as a duplicate of this bug. ***
Comment 13 Oliver Henshaw 2009-09-28 16:32:42 UTC
Is https://bugzilla.redhat.com/show_bug.cgi?id=426968 related? I'm not sure whether nspluginviewer and nspluginwrapper have similar roots.
Comment 14 Karl Sinn 2009-10-01 12:45:25 UTC
I have put this "export QT_NO_GLIB=1" now before calling every browser, and it finally gives me internet back :-)
I had a lot of trouble with the speed of the browsers. With this setting everything works just fine and fast as it should.
I accelerates the browsers on both KDE 3.5 and 4.3
Comment 15 Glenn Doig 2009-10-02 03:28:50 UTC
Hello
I use the following to install flash - using 11.2 milestone7 live kde cd
Install [Adobe Flash Player] http://get.adobe.com/flashplayer/
version 10.0.32.18 on x86_64 systems extract and copy plugin and it
displays with about:plugins

# cp -v  libflashplayer.so  /usr/lib64/browser-plugins/.

about:plugins shows

Shockwave Flash

   File name: libflashplayer.so
   Shockwave Flash 10.0 r32

I tested it with this
http://sendables.jibjab.com/originals/2008_year_in_review
Enjoy.
Comment 16 mutlu inek 2009-10-10 00:51:20 UTC
I am experiencing this on Arch Linux as well, using KDE 4.3.2.

When I use akregator for a while, the nspluginviewer process starts to take up between 10% and 20% cpu. The process is not stopped when I navigate away from feed content with flash to feeds in simple text view. Nspluginviewer quits only if I kill it manually or if I quit akregator.

As mentioned above, starting akregator with "QT_NO_GLIB=1 akregator" solves the problem.
Comment 17 Pavel Malyshev 2009-11-03 07:29:10 UTC
I've created ~/.kde/env/nsplugin_fix.sh with "export QT_NO_GLIB=1" and now nspluginviewer stays after closed tab but it does not take all my cpu.

KDE 4.3.2 from Kubuntu Karmic. The problem was there even in kde3.
Comment 18 Fabio Varesano 2009-11-22 19:21:44 UTC
I can confirm that following #17 fixes this. Actually I used ~/.kde4/env/nsplugin_fix.sh as file path (kde4 instead of kde).
Comment 19 András Manţia 2009-12-06 19:44:05 UTC
This happens with trunk as well. I use the 64bit flash plugin, without npwrapper. Without QT_NO_GLIB=1, nspluginviewer uses 20% CPU according to top (from 4 CPU, AFAIK that means almost 100% for one CPU). It works OK while the page is visible, but as soon as I close it, the cpu usage goes up. If I attach gdb to it, I get nothing but:
#0  0x00007f5e0f1cc033 in poll () from /lib64/libc.so.6
#1  0x00007f5e12d3e58c in ?? () from /usr/lib64/libglib-2.0.so.0
#2  0x00007f5e12d3e8d0 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#3  0x00007f5e1101c99f in QEventDispatcherGlib::processEvents (this=0x635230, flags=...)
    at /home/andris/development/sources/kde-trunk/qt-copy/src/corelib/kernel/qeventdispatcher_glib.cpp:407
#4  0x00007f5e0fee96a4 in QGuiEventDispatcherGlib::processEvents (this=0x635230, flags=...)
    at /home/andris/development/sources/kde-trunk/qt-copy/src/gui/kernel/qguieventdispatcher_glib.cpp:202
#5  0x00007f5e10fdcc14 in QEventLoop::processEvents (this=0x7fffd73e1300, flags=...) at /home/andris/development/sources/kde-trunk/qt-copy/src/corelib/kernel/qeventloop.cpp:149
#6  0x00007f5e10fdcd6a in QEventLoop::exec (this=0x7fffd73e1300, flags=...) at /home/andris/development/sources/kde-trunk/qt-copy/src/corelib/kernel/qeventloop.cpp:201
#7  0x00007f5e10fe02f2 in QCoreApplication::exec () at /home/andris/development/sources/kde-trunk/qt-copy/src/corelib/kernel/qcoreapplication.cpp:981
#8  0x00007f5e0fe00414 in QApplication::exec () at /home/andris/development/sources/kde-trunk/qt-copy/src/gui/kernel/qapplication.cpp:3572
#9  0x000000000041a03d in main (argc=3, argv=0x7fffd73e17a8) at /home/andris/development/sources/kde-trunk/kdebase/apps/nsplugins/viewer/viewer.cpp:144

Running Qt 4.6 (from git),KDE trunk, libflashplayer-10.0.32.18.linux-x86_64.so.tar.gz .
Comment 20 Dmitry Suzdalev 2009-12-09 17:16:52 UTC
Yeah, something that bugs me regularly in trunk :)
Adding myself to CC
Comment 21 Maksim Orlovich 2010-01-15 20:20:01 UTC
*** Bug 149022 has been marked as a duplicate of this bug. ***
Comment 22 Maksim Orlovich 2010-01-15 20:20:33 UTC
*** Bug 210148 has been marked as a duplicate of this bug. ***
Comment 23 Maksim Orlovich 2010-01-15 20:21:10 UTC
*** Bug 206604 has been marked as a duplicate of this bug. ***
Comment 24 Maksim Orlovich 2010-01-15 20:27:09 UTC
SVN commit 1075295 by orlovich:

Try to avoid needless wakeups with the event pumps when not needed:
- Don't activate the Xt pump when not needed; it's not 
for most commonly used plugins
- Don't use our glib pump's timer when Qt's glib event loop 
is on anyway.

This doesn't cover 100% of situations, and doesn't really explain 
why QT_NO_GLIB works better for some people (never saw this particular 
case myself), but it should cover the "nspluginviewer wakes up 
a lot and uses a few% of cpu" case for most people. Hopefully.

CCBUG: 182869

I am thinking off holding of on backporting this till 4.4.1, though.... 
 


 M  +22 -5     glibevents.cpp  
 M  +6 -5      glibevents.h  
 M  +3 -0      pluginhost_xt.cpp  
 M  +16 -7     xtevents.cpp  
 M  +7 -5      xtevents.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1075295
Comment 25 Stefan Fleckenstein 2010-01-26 08:39:58 UTC
Can this patch be included in SC 4.4 final? This bug makes konqueror unuseable for me, it's a pity.

> 
> WebSVN link: http://websvn.kde.org/?view=rev&revision=1075295
> 
> I am thinking off holding of on backporting this till 4.4.1, though.... 
>
Comment 26 Stefan Fleckenstein 2010-01-30 12:34:50 UTC
After some more investigation, I'm not quite sure anymore, if my problem is really related to this report, but to https://bugs.kde.org/show_bug.cgi?id=224827
Comment 27 Basti 2010-02-17 19:10:14 UTC
Confirming on KDE 4.4.0, Fedora 12. My solution:
sudo chmod -x /usr/bin/nspluginviewer

Flash still works.^^
Comment 28 András Manţia 2010-03-04 15:27:15 UTC
I still see this problem. QT_NO_GLIB=1 helps, but makes nspluginviewer crash often  and also makes the Phonon GStreamer backend to not work.
Comment 29 Oliver Henshaw 2010-04-24 15:56:08 UTC
Did the fix in comment #24 ever make it into 4.4.x?
Comment 30 Maksim Orlovich 2010-04-24 20:10:22 UTC
Woops, thanks for reminder. Will do it today for 4.4.3. But, again, it only helps with wakeups, not with the 100% issue, which is different.
Comment 31 James Roe 2010-05-10 02:19:18 UTC
This seems to also happen to me with Firefox, not just Konqueror. Same process, npviewer. It eats a lot of CPU for an odd reason...
Comment 32 mutlu inek 2010-06-07 10:59:13 UTC
Indeed, this seems to be fixed in KDE SC 4.5 beta 2 (4.4.82). Thanks a lot to the developers!

Can anyone else please confirm that it is fixed?
Comment 33 Sebastian Audet 2013-09-10 04:58:52 UTC
I wanted to pipe up to say that this appears to have Regressed.

I am using 12.04.3 LTS Kubuntu, KDE 4.11.0.

Does not seem to make a difference which flash player is used (11.2, 11.8 tried), happens frequently, seeming randomly, kwin locks up, have to restart kwin in order to get valid cpu usage.

I cannot confirm this issue is isolated to flash player either, but it seems to be the most noticeable instance.

I would be happy to provide more details if anyone needs to ask something of me.
Comment 34 Jonathan Marten 2021-04-20 13:29:16 UTC
Flash and Netscape plugins are no longer supported.