On Fri, Jun 13, 2008 at 04:20:45PM -0700, Philip Guenther wrote: > On Thu, Jun 12, 2008 at 3:47 PM, Toni Mueller <[EMAIL PROTECTED]> wrote: > > as of today (I didn't notice it earlier), I see this problem on one of > > my machines: > > > > # netstat -rnf inet > > netstat: sysctl of routing table: Cannot allocate memory > > "netstat -r" dumps the routing table by calling sysctl() twice, once > to get the size of the table so that it can allocate enough memory to > hold it, and then a second call to actually fill it in. That error > means the routing table grew between the two calls, so the second call > could return the entire table. >
Nope. That is not the problem. The main issues is that a full view will need a lot of memory for the sysctl. This memory needs to be available as real memory because it is wired into the kernel. If you run bgpd with full views on a box with less then 512MB of RAM you're most probably run out of memory. Theo and I had a look at this and bailing out in this situation is the right thing to do. The right fix is to just spend 50 bucks on 1-2GB of additional RAM. > > > Any idea about how to combat this, please? > > The code will need to be changed to > a) add a fudge factor to the size that was returned, and There is already enough fudge in the sysctl itself. The estimate done by the sysctl in the first run is 10% over the needed memory. > b) retry the pair of calls if the second returns ENOMEM > Will not help either. c) work around (ugly but works) netstat -rnfinet -M /dev/mem d) the route sysctl needs to be rewritten to be fully restartable and so small chunks of the table can be fetched one after the other. This is a massive change and it will not happen for the upcomming release. -- :wq Claudio