After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 578130 - Chess AI (gnuchess) uses maximum CPU which drains battery
Chess AI (gnuchess) uses maximum CPU which drains battery
Status: RESOLVED FIXED
Product: gnome-chess
Classification: Applications
Component: General
git master
Other All
: Normal normal
: ---
Assigned To: GNOME Games maintainers
GNOME Games maintainers
Depends on:
Blocks:
 
 
Reported: 2009-04-06 13:19 UTC by Dhiraj Kumar Hazra
Modified: 2013-05-25 19:01 UTC
See Also:
GNOME target: ---
GNOME version: 2.5/2.6


Attachments
Screenshot of the top (730.69 KB, image/png)
2009-04-06 13:23 UTC, Dhiraj Kumar Hazra
Details

Description Dhiraj Kumar Hazra 2009-04-06 13:19:27 UTC
Please describe the problem:
The when glchess is opened two identical process called gnome-gnuchess is opened
the top output
------------------------
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
19195 dhiraj    39  19 11020 1540  604 R   96  0.0   5:28.75 gnome-gnuchess
23533 dhiraj    39  19 11020 1532  604 R   92  0.0   1:20.81 gnome-gnuchess
------------------------------------
see the cpu it takes when I just started the game.The memory is 0 but the question is why it reserves so much cpu.
I have a core 2 duo.So the output is more than 100%

after running killall glchess I am not able to kill all glchess processes.

Steps to reproduce:
1. run glchess
2. top

3.see the process 
4.killall gnome
4.

Actual results:
when I start glchess I am getting too much cpu consumption

Expected results:
while idle it shouldn't reserve so much cpu

Does this happen every time?
yes

Other information:
first reported here
http://bugzilla.gnome.org/simple-bug-guide.cgi
attaching a screenshot
Comment 1 Dhiraj Kumar Hazra 2009-04-06 13:23:25 UTC
Created attachment 132188 [details]
Screenshot of the top
Comment 2 Dick Gevers 2009-12-30 23:04:52 UTC
Confirmed with current Mandriva Linux Cooker and package gnome-games-2.29.4-1mdv2010.1.i586.rpm, running 2D. The game does work okay but cpu goes to 100% usage, causing unwanted heating of the hardware.

When started from console I also get the warning or error:
Failed to load GGZ config: No such file or directory: /home/dvg/.ggz/ggz-gtk.rc

I have also already installed these i586.rpm packages:
gnome-games-extra-data-2.28.0-1mdv2010.0
ggz-client-libs-0.0.14.1-5mdv2010.0
libggz2-0.0.14.1-5mdv2010.0
libggzcore9-0.0.14.1-5mdv2010.0
libggzdmod6-0.0.14.1-6mdv2010.0
libggzmod4-0.0.14.1-5mdv2010.0

Might there be a missing requirement for a package writing ggz-gtk.rc? I do not have such file anywhere on the system.

gdb does not run on /usr/bin/glchess as the file is not executable, but I can provide an strace if useful.

IMHO priority and/or severity should be higher than 'normal'.
Comment 3 Richard 2010-06-22 10:50:02 UTC
Confirmed on Ubuntu 9.10.

This bug should be higher than 'normal' priority as it essentially makes the program unusable on portable devices.

Until recently, would not take 100% CPU until I selected new game and changed the difficulty level. But then it would stay on 100% usage even if I changed it back or chose human vs human. Now it appears to take 100% CPU all the time.

Note that the CPU time is not being used on the chess engine - problem occurs when playing human vs human, and when playing human vs GNU chess easy I can still beat it almost every time regardless of if it is using 100% CPU or not.
Comment 4 nvshaji 2010-06-23 17:56:18 UTC
This is a problem with Ubuntu 10.04 too.
Comment 5 ombra85 2010-09-02 10:01:17 UTC
I use Ubuntu 10.04 and these programs: glchess 2.30.0-0ubuntu6, gnuchess 5.07-7, sjeng 11.2-8.
I also have this bug with glchess and these engines: gnu chess, sjeng.
All it's ok with these engines: crafty, toga II, phalanx, glaurung, hoichess, fruit.
Comment 6 Robert Ancell 2011-01-19 07:25:25 UTC
This is due to gnuchess using the maximum amount of CPU when running (to be the best AI it can be).  For power reasons we should consider using a more efficient (and probably easier) AI.  Updating title to reflect this.
Comment 7 Michael Catanzaro 2013-05-25 19:01:47 UTC
(In reply to comment #3)
> Confirmed on Ubuntu 9.10.
> 
> This bug should be higher than 'normal' priority as it essentially makes the
> program unusable on portable devices.
> 
> Until recently, would not take 100% CPU until I selected new game and changed
> the difficulty level. But then it would stay on 100% usage even if I changed it
> back or chose human vs human. Now it appears to take 100% CPU all the time.
> 
> Note that the CPU time is not being used on the chess engine - problem occurs
> when playing human vs human, and when playing human vs GNU chess easy I can
> still beat it almost every time regardless of if it is using 100% CPU or not.

There's two different CPU-related issues remaining in gnome-chess 3.8.2:

* The original report is against gnuchess.  When gnuchess is set to ponder (to think during its opponent's turn), it will, by design, use up your whole CPU in order to play its best.  Currently we set gnuchess to ponder at Normal and Hard difficulty levels, but not on Easy, so if you play on Easy this shouldn't be an issue.  I feel there is no need for pondering except on the hardest difficulty level, so I'll probably turn this off on Normal to be friendly to your hardware.  But if you play on Hard, you should expect the AI to use all available resources to do its very best.  You can follow Bug #475535 if you're interested in the difficulty level mess.

* After playing a game against ANY engine and then starting a new game (against a human or any engine), gnome-chess would itself eat all of your CPU.  I've just pushed a fix for this and I'll backport it to gnome-3-8.

I'm not aware of any other issues; please open a new bug if I've missed any. Thanks!