Bug 1440434 - Unusual high CPU usage
Summary: Unusual high CPU usage
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: wxGTK3
Version: 25
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Scott Talbert
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-04-08 22:18 UTC by markusN
Modified: 2017-05-17 21:15 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-05-17 21:15:26 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description markusN 2017-04-08 22:18:04 UTC
GRASS GIS 7 which is using this library has a major issue with 100% CPU usage when the GUI dialog is opened: 

CPU at 100%
GRASS 7.2.1svn (nc_spm_08_grass7):~ > g.gui
Launching <wxpython> GUI in the background, please wait...
GRASS 7.2.1svn (nc_spm_08_grass7):~ > 12:15:19 AM: Debug: Failed to connect to session manager: SESSION_MANAGER environment variable not defined

(wxgui.py:18739): Gtk-CRITICAL **: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar

(wxgui.py:18739): Gtk-CRITICAL **: gtk_widget_is_drawable: assertion 'GTK_IS_WIDGET (widget)' failed

(wxgui.py:18739): Gtk-CRITICAL **: gtk_widget_is_drawable: assertion 'GTK_IS_WIDGET (widget)' failed

(wxgui.py:18739): GLib-GObject-WARNING **: invalid unclassed pointer in cast to 'GtkWidget'

(wxgui.py:18739): Gtk-CRITICAL **: gtk_widget_set_size_request: assertion 'GTK_IS_WIDGET (widget)' failed


top - 00:16:43 up 20 days,  1:32,  2 users,  load average: 0.80, 0.45, 0.38
Tasks: 224 total,   2 running, 222 sleeping,   0 stopped,   0 zombie
%Cpu(s): 30.6 us,  1.8 sy,  0.0 ni, 67.1 id,  0.0 wa,  0.2 hi,  0.2 si,  0.0 st
KiB Mem :  3930176 total,   144048 free,  2230104 used,  1556024 buff/cache
KiB Swap:  3932156 total,  3775580 free,   156576 used.  1192880 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND     
25090 root      20   0  827188 219076 201904 R  99.7  5.6  16:23.85 Xorg        
18970 neteler   20   0 1707324 177196  89120 S  22.3  4.5   0:11.99 python      
18785 neteler   20   0 3627968 963424 104316 S   2.3 24.5  71:18.42 firefox     
18509 neteler   20   0  719072  33028  25156 S   1.3  0.8   0:00.82 xfce4-term+ 
25777 neteler   20   0  362964  16588  14480 S   0.7  0.4   6:17.40 gkrellm     
19131 neteler   20   0  155800   3844   3376 R   0.3  0.1   0:00.07 top         
    1 root      20   0  212520   4600   2736 S   0.0  0.1   0:13.59 systemd     
    2 root      20   0       0      0      0 S   0.0  0.0   0:00.31 kthreadd    
    3 root      20   0       0      0      0 S   0.0  0.0   0:08.02 ksoftirqd/0 
    5 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/0:+ 
    7 root      20   0       0      0      0 S   0.0  0.0   2:54.81 rcu_sched   


Closing the g.gui brings the CPU down to almost 0%.

Comment 1 markusN 2017-04-13 05:17:10 UTC
The same high CPU usage happens in the demo:

cd /usr/share/doc/wxPython-docs/demo/
python run.py Calendar.py
--> click on button

