Bug 145612

Summary: severe memory leak (400Mb+) in system-config-network-gui during startup
Product: [Fedora] Fedora Reporter: Dave Mitchell <davem>
Component: system-config-networkAssignee: Harald Hoyer <harald>
Status: CLOSED NOTABUG QA Contact:
Severity: high Docs Contact:
Priority: medium    
Version: 3   
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-01-20 20:35:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dave Mitchell 2005-01-20 02:13:40 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5)
Gecko/20041111 Firefox/1.0

Description of problem:
During startup from applications > System settings > Network, the
python process consumes all CPU and its memory footprint grows to over
400Mb. This startup footprint seems to have been gradually increasing
over time.

I'm using a Dell D400 laptop with a broadcom 1Gbit ether, a Centrino
ipw2100 wireless, and an internal modem.

Nothing particulary complex in my setup, just a handful of profiles:

# ls -li /etc/sysconfig/networking/*
/etc/sysconfig/networking/devices:
total 56
1558240 -rw-r--r--  2 root root 191 Jan 19 11:19 ifcfg-eth0
1558242 -rw-r--r--  3 root root 249 Jan 19 11:19 ifcfg-eth0_fdi
1554555 -rw-r--r--  5 root root 304 Jan 19 11:19 ifcfg-eth1
1559529 -rw-r--r--  1 root root 340 Jan 19 11:19 ifcfg-eth1_spearing
1559527 -rw-r--r--  5 root root 370 Jan 19 11:19 ifcfg-uklinux
1554558 -rw-------  5 root root  31 Jan 19 11:19 keys-eth1
1553516 -rw-------  1 root root  31 Jan 19 11:19 keys-eth1_spearing

/etc/sysconfig/networking/profiles:
total 24
1553805 drwxr-xr-x  2 root root 4096 Jan 19 11:19 default
1620571 drwxr-xr-x  2 root root 4096 Jan 19 11:19 fdi
2240735 drwxr-xr-x  2 root root 4096 Jan  7 00:13 spearings

# ls -li /etc/sysconfig/networking/profiles/*
/etc/sysconfig/networking/profiles/default:
total 44
1554557 -rw-r--r--  2 root root 221 Jan 19 11:19 hosts
1554555 -rw-r--r--  5 root root 304 Jan 19 11:19 ifcfg-eth1
1559527 -rw-r--r--  5 root root 370 Jan 19 11:19 ifcfg-uklinux
1554558 -rw-------  5 root root  31 Jan 19 11:19 keys-eth1
1554559 -rw-r--r--  1 root root   0 Jan 19 11:19 network
1557481 -rw-r--r--  2 root root  50 Jan 19 11:19 resolv.conf

/etc/sysconfig/networking/profiles/fdi:
total 52
1620575 -rw-r--r--  2 root root 115 Jan 19 11:19 hosts
1558242 -rw-r--r--  3 root root 249 Jan 19 11:19 ifcfg-eth0_fdi
1554555 -rw-r--r--  5 root root 304 Jan 19 11:19 ifcfg-eth1
1559527 -rw-r--r--  5 root root 370 Jan 19 11:19 ifcfg-uklinux
1554558 -rw-------  5 root root  31 Jan 19 11:19 keys-eth1
1620573 -rw-r--r--  1 root root   0 Jan 19 11:19 network
1620574 -rw-r--r--  2 root root  50 Jan 19 22:16 resolv.conf

/etc/sysconfig/networking/profiles/spearings:
total 52
2240738 -rw-r--r--  1 root root 115 Jan 19 11:19 hosts
1558240 -rw-r--r--  2 root root 191 Jan 19 11:19 ifcfg-eth0
1554555 -rw-r--r--  5 root root 304 Jan 19 11:19 ifcfg-eth1
1559527 -rw-r--r--  5 root root 370 Jan 19 11:19 ifcfg-uklinux
1554558 -rw-------  5 root root  31 Jan 19 11:19 keys-eth1
2240736 -rw-r--r--  1 root root   0 Jan 19 11:19 network
2240737 -rw-r--r--  1 root root  50 Jan 19 11:19 resolv.conf


Version-Release number of selected component (if applicable):
system-config-network-1.3.22-1

How reproducible:
Always

Steps to Reproduce:
1. run Applications > System settings > Network
2. supply root password
    

Actual Results:  processes' swap grows to 400Mb+ over the course of a
couple of minutes, with CPU maxed out. This is before the app's main
window appears.
During this, top shows various modprobes running.

Additional info:

