[Xorp-hackers] BGP and exceptions

Ben Greear greearb at candelatech.com
Thu Apr 22 08:43:27 PDT 2010

On 04/22/2010 02:23 AM, Bruce Simpson wrote:
> Ben Greear wrote:

>> Does anyone have any strong attraction to using exceptions, or can
>> we move to returning NULL and/or checking an 'is_valid()' flag
>> on the attributes instead of throwing lots of exceptions?
> It's how we've always done things, as it's a good use of the language
> and helps to cut down on cluttering the code with conditionals.

I'm not sure about the conditionals thing.  Sure, the bgp code is clean of
conditionals..but to be stable and robust, we'll have to add a lot of
try / catch logic, and since we currently get no useful backtraces of
what call chain caused the exception, debugging each instance is slow
and painful, even if you have a reproducible test case.

A functional backtrace logic would be very useful, but it would have
to be fast enough that it could run in the hot path to keep someone
from being able to DOS the box into submission with faulty input
that throws exceptions.

Maybe if the backtrace work was only done when we have an un-caught exception
or otherwise explicitly wanted to print out the backtrace, it would be fine.

> +1 for staying with exceptions.

I'll work with them for now...


Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

More information about the Xorp-hackers mailing list