Bug 952763 - clock-applet excessive memory footprint
Summary: clock-applet excessive memory footprint
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: mate-panel
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Dan Mashal
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 908003 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-04-16 15:59 UTC by Przemek Klosowski
Modified: 2014-02-07 01:16 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-02-06 15:42:32 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Przemek Klosowski 2013-04-16 15:59:58 UTC
Description of problem:
/usr/libexec/clock-applet consumes excessive amounts of memory (1GB)

Version-Release number of selected component (if applicable):
gnome-panel-3.6.2-2.fc18.x86_64

How reproducible:
Didn't repeat test yet -- haven't figured out how to restart gnome applets.

Steps to Reproduce:
1. configure clock applet to diaplay date, weather
2. observe memory usage

  
Actual results: per top, clock-applet uses 4290m virtual 906m resident  5420 shared, or nearly a quarter of all memory on my system

Expected results: modest memory consumption

Comment 1 Przemek Klosowski 2013-04-16 16:07:35 UTC
FWIW, killall clock-applet just killed the clock applet. I did 'pkill gnome-panel' and the panel came back with the clock applet running.  

Fresh out of the box, clock-applet uses 1321m virtual, 77m resident, 12m shared.

Comment 2 Przemek Klosowski 2013-04-17 15:51:35 UTC
Checked repeatability and long term behavior: I can confirm that it happens every time I restart the applet. 

The memory leak seems to be more-less constant over time: the resident set seems to increase at an aggregate rate of 60MB every hour, or about 1.5 GB/day.

I looked at the actual pattern of activity in the RSS size, and it is quite irregular: I see 40 MB jump then a 20 MB jump a minute later, then 30 minutes of no change, then 10 MB and another 10MB within a minute, followed by no activity for another 30 minutes, and a 40MB jump followed by 20 MB.

Comment 3 Przemek Klosowski 2013-04-17 16:00:00 UTC
I attached gdb to the executable, breaking in malloc() and saw large allocations (20MB, see stack trace below). It seems that wireToDeviceEvent() from XExtInt.c does the following:
	
1511 ptr = (unsigned char*)&in[1] + in->buttons_len * 4;
1512	
1513 len = sizeDeviceEvent(in->buttons_len * 4, in->valuators_len * 4, ptr);
1514	
1515 cookie->data = ptr_lib = malloc(len);

and maybe sizeDeviceEvent calculates the size wrong?


#0  __GI___libc_malloc (bytes=20301328) at malloc.c:2848
#1  0x00000036e960936b in wireToDeviceEvent (cookie=0xe94568, in=0x135c610)
    at XExtInt.c:1515
#2  XInputWireToCookie (dpy=<optimized out>, cookie=0xe94568, event=0x135c610)
    at XExtInt.c:979
#3  0x00000036e1a456e5 in _XEnq (dpy=dpy@entry=0xdd3190, event=event@entry=
    0x135c610) at XlibInt.c:899
#4  0x00000036e1a42813 in handle_response (dpy=dpy@entry=0xdd3190, response=
    0x135c610, in_XReply=in_XReply@entry=0) at xcb_io.c:338
#5  0x00000036e1a43075 in _XEventsQueued (dpy=dpy@entry=0xdd3190, 
    mode=mode@entry=2) at xcb_io.c:363
#6  0x00000036e1a346bd in XPending (dpy=0xdd3190) at Pending.c:55
#7  0x00000036f9e4a898 in gdk_check_xpending (display=<optimized out>)
    at gdkeventsource.c:266
#8  gdk_event_source_check (source=0xdebe70) at gdkeventsource.c:297
#9  0x00000036e124782c in g_main_context_check (context=context@entry=
    0xdcd9e0, max_priority=2147483647, fds=fds@entry=0x1354350, 
    n_fds=n_fds@entry=6) at gmain.c:3169
#10 0x00000036e1247cc2 in g_main_context_iterate (context=0xdcd9e0, 
    block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>)
    at gmain.c:3287
#11 0x00000036e1248182 in g_main_loop_run (loop=0xf0cbd0) at gmain.c:3484
#12 0x00000036f938dd4d in gtk_main () at gtkmain.c:1160

Comment 4 Przemek Klosowski 2013-04-17 16:07:25 UTC
On the other hand, I see that maybe the GDB display cannot be trusted, because of this other breakpoint stack trace:

