bird: memory exhausted

Job Snijders job at instituut.net
Thu Aug 10 18:13:10 CEST 2017


On Mon, Aug 07, 2017 at 03:01:49AM +0200, Ondrej Zajicek wrote:
> > > Any ideas how to increase the memory available to things on the stack?
> > 
> > Looks like you're hitting the Bison parser stack limit. The default
> > is 10000, which is probably too low, looking at your sample config
> > file.
> 
> It is true that there is a stack limit, but the core problem is that
> involved grammar rules use right recursion instead of left recursion
> like most other rules. That causes excessive stack usage.
> 
> Workaround could to use global definitions instead of local variables, i.e:
> 
> define AS1 = [ 170.238.64.0/23, 152.231.29.0/24 ];
> 
> Also note that instead of sequence of ifs it is much more efficient to
> use case expression based on asn and then just net-based test inside of
> case branch:
> 
> case asn {
>   0: return net ~ AS0;
>   1: return net ~ AS1;
>   2: return net ~ AS2;
>   ...
> }

I implemented your approach, this indeed seesm to be an optimalisation.

Thank you! :)

Kind regards,

Job


More information about the Bird-users mailing list