Bug 703865 - GNU time reports incorrect maximum RSS
Summary: GNU time reports incorrect maximum RSS
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: time
Version: 6.1
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: rc
: ---
Assignee: Petr Pisar
QA Contact: Ondřej Pták
URL: http://lists.gnu.org/archive/html/bug...
Whiteboard:
: 783143 (view as bug list)
Depends On:
Blocks: 836160 947775 1070830 1159820
TreeView+ depends on / blocked
 
Reported: 2011-05-11 13:40 UTC by Petr Pisar
Modified: 2019-05-20 11:01 UTC (History)
6 users (show)

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.
Clone Of: 702826
Environment:
Last Closed: 2015-03-23 08:15:03 UTC


Attachments (Terms of Use)
Fix (977 bytes, patch)
2011-05-11 13:42 UTC, Petr Pisar
no flags Details | Diff
test case (257 bytes, text/plain)
2012-02-08 09:17 UTC, Petr Pisar
no flags Details


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:0710 normal SHIPPED_LIVE time bug fix update 2015-03-23 12:14:03 UTC

Description Petr Pisar 2011-05-11 13:40:15 UTC
+++ 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 13:42:04 UTC
Created attachment 498298 [details]
Fix

Comment 2 RHEL Product and Program Management 2011-07-05 23:41:36 UTC
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 09:17:07 UTC
Created attachment 560195 [details]
test case

Comment 4 Petr Pisar 2012-02-08 09:18:17 UTC
*** Bug 783143 has been marked as a duplicate of this bug. ***

Comment 6 Suzanne Yeghiayan 2012-02-14 23:09:40 UTC
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 04:59:24 UTC
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-14 01:05:41 UTC
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 17:38:55 UTC
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 08:15:03 UTC
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.