Bug 1294697

Summary: Eclipse consumes entire CPU as long as the window is open
Product: [Fedora] Fedora Reporter: Dennis W. Tokarski <dwt>
Component: eclipseAssignee: Roland Grunberg <rgrunber>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: akurtako, andjrobins, desintegr, eclipse-sig, jerboaa, kjh, krzysztof.daniel, mat.booth, nfd, rgrunber, sgehwolf
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: eclipse-4.5.1-7.fc23 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-02-11 19:09:41 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dennis W. Tokarski 2015-12-29 19:03:15 UTC
Description of problem:
Eclipse consumes 80+ % of a CPU core when idle. Minimize the window and
CPU use goes to near zero. Maximize the window and it's back to 80+ %.
This is a great way to bleed a laptop battery dry in no time.


Version-Release number of selected component (if applicable):
Fedora 23 up to date as of 29 Dec 2015, 1800 UTC, kernal 4.2.8-300.fc23.x86_64
Mate Desktop 1.12.1
eclipse-platform-4.5.1-6.fc23.x86_64
java-1.8.0-openjdk-headless-1.8.0.65-13.b17.fc23.x86_64

How reproducible:
Installed F23, Mate Desktop, and *just* eclipse-platform on a VM. (Of course,
  the eclipse install pulled in all the usual supporting rpms)
Log in to a Mate desktop session, launch eclipse.
Observe high CPU use.
Always happens.
Same behavior observed on the host system.


Steps to Reproduce:
1. See above.
2.
3.

Actual results:
80+ % cpu use when eclipse window is open but otherwise idle (it's just
showing the welcome screen); minimize window, CPU % near zero; maximize
window, high CPU use again.

