[BusyBox 0001398]: possible memory leak

bugs at busybox.net bugs at busybox.net
Fri Jul 13 15:39:27 UTC 2007


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=1398 
====================================================================== 
Reported By:                weedy
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   1398
Category:                   Other
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             06-20-2007 23:12 PDT
Last Modified:              07-13-2007 08:39 PDT
====================================================================== 
Summary:                    possible memory leak
Description: 
I am running this script on a operwrt router with BusyBox v1.4.2 and the
mem usage just keeps rising. is there a way around this?

VPNlist="/etc/storelist" #tunnel list
while :; do
        ping -c 3 4.2.2.2 >&- 2>&- || continue
        # if 4.2.2.2 exists ping will have a exitcode equal to 0 (only
need this check once)

        while read IP STORE JUNK; do # may not need JUNK, but it doesn't
hurt
                ping -c 2 "$IP" >&- 2>&- && continue
                ping -c 3 4.2.2.2 >&- 2>&- || continue
                # if ${IP} doesn't exist ping will have a exitcode not
equal to 0
                ipsec auto --replace $STORE >&- 2>&-
                ipsec auto --up $STORE >&- 2>&- &
        done < "$VPNlist"
done

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

---------------------------------------------------------------------- 
 vda - 06-21-07 06:32  
---------------------------------------------------------------------- 
What shell do you use? 

---------------------------------------------------------------------- 
 weedy - 06-21-07 09:54  
---------------------------------------------------------------------- 
/bin/sh -> busybox 

---------------------------------------------------------------------- 
 weedy - 07-08-07 15:08  
---------------------------------------------------------------------- 
anything? 

---------------------------------------------------------------------- 
 bernhardf - 07-08-07 15:12  
---------------------------------------------------------------------- 
Your comment does not tell us what shell you are using.
So.. What shell do you use? 

---------------------------------------------------------------------- 
 weedy - 07-08-07 22:51  
---------------------------------------------------------------------- 
i (ssh'ed in) use ash /bin/ash -> busybox
script uses /bin/sh -> busybox
if this isnt what you mean could you be more specific? 

---------------------------------------------------------------------- 
 vda - 07-12-07 06:10  
---------------------------------------------------------------------- 
There is no "/bin/sh" shell. Do ls -l /bin/sh, and you will see that it is
most likely a symlink. If it is a symlink to (for example) msh - bingo,
you are using msh. If it is a symlink to /whatever/busybox, look into your
busybox .config file. If you see (for example):

CONFIG_FEATURE_SH_IS_LASH=y

then "sh" is actually lash in your busybox. 

---------------------------------------------------------------------- 
 weedy - 07-12-07 23:25  
---------------------------------------------------------------------- 
like i said /bin/sh -> busybox
lrwxrwxrwx    1 root     root            7 Jul  7 17:05 /bin/sh ->
busybox

but yeah didnt know you ment the config. as you can see its ash
#
# Shells
#
CONFIG_FEATURE_SH_IS_ASH=y
CONFIG_ASH=y 

---------------------------------------------------------------------- 
 vda - 07-13-07 08:39  
---------------------------------------------------------------------- 
I run this script under current svn's ash:

#!/bin/sh
VPNlist="storelist" #tunnel list
while :; do
        ping -c 1 127.0.0.1 >&- 2>&- || continue
        while read IP STORE JUNK; do # may not need JUNK, but it doesn't
hurt
                echo ping -c 2 "$IP"
                echo ping -c 3 4.2.2.2
                echo ipsec auto --replace $STORE
                echo ipsec auto --up $STORE
        done < "$VPNlist"
        ps -o pid,vsz,args | grep "^$$ "
done

storelist contains just one string (any string, it is not important what
exactly is there). And I see steady memory usage (vsz doesn't grow).

Can you try it? If it works for you too (vsz doesn't grow), try with YOUR
storelist, then start uncommenting pings/ipsecs/etc and let us know at
which step exactly is will start to leak again. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
06-20-07 23:12  weedy          New Issue                                    
06-20-07 23:12  weedy          Status                   new => assigned     
06-20-07 23:12  weedy          Assigned To               => BusyBox         
06-21-07 06:32  vda            Note Added: 0002494                          
06-21-07 09:54  weedy          Note Added: 0002495                          
07-08-07 15:08  weedy          Note Added: 0002578                          
07-08-07 15:12  bernhardf      Note Added: 0002579                          
07-08-07 22:51  weedy          Note Added: 0002580                          
07-12-07 06:10  vda            Note Added: 0002593                          
07-12-07 23:25  weedy          Note Added: 0002595                          
07-13-07 08:39  vda            Note Added: 0002596                          
======================================================================




More information about the busybox-cvs mailing list