Clearly there is some state on my system that causes this, but I don't
know what. I presume you'll have to prompt me for further info.

strace showed the following frequency of system calls:

4915213 mremap
   3722 open
   2981 stat64
   2496 read
   1987 close
   1946 fstat64
   1526 ioctl
   1454 gettimeofday
   1275 mmap2
   1000 poll
    903 getdents64
    709 munmap
    438 fcntl64
    336 _llseek
    256 old_mmap
    185 write
    145 access
    134 rt_sigaction

and the most frequent pathnames passed to open() were:

     18 /root/.gnome2/system-config-network
     14 /etc/ld.so.cache
      8 /proc/modules
      5 /usr/share/system-config-network/ltihooksmodule.so
      5 /usr/share/system-config-network/ltihooks.py
      5 /usr/share/system-config-network/ltihooks.pyc
      5 /usr/share/system-config-network/ltihooks.so

Comment 1 Harald Hoyer 2005-01-20 09:12:24 UTC
hmm, there is no such thing llike
/usr/share/system-config-network/ltihooks* on my system and it doesn't
belong to system-config-network... please provide the output of:
$ rpm -qf /usr/share/system-config-network/ltihooks*

Comment 2 Dave Mitchell 2005-01-20 11:57:12 UTC
There aren't any such files on my system either. It must be trying to
open them and failing.

Comment 3 Harald Hoyer 2005-01-20 13:14:08 UTC
what does a 
$ locate ltihooks.so
provide?

Comment 4 Dave Mitchell 2005-01-20 13:47:22 UTC
Nothing, but I turned off slocate db updating shortly after install,
to increase laptop perfomance.
So I also ran a find on / and didn't get anything either.

Just a suggestion; I'm not familar with python (I'm a Perl man myself),
but if you were to supply me with a line or two of python that splits
out a debugging string and the current memory usage of the process
(what in Perl might be
    print "XXX foo:\n"; system "ps -flp $$";
)
then I could start sticking such lines in the code and see where it
gets stuck consuming memory.

Dave.

Comment 5 Harald Hoyer 2005-01-20 15:18:15 UTC
import commands
import os
import time

while 1:
        print commands.getoutput("ps -flp %d" % os.getpid())
        time.sleep(1)


Comment 6 Harald Hoyer 2005-01-20 15:22:37 UTC
I put in netconfpkg/gui/maindialog.py method 
    def updateDevicelist(self):
+        import commands
+        print commands.getoutput("ps -flp %d" % os.getpid())
        activedevicelistold = self.activedevicelist
        self.activedevicelist = NetworkDevice().get()


Comment 7 Harald Hoyer 2005-01-20 15:23:27 UTC
[harald@jever src]$ sudo ./netconf.py
F S UID        PID  PPID  C PRI  NI ADDR SZ WCHAN  STIME TTY         
TIME CMD
4 S root     21144 21143 32  75   0 -  9403 pipe_w 16:22 pts/2   
00:00:01 /usr/bin/python ./netconf.py
F S UID        PID  PPID  C PRI  NI ADDR SZ WCHAN  STIME TTY         
TIME CMD
4 S root     21144 21143 18  75   0 -  9404 pipe_w 16:22 pts/2   
00:00:01 /usr/bin/python ./netconf.py
F S UID        PID  PPID  C PRI  NI ADDR SZ WCHAN  STIME TTY         
TIME CMD
4 S root     21144 21143 12  75   0 -  9404 pipe_w 16:22 pts/2   
00:00:01 /usr/bin/python ./netconf.py
F S UID        PID  PPID  C PRI  NI ADDR SZ WCHAN  STIME TTY         
TIME CMD
4 S root     21144 21143  9  75   0 -  9404 pipe_w 16:22 pts/2   
00:00:01 /usr/bin/python ./netconf.py


Comment 8 Dave Mitchell 2005-01-20 18:02:44 UTC
By adding print statements, I've determined that the memory suck
occurs during the call to
        ConfModules.__init__(self, filename)
in netconfpkg/NCHardwareList.py, within
class MyConfModules(ConfModules):
    def __init__(self, filename = None):

but I can't locate ConfModules.__init__, so I can't narrow it down
further yet.


Comment 9 Dave Mitchell 2005-01-20 20:35:40 UTC
Aha, found the problem. Sorry, it was nothing to do with config-network.
As it happends, my /etc/modprobe.conf had grown to 60Mb due to a buggy
modem driver trying to comment out lines it didn't like, and
accidently doubling the length of the line each time.