Re: Cricket compile segfault

Anders Synstad <[email protected]> Thu, 26 Aug 2010 16:17:43 +0200
Newsgroups gmane.network.cricket.user
Message-ID <[email protected]>
I finaly found the root cause for this segfault, and thought I'd share 
it with whomever wants.

The 'compile' script uses ConfigTree::Node, which again uses 
Text::ParseWords. In the parse_line sub, there is a regexp that is run 
on the value from the cricket config (my very long  mtargets (45000+ 
chars)).

On my system, this causes perl itself to segfault on variables larger 
than about 20680 chars. I'm sure this number may vary from machine to 
machine. It seems like at least this version of perl simply can't handle 
running regexps on such large variables.

On my machine I'm running and old perl 5.8.8 (I know, can't blame anyone 
when running an old perl), however, upgrading is not that simple in my case.

I did use a small proof-of-concept test script to verify and test the 
problem:

	#!/local/bin/perl

	$| = 1;

	use strict;
	use warnings;
	use Text::ParseWords;

	my $start	= 20000;
	my $step	= 100;
	my $max		= 100000;

	for( my $i = $start ; $i < $max ; $i += $step ){
	        print "Testing $i characters...";
		parse_line('\s+', 0, q{x} x $i);
		print "done.\n";
	}

I also tested this script on a host running perl 5.12, and I could not 
reproduce the problem on my perl 5.12 build.

I've also tried different versions of the Text::ParseWords perl module, 
but with no luck. But that's not so strange, considering it is the 
regexp the dies, and not something else in the code.



Regards,
Anders Synstad
Basefarm AS

On 07/19/2010 01:37 PM, Anders Synstad wrote:
> Hello,
>
> Unsure if this mailing list is still alive, but thought I should give it
> a go.
>
> I'm currently having some issues with Cricket's compile. One of the
> configuration files I generate, contain 'mtargets = ""' with a large
> number of targets (1000+). This seems to cause compile to segfault
> consistently. :(
>
> Another config file have mtargets with aprox 300 targets. And this seems
> to work fine.
>
> Before I started to investigate the deep and gory perl details, I was
> wondering if anyone had experienced this and possible had a solution for it?
>
>
> Regards,
> Anders Synstad
> Basefarm AS
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> cricket-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/cricket-users


------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d