When CPU use is high, strace on the eclipse process shows:
[PolTec@raid-lvm-scratch Desktop]$ strace -p8507
Process 8507 attached
wait4(8521,

...and strace on java shows:
[PolTec@raid-lvm-scratch Desktop]$ strace -p8521
Process 8521 attached
futex(0x7f338b30e9d0, FUTEX_WAIT, 8522, NULL

top says it's java that's using up all the CPU time, almost like it's in a
spin lock waiting for something which never happens. So I suppose this could
be a java bug and nothing to do with eclipse.

Expected results:
Eclipse and java should be blocked and using no CPU to speak of when
there is no application interaction.

Additional info:
That's about it. Let me know if there's some way I can provide any
other info. If you just run top and start eclipse it should be
pretty blatant.

Comment 1 K H 2016-01-03 05:43:53 UTC
I've seeing this same behavior.  In order to debug this, I tried stripped my eclipse-* packages to the bare minimum and it was still happening.

In installed the latest Eclipse Mars for linux from the eclipse website and then I run that, I am not seeing excessive CPU usage.  Not only did it fix cpu usage but it also cleaned a couple of other problems I've been seeing

1. The pop up dialog that lists all the files opened is no longer white text on white background
2. Hitting a breakpoint automatically switches to the Debug perspective in PDT.

Additionally, trying to uninstall eclipse-platform took about 67 other packages with it, including really basic ones like ant, regexp, java-1.8.0-openjdk-devel

Comment 2 Damien Gombault 2016-01-05 11:43:28 UTC
Hi.

I use Eclipse for Apache Directory Studio plugin.
I noticed Eclipse uses a lot of CPU when idle :

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                         
31981 damien    20   0 5214316 337580  46388 S  63,8  4,2   1:23.96 java 

Some other operations (open a LDAP connection) uses a lot of CPU too (abnormal) and does not work on some LDAP servers (connection Window freezes).

When minimized (Super+H with GNOME Shell), Eclipse uses less than 1% CPU.

I think the problem is the GTK3 version of Eclipse.
If I run eclipse --launcher.GTK_version 2, it uses less than 1%CPU idleing.
Other operations (open a LDAP connection) works normally.

The bug has been reported upstream ([GTK3] Eclipse Mars SR1 consumes 60% CPU while idling) : https://bugs.eclipse.org/bugs/show_bug.cgi?id=478962
And is fixed in master : 
Gerrit change https://git.eclipse.org/r/61124 was merged to [master].
Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=87d512619f0b0b05332e4c83f651f29bfa50c5e9

I use eclipse-swt-4.5.1-6.fc23.x86_64 on Fedora 23.

Comment 3 Roland Grunberg 2016-01-05 15:52:02 UTC
> The bug has been reported upstream ([GTK3] Eclipse Mars SR1 consumes 60% CPU
> while idling) : https://bugs.eclipse.org/bugs/show_bug.cgi?id=478962
> And is fixed in master :
> Gerrit change https://git.eclipse.org/r/61124 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=87d512619f0b0b05332e4c83f651f29bfa50c5e9
> 
> I use eclipse-swt-4.5.1-6.fc23.x86_64 on Fedora 23.

I'm also seeing roughly the same thing, except for me it seems to stay at around 40-50% while idle. Minimizing the window has it dropping to ~1%

The bug and patch you mention were backported as 4.5.1-6 (http://pkgs.fedoraproject.org/cgit/eclipse.git/commit/?id=f2e612a4c062c77352b386590c6885a7d6c84b94), but I've just learned from Eric that there was another issue causing cpu consumption while idle. (See https://bugs.eclipse.org/bugs/show_bug.cgi?id=484729) . It was introduced by a patch that we backported into 4.5.1.

It's currently being tested, and should find its way into f23 soon.

Comment 4 Roland Grunberg 2016-01-05 17:56:19 UTC
http://pkgs.fedoraproject.org/cgit/eclipse.git/commit/?h=f23&id=47041fe34938219943e42fb412a6305b9af9bdc6 should resolve this issue. There are some other bug fixes in this commit that are unrelated.

The build is http://koji.fedoraproject.org/koji/buildinfo?buildID=709256 and will be pushed through bodhi for f23 once it completes.

Comment 5 Fedora Update System 2016-01-07 03:04:06 UTC
eclipse-4.5.1-7.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-3c119d77c0

Comment 6 Fedora Update System 2016-01-09 04:28:54 UTC
eclipse-4.5.1-7.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-3c119d77c0

Comment 7 Fedora Update System 2016-01-09 21:57:07 UTC
eclipse-4.5.1-7.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.

Comment 8 Fredy Neeser 2016-01-14 14:58:43 UTC
Hi, I experience the exact same problem on Fedora 22 (high cpu load, goes away when eclipse is minimized).

# rpm -qa | grep eclipse
eclipse-ecf-core-3.12.0-1.fc22.x86_64
eclipse-egit-4.1.1-1.fc22.noarch
eclipse-filesystem-1.0-5.fc22.x86_64
eclipse-tm-terminal-4.0.0-3.fc22.noarch
eclipse-rse-3.7.0-1.fc22.noarch
eclipse-mylyn-3.16.0-2.fc22.noarch
eclipse-remote-2.0.0-2.fc22.noarch
eclipse-cdt-8.8.0-3.fc22.x86_64
eclipse-e4-importer-0.1.0-0.5.gite4610b6.fc22.noarch
eclipse-jgit-4.1.1-2.fc22.noarch
eclipse-mylyn-docs-wikitext-3.16.0-2.fc22.noarch
eclipse-platform-4.5.1-6.fc22.x86_64
eclipse-pde-4.5.1-6.fc22.x86_64
eclipse-emf-core-2.11.1-1.fc22.x86_64
devassistant-dap-eclipse-0.10.0dev-8.fc22.noarch
eclipse-pydev-4.1.0-3.fc22.x86_64
eclipse-emf-runtime-2.11.1-1.fc22.noarch
eclipse-equinox-osgi-4.5.1-6.fc22.x86_64
eclipse-swt-4.5.1-6.fc22.x86_64
eclipse-jdt-4.5.1-6.fc22.x86_64

Can we get the fix here as well?

Comment 9 Roland Grunberg 2016-01-14 15:50:00 UTC
(In reply to comment #8)
> Hi, I experience the exact same problem on Fedora 22 (high cpu load, goes away
> when eclipse is minimized).

I've kicked off a scratch build of the same update for Fedora 22 (x86_64) at http://koji.fedoraproject.org/koji/taskinfo?taskID=12547911.

I'll try to confirm that the issue does in fact exist on there as well and that the build solves it. You can also try it for yourself once the build completes, if you wish.
If it can be confirmed I'll push this is an update to F22.

Comment 10 Fredy Neeser 2016-01-15 08:53:19 UTC
(In reply to Roland Grunberg from comment #9)

> I've kicked off a scratch build of the same update for Fedora 22 (x86_64) at
> http://koji.fedoraproject.org/koji/taskinfo?taskID=12547911.
> 
> I'll try to confirm that the issue does in fact exist on there as well and
> that the build solves it. You can also try it for yourself once the build
> completes, if you wish.

Thanks! I cannot locate the build in koji - did the build succeed?

Comment 11 Severin Gehwolf 2016-01-15 09:43:42 UTC
(In reply to Fredy Neeser from comment #10)
> (In reply to Roland Grunberg from comment #9)
> 
> > I've kicked off a scratch build of the same update for Fedora 22 (x86_64) at
> > http://koji.fedoraproject.org/koji/taskinfo?taskID=12547911.
> > 
> > I'll try to confirm that the issue does in fact exist on there as well and
> > that the build solves it. You can also try it for yourself once the build
> > completes, if you wish.
> 
> Thanks! I cannot locate the build in koji - did the build succeed?

It did. The RPMs can be found under "Output" here:
http://koji.fedoraproject.org/koji/taskinfo?taskID=12547914

Comment 12 Fredy Neeser 2016-01-15 11:04:39 UTC
(In reply to Severin Gehwolf from comment #11)

> > Thanks! I cannot locate the build in koji - did the build succeed?
> 
> It did. The RPMs can be found under "Output" here:
> http://koji.fedoraproject.org/koji/taskinfo?taskID=12547914

Ok, I downloaded eclipse platform 4.5.1-7 and updated just these packages:

  eclipse-equinox-osgi.x86_64 1:4.5.1-7.fc22
  eclipse-jdt.x86_64 1:4.5.1-7.fc22
  eclipse-pde.x86_64 1:4.5.1-7.fc22
  eclipse-platform.x86_64 1:4.5.1-7.fc22  
  eclipse-swt.x86_64 1:4.5.1-7.fc22

The high cpu load issue is gone: The java process used by eclipse is now at around 2% cpu when eclipse is idle -- previously it remained at ~ 80% cpu.

Thanks!

Comment 13 Roland Grunberg 2016-01-20 17:54:54 UTC
Sorry for the delay, I guess having closed the bug, I didn't notice. I'll push a proper change to f22 now.

Comment 14 Fedora Update System 2016-01-21 16:38:01 UTC
eclipse-4.5.1-7.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2016-cbb77ab56f

Comment 15 Fedora Update System 2016-01-23 21:28:51 UTC
eclipse-4.5.1-7.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-cbb77ab56f

Comment 16 Dennis W. Tokarski 2016-01-26 21:20:28 UTC
Roland, Severin,

Thanks for pushing out all these fixes. I confirm that eclipse
cpu use is back to normal for me as well.

btw, when you did the new build, did you do away with gtk2 support?

I had been using "--launcher.GTK_version 2" on the command line per
Damien Gombault in comment 2, which also worked. The bonus for me
was that eclipse then started using my preferred theme (Crux) which
is not available for gtk3. This no longer works. Oh well.

There were also a number of other rendering issues in eclipse-cdt
which remained or actually became worse. For example, hover over
a global variable name and the top half of the display box which
opened up would brifely flash the variable name and value, and
then turn solid black.

I was about to report that when a new set of openjdk rpms became
available in updates. It seemed prudent to update and confirm the
bugs before reporting, and--happy surprise!--they were all fixed!

Don't know what prompted the new java, but kudos to whoever did
that work.

eclipse-cdt is once again able to build and debug hello world,
and that's a Good Thing.

Comment 17 Mat Booth 2016-01-27 10:28:26 UTC
(In reply to Dennis W. Tokarski from comment #16)
> Roland, Severin,
> 
> Thanks for pushing out all these fixes. I confirm that eclipse
> cpu use is back to normal for me as well.
> 
> btw, when you did the new build, did you do away with gtk2 support?
> 
> I had been using "--launcher.GTK_version 2" on the command line per
> Damien Gombault in comment 2, which also worked. The bonus for me
> was that eclipse then started using my preferred theme (Crux) which
> is not available for gtk3. This no longer works. Oh well.
> 


You can try setting --launcher.GTK_version in your /etc/eclipse.ini file, but GTK2 support is not really supportable these days. GTK3 is where all the development effort is.

Comment 18 Roland Grunberg 2016-02-03 17:27:18 UTC
> There were also a number of other rendering issues in eclipse-cdt
> which remained or actually became worse. For example, hover over
> a global variable name and the top half of the display box which
> opened up would brifely flash the variable name and value, and
> then turn solid black.
> 
> I was about to report that when a new set of openjdk rpms became
> available in updates. It seemed prudent to update and confirm the
> bugs before reporting, and--happy surprise!--they were all fixed!

By openjdk rpms, you mean java-1.8.0-openjdk ? I'm not sure how changes to those rpms would have any impact on Eclipse tooltip rendering so that's a little concerning. If the strange tooltip behaviour is reproduced again, I'd file a separate bug for it.

Comment 19 Fedora Update System 2016-02-05 00:22:00 UTC
eclipse-4.5.1-7.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.

Comment 20 Dennis W. Tokarski 2016-02-05 03:49:12 UTC
(In reply to Roland Grunberg from comment #18)
> > There were also a number of other rendering issues in eclipse-cdt
> > which remained or actually became worse. For example, hover over
> > a global variable name and the top half of the display box which
> > opened up would brifely flash the variable name and value, and
> > then turn solid black.
> > 
> > I was about to report that when a new set of openjdk rpms became
> > available in updates. It seemed prudent to update and confirm the
> > bugs before reporting, and--happy surprise!--they were all fixed!
> 
> By openjdk rpms, you mean java-1.8.0-openjdk ? I'm not sure how changes to
> those rpms would have any impact on Eclipse tooltip rendering so that's a
> little concerning. If the strange tooltip behaviour is reproduced again, I'd
> file a separate bug for it.


Yes, I did mean java-1.8.0-openjdk. Other things were updated at
the same time, but I don't know of any easy way to get a list of
what was updated in that batch.

If rendering issues pop up again I'll be sure to let you know!

Comment 21 Roland Grunberg 2016-02-11 19:09:41 UTC
Manually marking as CLOSED (ERRATA). Not sure why the automated system didn't do this. Maybe referencing the bug in both the f23 and f22 builds confused it.