Skip Menu |

This queue is for tickets about the Regexp-Grammars CPAN distribution.

Report information
The Basics
Id: 67052
Status: open
Priority: 0/
Queue: Regexp-Grammars

People
Owner: Nobody in particular
Requestors: cpan [...] bbkr.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.012
Fixed in: (no value)



Subject: Out of memory when using some regexps in autoaction method
Hi I've attached the short isolated case that produces bug. There is one rule with autoaction attached. And there is regexp used in this autoaction. It does not change or modify $match param. When I run this code on perl v5.10.0 I get "Out of memory!" error or "Segmentation fault". This is not always reproducible, looks totally random. I've read LIMITATIONS section and there is no warning about using regexps in autoactions. -- bbkr on #perl6
Subject: crash.pl
package G; use Regexp::Grammars; my $TOP = qr{ ^ <name> $ <rule: name> \w+ }x; sub interpret { my ($content, $actions) = @_; $TOP->with_actions($actions); $content =~ $TOP; } package A; sub new { my $class = shift; return bless {}, $class; } sub name { my ($self, $match) = @_; # some regexp matches in autoaction method # causes "Out of memory!" error or "Segmentation fault" my $dummy = 'abc'; $dummy =~ m/./; } package main; G::interpret('foo', A->new);
Subject: Re: [rt.cpan.org #67052] Out of memory when using some regexps in autoaction method
Date: Fri, 1 Apr 2011 06:58:00 +1100
To: bug-Regexp-Grammars [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Hi Pawel, Thanks for the bug report. I've tried for the past few days to reproduce it on my machine under the same version of Perl, but I have not been able to. Could you send a 'perl -v' listing so I can see the full configuration under which you are experiencing the problem. Also, could you tell me how much RAM you have and how big your process is getting before it segfaults. Thanks, Damian
From: cpan [...] bbkr.org
Hi, sorry for such delayed reply. I've attached "perl -V" output. This is weird case - I also cannot reproduce it directly on my another machine unless... I change $dummy length. I found no patern. It works if length is 2, crashes if length is 3, works if length is 100.. I've changed autoactions to return action closures instead of performing actions immediately and problem is solved for me.
Subject: perl_version.txt
Summary of my perl5 (revision 5 version 10 subversion 0) configuration: Platform: osname=linux, osvers=2.6.32-5-amd64, archname=i486-linux-gnu-thread-multi uname='linux biber 2.6.32-5-amd64 #1 smp wed may 18 23:13:22 utc 2011 i686 gnulinux ' config_args='-Dusethreads -Duselargefiles -Dccflags=-DDEBIAN -Dcccdlflags=-fPIC -Darchname=i486-linux-gnu -Dprefix=/usr -Dprivlib=/usr/share/perl/5.10 -Darchlib=/usr/lib/perl/5.10 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.10.0 -Dsitearch=/usr/local/lib/perl/5.10.0 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Dsiteman3dir=/usr/local/man/man3 -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Ud_ualarm -Uusesfio -Uusenm -DDEBUGGING=-g -Doptimize=-O2 -Duseshrplib -Dlibperl=libperl.so.5.10.0 -Dd_dosuid -des' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2 -g', cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -I/usr/local/include' ccversion='', gccversion='4.3.2', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib /usr/lib64 libs=-lgdbm -lgdbm_compat -ldb -ldl -lm -lpthread -lc -lcrypt perllibs=-ldl -lm -lpthread -lc -lcrypt libc=/lib/libc-2.7.so, so=so, useshrplib=true, libperl=libperl.so.5.10.0 gnulibc_version='2.7' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fPIC', lddlflags='-shared -O2 -g -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API Built under linux Compiled at Jun 19 2011 18:08:02 @INC: /etc/perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .
Subject: Re: [rt.cpan.org #67052] Out of memory when using some regexps in autoaction method
Date: Mon, 27 Jun 2011 08:43:31 +1000
To: bug-Regexp-Grammars [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Pawel, Thanks for the -v listing. I can't see anything that might account for the weird behaviour, though it may be related to the use of a threaded perl (which mine is not). Meanwhile, I'm glad you found a suitable (and clever) work-around. All the best, Damian