Bug 703865 - GNU time reports incorrect maximum RSS
GNU time reports incorrect maximum RSS
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: time (Show other bugs)
6.1
Unspecified Unspecified
low Severity medium
: rc
: ---
Assigned To: Petr Pisar
Ondřej Pták
http://lists.gnu.org/archive/html/bug...
: EasyFix, Patch
: 783143 (view as bug list)
Depends On:
Blocks: 836160 947775 1070830 1159820
  Show dependency treegraph
 
Reported: 2011-05-11 09:40 EDT by Petr Pisar
Modified: 2015-03-23 04:15 EDT (History)
6 users (show)

See Also:
Fixed In Version: time-1.7-38.el6
Doc Type: Bug Fix
Doc Text:
Cause: Running time(1) tool with "-f %M" arguments. Consequence: Reported maximal resident set size (RSS) is wrong. Fix: The tool has been changed understand that Linux kernel expresses the value in kilobytes instead of memory pages. Result: time(1) tool reports maximal RSS tool correctly.
Story Points: ---
Clone Of: 702826
Environment:
Last Closed: 2015-03-23 04:15:03 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)
Fix (977 bytes, patch)
2011-05-11 09:42 EDT, Petr Pisar
no flags Details | Diff
test case (257 bytes, text/plain)
2012-02-08 04:17 EST, Petr Pisar
no flags Details

  None (edit)
Description Petr Pisar 2011-05-11 09:40:15 EDT
+++ This bug was initially created as a clone of Bug #702826 +++

GNU time can print out the maximum RSS usage of its subprocess. The ru_maxrss value returned by the wait4 syscall is in units of kilobytes, but GNU time incorrectly treats this as a number of pages, multiplying the value by 4 before displaying it.

[...]

Steps to Reproduce:
1. /usr/bin/time -f %M perl -e '"x" x 400 x 1024 x 1024'
  
Actual results: A bit over 1600000, indicating maximum RSS usage of 1.6 GB. This is not even possible on my system as it only has 1 GB of physical RAM.

Expected results: Approximately 400000, since Perl should only be allocating around 400 MB.

[...]

$ strace -ve wait4 /usr/bin/time -f %M perl -e '"x" x 400 x 1024 x 1024'
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, {ru_utime={0, 146977}, ru_stime={0, 676897}, ru_maxrss=411356, ru_ixrss=0, ru_idrss=0, ru_isrss=0, ru_minflt=102901, ru_majflt=1, ru_nswap=0, ru_inblock=176, ru_oublock=0, ru_msgsnd=0, ru_msgrcv=0, ru_nsignals=0, ru_nvcsw=1, ru_nivcsw=40}) = 7459
--- {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=7459, si_status=0, si_utime=14, si_stime=68} (Child exited) ---
1645424

----
RHEL-6.1 affected.
Comment 1 Petr Pisar 2011-05-11 09:42:04 EDT
Created attachment 498298 [details]
Fix
Comment 2 RHEL Product and Program Management 2011-07-05 19:41:36 EDT
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unfortunately unable to
address this request at this time. Red Hat invites you to
ask your support representative to propose this request, if
appropriate and relevant, in the next release of Red Hat
Enterprise Linux. If you would like it considered as an
exception in the current release, please ask your support
representative.
Comment 3 Petr Pisar 2012-02-08 04:17:07 EST
Created attachment 560195 [details]
test case
Comment 4 Petr Pisar 2012-02-08 04:18:17 EST
*** Bug 783143 has been marked as a duplicate of this bug. ***
Comment 6 Suzanne Yeghiayan 2012-02-14 18:09:40 EST
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unfortunately unable to
address this request at this time. Red Hat invites you to
ask your support representative to propose this request, if
appropriate and relevant, in the next release of Red Hat
Enterprise Linux. If you would like it considered as an
exception in the current release, please ask your support
representative.
Comment 7 RHEL Product and Program Management 2012-09-07 00:59:24 EDT
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.
Comment 8 RHEL Product and Program Management 2013-10-13 21:05:41 EDT
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.
Comment 14 Ondřej Pták 2015-01-26 12:38:55 EST
time-1.7-37.1.el6
=================
:: [   INFO   ] :: RSS usage of given script is suppose to be about 412024 kB
:: [   PASS   ] :: Measuring RSS usege (Expected 0, got 0)
:: [   FAIL   ] :: RSS max usage should be < 450000 (Assert: "450000" should be greater than "1647232")
:: [   PASS   ] :: RSS max usage should be > 400000 (Assert: "1647232" should be greater than "400000")
:: [   INFO   ] :: RSS value is 399 % of expected value

time-1.7-38.el6
===============
:: [   INFO   ] :: RSS usage of given script is suppose to be about 412024 kB
:: [   PASS   ] :: Measuring RSS usege (Expected 0, got 0)
:: [   PASS   ] :: RSS max usage should be < 450000 (Assert: "450000" should be greater than "411804")
:: [   PASS   ] :: RSS max usage should be > 400000 (Assert: "411804" should be greater than "400000")
:: [   INFO   ] :: RSS value is 99 % of expected value

verified on all relevant architectures
Comment 16 errata-xmlrpc 2015-03-23 04:15:03 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-0710.html

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