LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 11-17-2006, 11:42 AM   #1
paulbutcher
LQ Newbie
 
Registered: Jul 2005
Posts: 8

Rep: Reputation: 0
Leaking PF_NETLINK sockets


We have a cluster of servers, the members of which are regularly getting into memory problems. We have tracked the problem down to leaking PF_NETLINK sockets, but are having a hard time taking the diagnosis further.

We would very much appreciate pointers on where to go from here.

The servers are Linux From Scratch systems with grsecurity:
Code:
> uname -a
Linux re5ult01 2.4.29 #1 SMP Fri Sep 22 16:59:43 BST 2006 i686 GenuineIntel unknown GNU/Linux
They're running a Ruby on Rails webapp of our own devising on top of MySQL 4.1.12 and Apache 2.2.3.

Over time, memory gradually disappears. We've tracked this down to sockets being allocated by never freed. For example on a server which has been up for approximately 2 days we get the following:
Code:
> vmstat -m | grep sock
sock                     151544 151544   1024  37886
> cat /proc/net/netlink | wc
 151728 1213811 8876149
> vmstat -m | grep sock
sock                     151968 151968   1024  37992
Killing processes has no effect on the number of extant sockets, the only way we have found to free the memory is to reboot the machine.

Sockets are leaking at a rate of approximately one per second:
Code:
> date && vmstat -m | grep sock
Fri Nov 17 17:36:53 GMT 2006
sock                     151876 151876   1024  37969
> date && vmstat -m | grep sock
Fri Nov 17 17:36:58 GMT 2006
sock                     151880 151880   1024  37970
What we don't know how to do is track down where these sockets are being allocated and why they might not be being freed. Suggestions and advice very welcome!

Thanks in advance,

Paul
 
Old 11-19-2006, 01:47 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
The most important use of a netlink socket is to get/set routing info. That's why I suspect your routing daemon (or any other routing service you have). As an experiment, turn it off (of course, it doesn't make it certain). What kind of software do you use? Check for updates. If you have a patched version, check your patches carefully.
 
Old 11-23-2006, 03:37 AM   #3
paulbutcher
LQ Newbie
 
Registered: Jul 2005
Posts: 8

Original Poster
Rep: Reputation: 0
Thanks for the help. We think that we've fixed it by upgrading to 2.4.33. In particular, we think that this was the problem:

http://linux.exosec.net/kernel/2.4-h...9-hf3/CONTENTS
in particular the bit that reads

+ netlink_remove-unhash-leaks-sockets-1
(Patrick McHardy)

netlink_remove() only unhashes sockets contained in the
first hash bucket. This leads to leaking sockets and,
over time, to bind conflicts which confuse iproute.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
kernel leaking? caused by bittornado? restless Linux - Kernel 2 08-12-2006 03:16 PM
memory leaking in FC3 with tomcat installed. Please help alphaque Fedora 0 01-03-2006 09:56 PM
RH3 memory leaking - kernel upgrade? christopherccv Linux - Enterprise 1 09-14-2005 06:07 PM
memory leaking in Qt program ih1008 Programming 0 10-08-2004 07:49 PM
sockets andox Programming 4 07-05-2003 07:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 05:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration