Hi,
I just killed a perl script that reads command output and sends it to syslog server.
The process was using several gigabytes of memory, when I killed this process, drop in memory usage was easily n in
export NMON=m ; nmon output.
I made a dummy payload shell script that prints lines for ever.
I stripped down the perl script and changed file handle to read the output from the dummy payload shell script.
Then I ran it
time ./to.syslog.plOut of memory!real 5m37.11suser 0m7.01ssys 0m0.45sI ran following loop in a another terminal
while svmon -P 28836218 -O commandline=on,format=nolimit,unit=MB,segment=ondosleep 1echodoneLast output before perl ran out of memory was
Command line : svmon -P 28836218 -O commandline=on,format=nolimit,unit=MB,segment=onUnit: MB-------------------------------------------------------------------------------Pid Command Inuse Pin Pgsp Virtual28836218 perl 204.16 49.3 0 204.04Vsid Esid Type Description PSize Inuse Pin Pgsp Virtual837283 11 work text data BSS heap sm 127.88 0 0 127.8820002 0 work kernel segment m 52.6 49.1 0 52.6990019 90000000 work shared library text m 20.1 0 0 20.1a000a 9ffffffd work shared library sm 1.36 0.02 0 1.369b001b 90020014 work shared library s 0.85 0 0 0.85b06830 9001000a work shared library data sm 0.59 0 0 0.59bb72bb f00000002 work process private m 0.31 0.19 0 0.31a66766 80020014 work USLA heap sm 0.24 0 0 0.24d000d 9ffffffe work shared library sm 0.07 0 0 0.07b20132 9fffffff clnt USLA text,/dev/hd2:4238 s 0.07 0 - -907210 10 clnt text data BSS heap, s 0.05 0 - -/dev/hd10opt:713af732f ffffffff work application stack sm 0.03 0 0 0.03aa736a 8fffffff work private load data s 0.02 0 0 0.02Then I ran this command
./to.stdout.pl > /dev/nullAnd on another terminal I ran
sleep 600 ; svmon -P 20578644 -O commandline=on,format=nolimit,unit=MB,segment=onOutput from that command was
Command line : svmon -P 20578644 -O commandline=on,format=nolimit,unit=MB,segment=onUnit: MB-------------------------------------------------------------------------------Pid Command Inuse Pin Pgsp Virtual20578644 perl 84.9 49.3 0 84.8Vsid Esid Type Description PSize Inuse Pin Pgsp Virtual20002 0 work kernel segment m 52.6 49.1 0 52.6990019 90000000 work shared library text m 24.6 0 0 24.6a01a20 11 work text data BSS heap sm 4.00 0 0 4.00a000a 9ffffffd work shared library sm 1.36 0.02 0 1.369b001b 90020014 work shared library s 1.01 0 0 1.01aa732a 9001000a work shared library data sm 0.59 0 0 0.59857345 f00000002 work process private m 0.31 0.19 0 0.31a57325 80020014 work USLA heap sm 0.24 0 0 0.24d000d 9ffffffe work shared library sm 0.08 0 0 0.08b20132 9fffffff clnt USLA text,/dev/hd2:4238 s 0.07 0 - -907210 10 clnt text data BSS heap, s 0.05 0 - -/dev/hd10opt:713987298 ffffffff work application stack sm 0.03 0 0 0.03917251 8fffffff work private load data s 0.02 0 0 0.02The only difference between these two perl scripts is that in the script first script has
syslog('local0|notice', "$line"); inside the
while() loop, while the script second script has
print "$line"; inside the
while() loop.
I've ran in to this problem using both system perl
/usr/bin/perl and AIX toolbox perl
/opt/freeware/bin/perl.
Older 5.8 and I suspect 5.10 perl versions were not affected by this memory leak, but newer such as 5.28 and 5.34 are affected.
------------------------------
Esa Kärkkäinen
------------------------------
#AIXOpenSource