Bug 175375 - "Memory" wrong with > 4GB processes
"Memory" wrong with > 4GB processes
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: gnome-system-monitor (Show other bugs)
4.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Søren Sandmann Pedersen
: Desktop
Depends On:
Blocks: 187538
  Show dependency treegraph
 
Reported: 2005-12-09 11:38 EST by Bastien Nocera
Modified: 2014-06-18 05:08 EDT (History)
3 users (show)

See Also:
Fixed In Version: RHBA-2006-0326
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-05-10 18:19:00 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
test.c (394 bytes, text/plain)
2005-12-09 11:38 EST, Bastien Nocera
no flags Details
gnome-system-monitor-dont-truncate-sizes.patch (2.15 KB, patch)
2005-12-14 13:20 EST, Bastien Nocera
no flags Details | Diff
gnome-system-monitor-dont-truncate-sizes-2.patch (2.88 KB, patch)
2005-12-15 04:41 EST, Bastien Nocera
no flags Details | Diff
gnome-system-monitor-dont-truncate-sizes-3.patch (3.68 KB, patch)
2006-01-09 10:22 EST, Bastien Nocera
no flags Details | Diff

  None (edit)
Description Bastien Nocera 2005-12-09 11:38:15 EST
On x86-64:
gnome-system-monitor-2.7.0-2-x86_64
libgtop2-2.8.0-1-x86_64

A process shows "5.9g" under RES in top, but 1.9GB in gnome-system-monitor.
Another process shows "9.5g" under RES in top, but -800567296 bytes in
gnome-system-monitor.

Attached is a test program to get the vsize out of the program.
I think that the problem is either:
- in libgtop, getting the process' stats (couldn't replicate)
- in gnome-system-monitor itself (possibly bad conversion of one type to another)
- in gnome-vfs, for early versions of gnome-system-monitor, for
gnome_vfs_format_file_size_for_display
Comment 1 Bastien Nocera 2005-12-09 11:38:15 EST
Created attachment 122080 [details]
test.c
Comment 2 Bastien Nocera 2005-12-14 12:13:13 EST
Program to replicate the problem:

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
11560 root      16   0 10.0g  10g  232 S  0.0 15.9   1:51.38 test

-8<-
#include <stdlib.h>
#include <string.h>

int main (int argc, char **argv)
{
        void *mem;
        /* 10 gigs*/
        mem = malloc (10737418240);
        if (mem == NULL) {
                printf ("Couldn't allocate the RAM\n");
                return 1;
        }
        memset(mem, 0, 10737418240); /* may take a while, needed otherwise the
allocation isn't dirty, and shows as virt */
        for (;;)
                sleep (2);
        return 0;
}
-8<-
Comment 3 Bastien Nocera 2005-12-14 12:20:18 EST
# ./test-glibtop 11560
PID: 11560
vsize: 10739855360

Seems to show it fine, so the bug is most likely not in libgtop.
Comment 4 Bastien Nocera 2005-12-14 12:34:31 EST
gnome_vfs_format_file_size_for_display() works as well:
# ./test-glibtop 11560
PID: 11560
vsize: 10739855360
Human form: 10.0 GB
Comment 5 Bastien Nocera 2005-12-14 12:44:58 EST
The bug is in src/util.c in gnome-system-monitor:
gchar *
get_size_string (gfloat fsize)

The gint64 gets truncated to a float, which will obviously break badly. Already
fixed upstream:
http://cvs.gnome.org/viewcvs/procman/src/util.c?r1=1.24&r2=1.25
Comment 6 Bastien Nocera 2005-12-14 13:20:41 EST
Created attachment 122234 [details]
gnome-system-monitor-dont-truncate-sizes.patch
Comment 7 Bastien Nocera 2005-12-14 13:21:31 EST
Test packages at:
http://people.redhat.com/bnocera/g-s-m/rhel4/
Comment 8 Bastien Nocera 2005-12-14 14:16:32 EST
The packages won't work, struct _ProcInfo in src/procman.h stores the memory
details in an int, instead of a gint64.
Comment 9 Bastien Nocera 2005-12-15 04:41:58 EST
Created attachment 122268 [details]
gnome-system-monitor-dont-truncate-sizes-2.patch

Also use gint64 to store the memory data temporarily.
Comment 10 Bastien Nocera 2005-12-15 04:42:37 EST
Test packages at:
http://people.redhat.com/bnocera/g-s-m/rhel4/

(Verified working)
Comment 11 Bastien Nocera 2005-12-15 07:52:41 EST
Tested successfully.
Comment 14 Søren Sandmann Pedersen 2005-12-15 16:47:36 EST
Thanks for doing all this work, Bastien.
Comment 15 Bastien Nocera 2006-01-09 10:22:35 EST
Created attachment 122949 [details]
gnome-system-monitor-dont-truncate-sizes-3.patch

Also fix the sorting, using gint64, instead of gint, as for RHEL3 (bug #175377)
Comment 16 Søren Sandmann Pedersen 2006-01-09 13:53:32 EST
I have built a new version with this patch:

/mnt/redhat/beehive/comps/dist/4E-qu-candidate/gnome-system-monitor/2.7.0-5
Comment 19 Søren Sandmann Pedersen 2006-04-11 16:57:53 EDT
Devel ACK - Note that this can be fasttracked. The package is there already,
2.7.0-5.
Comment 26 Red Hat Bugzilla 2006-05-10 18:19:00 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2006-0326.html

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