bird: memory exhausted

Ondrej Zajicek santiago at crfreenet.org
Mon Aug 7 03:01:49 CEST 2017


On Sun, Aug 06, 2017 at 10:52:27PM +0200, Andre van Zyl wrote:
> On Sun, 6 Aug 2017 16:24:24 +0200
> Job Snijders <job at instituut.net> wrote:
> 
> > Dear all,
> > 
> > It appears I'm hitting some kind of limit in yacc stuff (on 1.6.3-1+trusty+1):
> > 
> > 	router# bird -c rpki-match-roa-ipv4.conf  -p
> > 	bird: rpki-match-roa-ipv4.conf, line 4998: memory exhausted
> > 
> > The error message is generated by generated code:
> > 
> > 	$ grep -r 'memory exhausted' *
> > 	Binary file bird matches
> > 	obj/conf/cf-parse.tab.c:        yyoverflow (YY_("memory exhausted"),
> > 	obj/conf/cf-parse.tab.c:  yyerror (YY_("memory exhausted"));
> > 	Binary file obj/conf/all.o matches
> > 	Binary file obj/conf/cf-parse.tab.o matches
> > 
> > The config file can be found here: http://instituut.net/~job/rpki-match-roa-ipv4.conf.txt
> > 
> > Any ideas how to increase the memory available to things on the stack?
> > 
> > Kind regards,
> > 
> > Job
> 
> Hi Job,
> 
> 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.

Hi

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;
  ...
}

-- 
Elen sila lumenn' omentielvo

Ondrej 'Santiago' Zajicek (email: santiago at crfreenet.org)
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20170807/09675b73/attachment.asc>


More information about the Bird-users mailing list