https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=297339
Bug ID: 297339
Summary: Memory leak on routing table changes with routing
algorithm radix6_lockless
Product: Base System
Version: 15.1-RELEASE
Hardware: Any
OS: Any
Status: New
Severity: Affects Some People
Priority: ---
Component: kern
Assignee: [email protected]
Reporter: [email protected]
Hi,
a while ago I installed a FreeBSD router running BGP and noticed that its
kernel memory usage consistently increased to over a gigabyte after a few days.
Recently, I found that it seems to be related to
net.route.algo.inet6.algo=radix6_lockless. Setting it to radix6 shows no more
excessive memory usage. This router only has 4000-5000 routes installed in its
IPv6 routing table, so it seemingly didn't automatically switch from
radix6_lockless to radix6. The memory buildup only happens on changes to the
routing table, and because BGP is used, such changes happen quite frequently.
To reproduce the issue, I did the following on a test VM:
- The host is a fresh minimal pkgbase installation, 15.1-RELEASE-p2
releng/15.1-n283596-aadd58dddcbc
- I installed net/bird2 on it, and configured it to receive all IPv6 routes
of the Internet BGP routing table from another router and install them in
the kernel routing table, which is around 254k routes right now
- After this,
- net.route.algo.inet6.algo is automatically set to radix6
- the "routetbl" memory usage shown by "vmstat -m" is a modest 549K, with
no increase after a while
- The router receives several routing updates per second through BGP,
shown by "route -vn monitor"
- Then, I manually changed the routing algorithm with
"sysctl net.route.algo.inet6.algo=radix6_lockless" to test (obv this
wouldn't make sense in any production system)
- "routetbl" memory usage immediately jumps to tens of megabytes, and
fluctuates between this and an additional few tens of megabytes, for
every time the routing table is rebuilt on a routing table change
- While this behavior can be expected, the memory usage also continuously
trends upwards. After just a few minutes, the "routetbl" memory usage
is hundreds of megabytes
- Changing back to radix6 gets rid of the memory usage fluctuations
(and excessive kernel CPU usage), but there is still a remaining memory
usage that never gets freed, around the high amount that it was when
switching back to radix6
All this can also be reproduced with a simple script (adjust the gateway
address):
#!/bin/sh
for i in `seq 9999`; do
route -6 add 2a04:5a80:1234:$i::/64 2a04:5a81:7101:1::10
done
sysctl net.route.algo.inet6.algo=radix6_lockless
while true; do
route -6 add 2a04:5a80:1234:a::/64 2a04:5a81:7101:1::10
route -6 del 2a04:5a80:1234:a::/64 2a04:5a81:7101:1::10
done
After a few minutes of running the script, "routetbl" memory usage goes into
the order of tens of megabytes, and neither switching back to radix6 nor
deleting all test routes frees the extra used memory.
Let me know if I can help with any more information
Thank you!
~ Wilton
--
You are receiving this mail because:
You are the assignee for the bug.
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.