Subject: Re: routed eating all the cpu time
To: None <erh@nimenees.com>
From: Andrew Gillham <gillhaa@ghost.whirlpool.com>
List: current-users
Date: 06/01/2000 22:21:42
erh@nimenees.com writes:
> 	I don't know.  But as a start, you might try running routed so
> it uses up a bunch of CPU, then do "gdb routed" followed by
> "attach <pid of running routed>" followed by "where" and see if that leads
> you anywhere.  (you might want to build a debugging version first)

#0  0x80720c7 in __sysctl ()
#1  0x8071f62 in _sysctl ()
#2  0x80490a2 in ifinit () at if.c:717
#3  0x8048834 in iflookup (addr=1913590481) at if.c:275
#4  0x8051881 in read_d () at rdisc.c:998
#5  0x804c3e0 in main (argc=0, argv=0xbfbfd984) at main.c:523
#6  0x80481c5 in ___start ()

The offending code in src/sbin/routed/if.c:
        for (;;) {
                if ((needed = sysctl_buf_size) != 0) {
line 717 --->>          if (sysctl(mib, 6, sysctl_buf,&needed, 0, 0) >= 0)
                                break;
                        /* retry if the table grew */
                        if (errno != ENOMEM && errno != EFAULT)
                                BADERR(1, "ifinit: sysctl(RT_IFLIST)");
                        free(sysctl_buf);
                        needed = 0;
                }
                if (sysctl(mib, 6, 0, &needed, 0, 0) < 0)
                        BADERR(1,"ifinit: sysctl(RT_IFLIST) estimate");
                sysctl_buf = rtmalloc(sysctl_buf_size = needed,
                                      "ifinit sysctl");
        }

It appears that routed is getting stuck in a buzz loop here.
This happens even without aliases on an interface.  I have only
three interfaces, epic0, wi0, and ppp0, and none of them have an
alias.  I believe this happens regardless of whether the ppp0 changes
state or not.

Any ideas here?  Is a 'for (;;)' the best thing here?

-Andrew
-- 
-----------------------------------------------------------------
Andrew Gillham                            | NetBSD ist Affengeil.
gillham@whirlpool.com                     | Nachts ist es kaelter
I speak for myself, not for my employer.  | als draussen.