Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 586923 - ksh memory leak significantly slows the execution of shell scripts
ksh memory leak significantly slows the execution of shell scripts
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: ksh (Show other bugs)
5.5
All Linux
urgent Severity urgent
: rc
: ---
Assigned To: Michal Hlavinka
qe-baseos-tools
: Patch, ZStream
Depends On:
Blocks: 502912 590060 674552
  Show dependency treegraph
 
Reported: 2010-04-28 10:13 EDT by Tomas Smetana
Modified: 2018-10-27 09:41 EDT (History)
11 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Due to a memory leak in the ksh executable, the performance of long running scripts could decrease significantly over the time. With this update, the underlying source code has been modified to prevent this memory leak, and the execution of long running scripts is no longer slowed down.
Story Points: ---
Clone Of:
: 588710 (view as bug list)
Environment:
Last Closed: 2012-02-21 00:49:38 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Reproducer script (2.85 KB, text/plain)
2010-04-28 10:15 EDT, Tomas Smetana
no flags Details
Proposed patch (586 bytes, patch)
2010-04-28 10:16 EDT, Tomas Smetana
no flags Details | Diff
A better patch (1.07 KB, patch)
2010-05-18 03:32 EDT, Tomas Smetana
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2012:0159 normal SHIPPED_LIVE ksh bug fix and enhancement update 2012-02-20 09:53:47 EST

  None (edit)
Description Tomas Smetana 2010-04-28 10:13:46 EDT
Run the attached script and observe the results. Here's the sample of the output of the different ksh93 versions:

The previous version of the Korn Shell:
==================================================================================
# ./loop_time_gets_longer  

ksh version: Version M 93s+ 2008-01-31

  +-------------- pass number
  |            +- current loop time/1st loop time
  |            |  process size --------------------------------------+
  |            |  total time in seconds ----------------+            |
  |            |  current loop time +                   |            |
  |            |                    |                   |            |
 \ /          \ /                  \ /                 \ /          \ /
p#   1: cur/1st= 1.00; loop(secs)=  1.56; total(secs)=    1.56; RSS=0001592
p#   2: cur/1st= 0.99; loop(secs)=  1.55; total(secs)=    3.11; RSS=0001604
p#   3: cur/1st= 1.00; loop(secs)=  1.56; total(secs)=    4.67; RSS=0001604
p#   4: cur/1st= 1.00; loop(secs)=  1.56; total(secs)=    6.23; RSS=0001604
p#   5: cur/1st= 1.00; loop(secs)=  1.56; total(secs)=    7.79; RSS=0001604
p#   6: cur/1st= 1.00; loop(secs)=  1.57; total(secs)=    9.36; RSS=0001604
p#   7: cur/1st= 1.00; loop(secs)=  1.56; total(secs)=   10.92; RSS=0001604
p#   8: cur/1st= 1.01; loop(secs)=  1.57; total(secs)=   12.49; RSS=0001604
p#   9: cur/1st= 1.00; loop(secs)=  1.56; total(secs)=   14.06; RSS=0001604
p#  10: cur/1st= 1.00; loop(secs)=  1.56; total(secs)=   15.62; RSS=0001604

================================================================================

The new Korn Shell:
================================================================================
# ./loop_time_gets_longer  

ksh version: Version AJM 93t+ 2010-02-02

  +-------------- pass number
  |            +- current loop time/1st loop time
  |            |  process size --------------------------------------+
  |            |  total time in seconds ----------------+            |
  |            |  current loop time +                   |            |
  |            |                    |                   |            |
 \ /          \ /                  \ /                 \ /          \ /
p#   1: cur/1st= 1.00; loop(secs)=  5.43; total(secs)=    5.43; RSS=0069952
p#   2: cur/1st= 2.31; loop(secs)= 12.56; total(secs)=   17.99; RSS=0138524
p#   3: cur/1st= 3.46; loop(secs)= 18.78; total(secs)=   36.77; RSS=0207088
p#   4: cur/1st= 4.52; loop(secs)= 24.53; total(secs)=   61.31; RSS=0275656
p#   5: cur/1st= 5.51; loop(secs)= 29.93; total(secs)=   91.24; RSS=0344220
p#   6: cur/1st= 6.46; loop(secs)= 35.09; total(secs)=  126.33; RSS=0412784
p#   7: cur/1st= 7.39; loop(secs)= 40.15; total(secs)=  166.48; RSS=0481344
p#   8: cur/1st= 8.33; loop(secs)= 45.23; total(secs)=  211.70; RSS=0549912
p#   9: cur/1st= 9.29; loop(secs)= 50.48; total(secs)=  262.18; RSS=0618480
p#  10: cur/1st=10.22; loop(secs)= 55.49; total(secs)=  317.67; RSS=0687040

Version-Release number of selected component (if applicable):
ksh-20100202-1.el5

How reproducible:
always

Steps to Reproduce:
See the description
Comment 1 Tomas Smetana 2010-04-28 10:15:08 EDT
Created attachment 409846 [details]
Reproducer script
Comment 2 Tomas Smetana 2010-04-28 10:16:00 EDT
Created attachment 409847 [details]
Proposed patch

Backported from 2010-03-09 upstream version.
Comment 3 Tomas Smetana 2010-05-18 03:32:40 EDT
Created attachment 414760 [details]
A better patch

There seems to be another leak caused by a forgotten initialization
Comment 5 RHEL Product and Program Management 2010-08-09 14:20: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 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.
Comment 10 RHEL Product and Program Management 2011-01-11 15:21:58 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.
Comment 12 RHEL Product and Program Management 2011-01-11 17:44:05 EST
This request was erroneously denied for the current release of
Red Hat Enterprise Linux.  The error has been fixed and this
request has been re-proposed for the current release.
Comment 22 Miroslav Svoboda 2012-01-18 03:55:50 EST
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Due to a memory leak in the ksh executable, the performance of long running scripts could decrease significantly over the time. With this update, the underlying source code has been modified to prevent this memory leak, and the execution of long running scripts is no longer slowed down.
Comment 23 errata-xmlrpc 2012-02-21 00:49:38 EST
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.

http://rhn.redhat.com/errata/RHBA-2012-0159.html

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