Skip Menu |

This queue is for tickets about the Proc-ProcessTable CPAN distribution.

Report information
The Basics
Id: 89117
Status: resolved
Priority: 0/
Queue: Proc-ProcessTable

People
Owner: cpan [...] bargsten.org
Requestors: yyang [...] proofpoint.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Proc::ProcessTable issues negative vsize memory value on 64bit Linux
On a 64-bit Linux, if the program's size grows to certain size, Proc::ProcessTable will return negative: $ cat /proc/26760/stat 26760 (xxxx) S 2871 2871 2871 0 -1 4202560 265777425 0 140 0 2860043 223065 0 0 20 5 11 0 3512285827 2167234560 488283 18446744073709551615 134512640 136183076 4290675888 18446744073709551615 4294960144 0 674339 4096 682531 18446744073709551615 0 0 17 1 0 0 554 The script: use Proc::ProcessTable; my $proc = Proc::ProcessTable->new(); my ($p, $f); foreach $p (@{$proc->table}) { next unless $p->uid == $<; print "--------------------------------\n"; foreach $f ($proc->fields){ print $f, ": ", $p->{$f}, "\n"; } } will output: -------------------------------- uid: 100 gid: 103 pid: 26760 fname: xxxx ppid: 2871 pgrp: 2871 sess: 2871 ttynum: 0 flags: 4202560 minflt: 265767740 cminflt: 0 majflt: 140 cmajflt: 0 utime: 28599200000 stime: 2230580000 cutime: 0 cstime: 0 priority: 20 start: 1380618862 size: -2127732736 rss: 2000007168 wchan: -1 time: 30829780000 ctime: 0 state: sleep euid: 100 suid: 100 fuid: 100 egid: 103 sgid: 103 fgid: 103 pctcpu: 93.55 pctmem: 23.88 Note that vsize is 2167234560 (812D6000 hex), while -2127732736 is FFFFFFFF812D6000 in hex.
From: yyang [...] proofpoint.com
Proposed fix - need to bless into unsigned long: --- os/Linux.h~ 2008-09-08 08:08:41.000000000 -0700 +++ os/Linux.h 2013-09-30 11:08:13.857536000 -0700 @@ -106,7 +106,7 @@ "exec\0" "cwd\0" /* format string */ - "IIISIIIILLLLLJJJJIJLLLJJSIIIIIISSSSS\0" + "IIISIIIILLLLLJJJJIJPLLJJSIIIIIISSSSS\0" }; /* I generated this array with a perl script processing the above char array,
Thanks for contributing. Added patch to github repo, the change will be part of the next version. You can find the repo at: https://github.com/jwbargsten/perl-proc-processtable