IBM Support

IV54769: KSH93 BUILTIN CD MEMORY LEAK IN SUBSHELL APPLIES TO AIX 6100-09

A fix is available

Subscribe

You can track all active APARs for this component.

APAR status

  • Closed as program error.

Error description

  • When using the builtin cd in a ksh93 subshell and the cd
    change to a directory different from the current
    directory
    of the parent, a memory leak occurs.
    The problem is seen using the following example :
    #!/bin/ksh93
    mkdir /home/test 2>/dev/null
    cd /home/test
    integer i=0
    while [[ $i -lt 200 ]] ; do
      text=$(cd /tmp; exit -1)
      i=i+1
    done  2>/dev/null
    ps avg|grep $$
    i=0
    while [[ $i -lt 200 ]] ; do
      text=$(cd /tmp; exit -1)
      i=i+1
    done 2>/dev/null
    ps avg|grep $$
    
    The two ps avg outputs will show memory growth of the
    ksh93 process.
    

Local fix

  • 1/If the subshell return 0 the problem doesn't exhibit.
    2/If we move the builtin cd outside of the subshell the
    problem doesn't exhibit either, but then the current
    working directory need to be restored after the subshell
    returns
    from the example replace :
      text=$(cd /tmp; exit -1)
    by :
    cd /tmp
      text=$(exit -1)
    cd -
    Note : the exit is used here for simplification it might
    be replaced by any command that does not return 0.
    3/ If we replace the builtin "cd" in the subshell by the
    /usr/bin/cd command, the problem doesn't exhibit either.
    from the example replace :
      text=$(cd /tmp; exit -1)
    by :
      text=$(/usr/bin/cd /tmp; exit -1)
    

Problem summary

  • When using the builtin cd in a ksh93 subshell and the cd
    change to a directory different from the current
    directory of the parent, a memory leak occurs.
    

Problem conclusion

  • Code changes has been done to free the memory at relevant
    places.
    

Temporary fix

Comments

  • 6100-07 - use AIX APAR IV40257
    6100-08 - use AIX APAR IV57798
    6100-09 - use AIX APAR IV54769
    6100-09 - use AIX APAR IV54769
    6100-09 - use AIX APAR IV54769
    7100-01 - use AIX APAR IV57497
    7100-02 - use AIX APAR IV56943
    7100-03 - use AIX APAR IV54628
    7100-04 - use AIX APAR IV54614
    

APAR Information

  • APAR number

    IV54769

  • Reported component name

    AIX 610 STD EDI

  • Reported component ID

    5765G6200

  • Reported release

    610

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Submitted date

    2014-01-30

  • Closed date

    2014-01-30

  • Last modified date

    2016-05-10

  • APAR is sysrouted FROM one or more of the following:

    IV40257

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    AIX 610 STD EDI

  • Fixed component ID

    5765G6200

Applicable component levels

  • R610 PSY U861350

       UP14/10/28 I 1000

PTF to Fileset Mapping



Document information

More support for: AIX Standard Edition

Software version: 610

Operating system(s): AIX

Reference #: IV54769

Modified date: 10 May 2016