I only see this every few days or so, and it only comes on one
particular network. My guess is that Network Manager encounters a glitch
in the network of some description, exits from its main routine without
freeing some memory, goes into the error handling routine,  prints a
message to say there was a problem to the syslog, then returns to its
main routine, encounters the glitch again, and so on, printing about 100
000 syslog errors until I notice the problem and kill it. I had a quick
look at the source code a few weeks ago, without making much progress
(because a) I'm not familiar with certain libraries used, and b) I'm not
a very good programmer c) I haven't had any time to study this in
detail), but I did notice that the error handling routine in Network
Manager was the following:

static void
nm_error_monitoring_device_link_state (NMNetlinkMonitor *monitor,
                                                                           
GError *error,
                                                                           
gpointer user_data)
{
        /* FIXME: Try to handle the error instead of just printing it. */
        nm_warning ("error monitoring wired ethernet link state: %s\n",
                                error->message);
}

Which doesn't look very good. Even asking it to sleep for a few seconds
here, giving the network time to recover from whatever its problem was,
would probably stop it getting too badly out of control (although it
would obviously be best to find and fix the memory leak).


As a workaround, I have implemented the following script and set it as a cron 
job to run every 5 minutes:

put the following into /usr/sbin/NetworkManager.sh:
____________________________________________________________
#!/bin/sh
#script to kill NetworkManager if it gets too resource hungry
#check how much percentage memory nm is using, put it into x
x=`ps -e -o pmem -o comm | grep NetworkManager | awk '{printf("%d\n",$1)}' `
#echo $x | awk '{printf("%d\n",$1)}'
#if nm is using more than 5% of the memory, kill and restart it
if(test `echo $x | awk '{printf("%d\n",$1)}'` -ge 5); then
    echo `date`:NetworkManager.sh: "I'm about to kill NetworkManager pmem = " 
$x | logger
    killall -9 NetworkManager
    sleep 10
    NetworkManager &
fi

_______________________________________________________________

Then using sudo crontab -u root -e insert the following into the crontab
02 * * * * /usr/sbin/NetworkManager.sh
07 * * * * /usr/sbin/NetworkManager.sh
12 * * * * /usr/sbin/NetworkManager.sh
17 * * * * /usr/sbin/NetworkManager.sh
22 * * * * /usr/sbin/NetworkManager.sh
27 * * * * /usr/sbin/NetworkManager.sh
32 * * * * /usr/sbin/NetworkManager.sh
37 * * * * /usr/sbin/NetworkManager.sh
42 * * * * /usr/sbin/NetworkManager.sh
47 * * * * /usr/sbin/NetworkManager.sh
52 * * * * /usr/sbin/NetworkManager.sh
57 * * * * /usr/sbin/NetworkManager.sh

It's not at all elegant, but it seems to work.

-- 
memory leak in Network Manager Intrepid
https://bugs.launchpad.net/bugs/291074
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to