#0  __GI___libc_malloc (bytes=139987882367488) at malloc.c:2848
#1  0x00000036e124d68f in g_malloc (n_bytes=n_bytes@entry=4096) at gmem.c:159
#2  0x00000036e52338cc in g_buffered_input_stream_set_buffer_size (stream=
    0x7f5178005a00 [GDataInputStream], size=4096) at gbufferedinputstream.c:241

Here __GI___libc_malloc seems to see some absurd allocation size but the malloc is called as

 mem = glib_mem_vtable.malloc (n_bytes);

and n_bytes is 4096. Maybe it's a typing error: __GI___libc_malloc expects size_t and n_bytes is long unsigned int (they both show sizeof(..) equal to 8 though...)

Comment 5 Przemek Klosowski 2013-04-19 16:51:35 UTC
I changed the settings to show the date, and NOT show seconds, temperature and weather, and the memory is just 800MB after a day of running. 

Seriously, this memory leak needs fixing!

Comment 6 Przemek Klosowski 2013-04-19 21:55:14 UTC
If someone could suggest a way to run valgrind on clock-applet I would like to try that---maybe it'll show where the memory goes. 

I killed it, and refused to restart it when the gnome-panel popped up a warning. Then I tried to run it from the commandline ('valgrind /usr/libexec/clock-applet') but that didn't work. There has to be a way to make gnome-panel invoke valgrind when running clock-applet--perhaps by changing the executable path in gnome preferences---but how would one see the resulting valgind output? 

By the way, the above caused the clock to disappear from the top panel, and I had to re-discover that Alt-rightclick is the secret combo for adding/moving/removing panel applets.

Comment 7 Dave Malcolm 2013-04-22 20:11:11 UTC
I don't know of a "good" way of doing this, but an evil hack to get this info might be to move /usr/libexec/clock-applet to /usr/libexec/the-real-clock-applet and replace /usr/libexec/clock-applet with a shell script that invokes:
  valgrind /usr/libexec/the-real-clock-applet

Not sure where the output would go, though.

(You might need to make an analogous move to the debuginfo also)

Comment 8 Conrad Meyer 2013-04-23 04:41:04 UTC
*** Bug 908003 has been marked as a duplicate of this bug. ***

Comment 9 Jens Petersen 2013-04-24 06:44:02 UTC
I removed all locations (and turned off weather) and that seems to help.

Before that the applet was regularly clocking up (sorry!)
1.5GB+ of physical memory... (since it doesn't use much cpu
it took me a while to notice that clock-applet was the culprit
of my machine swapping so much of the time).

Comment 10 Mark Hittinger 2013-09-30 21:05:12 UTC
i also see this - it is especially bad if you enable the display of seconds.

my f19 workstation can run for about a week and a half then all the swap space is used up by clock-applet - ROFL

kill clock-applet and select reload at the pop-up - then you get most of your swap space back.

Comment 11 Fedora End Of Life 2013-12-21 12:51:49 UTC
This message is a reminder that Fedora 18 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 18. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '18'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 18's end of life.

Thank you for reporting this issue and we are sorry that we may not be 
able to fix it before Fedora 18 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior to Fedora 18's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 12 Fedora End Of Life 2014-02-05 20:40:37 UTC
Fedora 18 changed to end-of-life (EOL) status on 2014-01-14. Fedora 18 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 13 Jens Petersen 2014-02-06 06:10:15 UTC
I see this with mate-panel clock too in F20.

$ ps lx | grep clock
0  1000  1908     1  20   0 2064484 29224 poll_s Sl  ?         53:23 /usr/libexec/mate-panel/clock-applet

Comment 14 Wolfgang Ulbrich 2014-02-06 15:42:32 UTC
(In reply to Jens Petersen from comment #13)
> I see this with mate-panel clock too in F20.

1. Pls, open a new report instead or re-opening old gnome-bugs, gnome-2 is dead.

2. As a fedora package maintainer, why you don't open  a report directly at upstream?
https://github.com/mate-desktop
Sorry, i don't do this work for you.

Comment 15 Jens Petersen 2014-02-07 01:05:55 UTC
I don't see any harm in tracking this downstream too.

Okay I will report upstream against the version in Fedora 20.

Comment 16 Jens Petersen 2014-02-07 01:16:56 UTC
Done: https://github.com/mate-desktop/mate-panel/issues/163


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