Memory leak in ip_dst_cache

2 messages, 2 authors, 2011-09-09 · open the first message on its own page

Memory leak in ip_dst_cache

From: Kumar S <hidden>
Date: 2011-09-09 05:04:35

Hi,
We are running Linux-2.6.24 kernel on MPC8360. Though forwarding is disabled, when connected to public network we see the system running out of memory and rebooting frequently. After doing some study we found out slowly "ip_dst-cache" is growing, and doesn't release entries. Interestingly route entries displayed with command "ip route ls cache" show fewer than the active objects listed under "cat /proc/slabinfo | grep ip_dst_cache". After doing some study, we could reproduce it in the lab by injecting packets withdifferent source IP addresses. Ideally ageing should happen, and old entries are supposed to be cleared out, but that doesn't happen. We do see one or two entries getting agedout but not all. 
After some time we did see that "rt_run_flush" kicks in and flushes out the ip_dst_cache. That's why the "ip route ls cache" fewer entries. But looks like __chache_free() doesn't get called, that's why these entries are not really released. This results in the leak.
 
Any idea what is going wrong here. Is it a known bug?
 
Regards
psk

Re: Memory leak in ip_dst_cache

From: Eric Dumazet <hidden>
Date: 2011-09-09 05:30:30

Le jeudi 08 septembre 2011 à 22:04 -0700, Kumar S a écrit :
Hi,
We are running Linux-2.6.24 kernel on MPC8360. Though forwarding is
disabled, when connected to public network we see the system running
out of memory and rebooting frequently. After doing some study we
found out slowly "ip_dst-cache" is growing, and doesn't release
entries. Interestingly route entries displayed with command "ip route
ls cache" show fewer than the active objects listed under
"cat /proc/slabinfo | grep ip_dst_cache". After doing some study, we
could reproduce it in the lab by injecting packets withdifferent
source IP addresses. Ideally ageing should happen, and old entries are
supposed to be cleared out, but that doesn't happen. We do see one or
two entries getting agedout but not all. 
After some time we did see that "rt_run_flush" kicks in and flushes
out the ip_dst_cache. That's why the "ip route ls cache" fewer
entries. But looks like __chache_free() doesn't get called, that's why
these entries are not really released. This results in the leak.
 
Any idea what is going wrong here. Is it a known bug?
Please send :

grep . /proc/sys/net/ipv4/route/*
rtstat -c10 -i1

This a very well known problem. You need to upgrade your kernel in order
to avoid very complex tuning of your IP route cache.

Recent ones have smooth garbage collection.

In the meantime, you can tune a bit :

echo 1 >/proc/sys/net/ipv4/route/gc_interval
echo 4 >/proc/sys/net/ipv4/route/gc_elasticity
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help