Comment 2 markusN 2017-04-23 19:43:40 UTC
(In reply to markusN from comment #1)
> The same high CPU usage happens in the demo:
> 
> cd /usr/share/doc/wxPython-docs/demo/
> python run.py Calendar.py
> --> click on button

Using "strace", I see tons of those lines after clicking a button in the demo:

cd /usr/share/doc/wxPython-docs/demo/ ; strace python Calendar.py
...
poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])
writev(3, [{iov_base="\212\10\t\0\1\\!\3\25\1 \3]} \3\362_!\3\0\0\0\0\0\0\0\0\0\0\0\0"..., iov_len=16384}, {iov_base=NULL, iov_len=0}, {iov_base="", iov_len=0}], 3) = 16384
recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])
writev(3, [{iov_base="5 \4\0\335`!\3\333`!\3\260\0 \0\212\4\6\0\336`!\3\335`!\3&\0\0\0"..., iov_len=16384}, {iov_base=NULL, iov_len=0}, {iov_base="", iov_len=0}], 3) = 16384
recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLIN|POLLOUT}])
recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="A\0\365\250q^!\3\3\0\202\0\10\1 \3\0\30\7\0\0\0\0\0\0\0\0\0\0\0\0\0", iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 32
writev(3, [{iov_base="\212\7\2\0\301a!\0036`\2\0\300a!\3>\4\7\0\323`!\3\321`!\3 \1 \3"..., iov_len=16100}, {iov_base="\0\0\240\0\0<\240\0\0\0\343\0\0\0\240\0\0\325\341\0\0<\240\0\0\0\217\1\0\0\240\0"..., iov_len=1120}, {iov_base="", iov_len=0}], 3) = 17220
poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])
writev(3, [{iov_base="\212\27\30\0\3a!\3\262\7 \3j\\!\3\0\0\0\0\24\1 \3\361\0\265\0\1\0\0\0"..., iov_len=16380}, {iov_base=NULL, iov_len=0}, {iov_base="", iov_len=0}], 3) = 16380
recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])
writev(3, [{iov_base="\212\10\t\0\10a!\3\240c!\3\0\0\0\0\355b!\3\0\0\0\0\0\0\0\0\0\0\0\0"..., iov_len=16356}, {iov_base=NULL, iov_len=0}, {iov_base="", iov_len=0}], 3) = 16356
recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])
writev(3, [{iov_base="\212\10\t\0\10a!\3\\d!\3\0\0\0\0\217b!\3\0\0\0\0\0\0\0\0\0\0\0\0"..., iov_len=4692}, {iov_base=NULL, iov_len=0}, {iov_base="", iov_len=0}], 3) = 4692
poll([{fd=3, events=POLLIN}], 1, -1)    = 1 ([{fd=3, revents=POLLIN}])
...

Comment 3 Scott Talbert 2017-04-25 04:16:16 UTC
I don't think the problem with the Calendar demo is the same problem.  It could be, but I don't think it is at the moment.

Can you help me figure out how I can run the g.gui under gdb?  If you can figure out the actual python program that it runs, that would be helpful.  I think I've had this same problem before when trying to look into these types of problems.  :-)

Comment 4 markusN 2017-04-25 15:03:30 UTC
Below the answer from grass-dev where I asked for support.
I hope it helps for debugging.

---------- Forwarded message ----------
From: Vaclav Petras
Date: Tue, Apr 25, 2017 at 4:36 PM
Subject: Re: [GRASS-dev] wxGUI unusual high CPU usage debugging
To: Markus Neteler <neteler>
Cc: GRASS developers list <grass-dev.org>

It runs wxgui.py [1], so you can use something like:

cd grass/src
python gui/wxpython/wxgui.py

or:

python $GISBASE/gui/wxpython/wxgui.py

Well, but that's just how to run the Python code directly.

Vaclav

[1] https://trac.osgeo.org/grass/browser/grass/trunk/general/g.gui/main.c#L106

Comment 5 Scott Talbert 2017-04-26 02:24:34 UTC
Thank you.  Running gdb wasn't as helpful as I was expecting.  However, it appears that upstream's 3.0 branch doesn't have this problem so it should be possible to fix it.  That also means that F26 probably isn't affected as that's got a relatively recent git snapshot (and a 3.0.3 release is coming soon).

Comment 6 markusN 2017-05-01 19:06:14 UTC
For the record:

As per Bug #1411165 comment 7 the CPU problem is gone with wxGTK3-3.0.3-0.8.gite4293e9.fc25.x86_64.rpm from the COPR test compilation.

Comment 7 Jeremy Newton 2017-05-02 18:27:38 UTC
(In reply to markusN from comment #6)
> For the record:
> 
> As per Bug #1411165 comment 7 the CPU problem is gone with
> wxGTK3-3.0.3-0.8.gite4293e9.fc25.x86_64.rpm from the COPR test compilation.

Thanks! 3.0.3 was just released, so we can push this to F25.

Comment 8 Scott Talbert 2017-05-10 00:50:55 UTC
Update submitted for F25:
https://bodhi.fedoraproject.org/updates/FEDORA-2017-901ccd6490

Comment 9 Jeremy Newton 2017-05-16 20:26:33 UTC
Hi markusN,

3.0.3 has been pushed to f25. Can you confirm if this issue is fixed?

Comment 10 markusN 2017-05-17 20:53:23 UTC
(In reply to Jeremy Newton from comment #9)
> 3.0.3 has been pushed to f25. Can you confirm if this issue is fixed?

Yes, it is fixed. Thanks!


Note You need to log in before you can comment on or make changes to this bug.