Skip Menu |

This queue is for tickets about the String-Approx CPAN distribution.

Report information
The Basics
Id: 4390
Status: resolved
Priority: 0/
Queue: String-Approx

People
Owner: Nobody in particular
Requestors: idallen [...] idallen.ca
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 3.22
Fixed in: 3.23



Subject: perl 5.8.1 core dump using String::Approx version 3.22
The file "test.pl.txt" is at: http://ian.idallen.ca/test.pl.txt The file "input.txt" is at: http://ian.idallen.ca/input.txt $ gdb /usr/bin/perl GNU gdb 5.3-25mdk (Mandrake Linux) This GDB was configured as "i586-mandrake-linux-gnu"... (no debugging symbols found)... (gdb) run -w ~/public_html/test.pl.txt ~/public_html/input.txt Starting program: /usr/bin/perl -w ~/public_html/test.pl.txt ~/public_html/input.txt (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... Total questions read: 7 DEBUG1 6 DEBUG2 6 DEBUG3 6 (no debugging symbols found)... Program received signal SIGSEGV, Segmentation fault. 0x4027cc64 in mallopt () from /lib/i686/libc.so.6 (gdb) where #0 0x4027cc64 in mallopt () from /lib/i686/libc.so.6 #1 0x4027c58a in calloc () from /lib/i686/libc.so.6 (gdb)
From: Jarkko.Hietaniemi <jhi [...] iki.fi>
Subject: Re: [cpan #4390] perl 5.8.1 core dump using String::Approx version 3.22
Date: Mon, 17 Nov 2003 23:17:16 +0200
To: bug-String-Approx [...] rt.cpan.org
RT-Send-Cc:
I'm afraid this will require a bit more debugging from your side since I have no problems with test script and input in Mac OS X with 5.8.2, with either normal Perl and and Perl compiled with -g. -- Jarkko Hietaniemi <jhi@iki.fi> http://www.iki.fi/jhi/ "There is this special biologist word we use for 'stable'. It is 'dead'." -- Jack Cohen
Show quoted text
> I'm afraid this will require a bit more debugging from your side > since I have no problems with test script and input in Mac OS X > with 5.8.2, with either normal Perl and and Perl compiled with -g.
I compiled perl 5.8.2 (i586) and ran the same example. Core dump. I moved the examples and some "strace" outputs to: http://ian.idallen.ca/perltextbug/ I give a larger program and larger example that also core dumps. (The larger program was the one where I first noticed the problem.)
Show quoted text
> I compiled perl 5.8.2 (i586) and ran the same example.
So I recompiled perl 5.8.2 using just the distribution defaults (no added Mandrake options such as "i386-linux-thread-multi"). Now, perl runs the small test program with both large and small input files without core dumps. It runs the large program with the small input file. But, it still core dumps on the big program and the big input file: $ ./bigtest.pl.txt ./biginput.txt Total questions read: 110 Segmentation fault (core dumped) 134.410u 0.090s 2:47.19 80.4% 0+0k 0+0io 406pf+0w Exit 139 $ ls -l core.2826 -rw------- 1 idallen idallen 127188992 Nov 28 02:15 core.2826 I got a bigger GDB trace this time (this perl wasn't stripped): (gdb) where #0 0x40105c64 in mallopt () from /lib/i686/libc.so.6 #1 0x4010558a in calloc () from /lib/i686/libc.so.6 #2 0x40023b3f in apse_set_edit_distance () from /usr/local/lib/perl5/site_perl/5.8.2/i686-linux/auto/String/Approx/Approx.so #3 0x40024db7 in _apse_match () from /usr/local/lib/perl5/site_perl/5.8.2/i686-linux/auto/String/Approx/Approx.so #4 0x40023dbb in apse_slice () from /usr/local/lib/perl5/site_perl/5.8.2/i686-linux/auto/String/Approx/Approx.so #5 0x400218be in XS_String__Approx_slice () from /usr/local/lib/perl5/site_perl/5.8.2/i686-linux/auto/String/Approx/Approx.so #6 0x080c600e in Perl_pp_entersub () #7 0x080bf86d in Perl_runops_standard () #8 0x080616bb in perl_run () #9 0x0805e327 in main () #10 0x400a8c57 in __libc_start_main () from /lib/i686/libc.so.6 I'll add some of this to the typescript.txt file, along with another strace output file (trace8.txt).
From: Jarkko.Hietaniemi <jhi [...] iki.fi>
Subject: Re: [cpan #4390] perl 5.8.1 core dump using String::Approx version 3.22
Date: Fri, 28 Nov 2003 21:16:10 +0200
To: bug-String-Approx [...] rt.cpan.org
RT-Send-Cc:
Show quoted text
> (gdb) where > #0 0x40105c64 in mallopt () from /lib/i686/libc.so.6 > #1 0x4010558a in calloc () from /lib/i686/libc.so.6 > #2 0x40023b3f in apse_set_edit_distance () > from > /usr/local/lib/perl5/site_perl/5.8.2/i686-linux/auto/String/Approx/ > Approx.so > #3 0x40024db7 in _apse_match ()
If you could compile a Perl with -Doptimize=-g and reinstall also String::Approx with OPTIMIZE=-g so that we could see the exact line of apse_set_edit_distance() the crash happens at. -- Jarkko Hietaniemi <jhi@iki.fi> http://www.iki.fi/jhi/ "There is this special biologist word we use for 'stable'. It is 'dead'." -- Jack Cohen
Show quoted text
> If you could compile a Perl with -Doptimize=-g and reinstall also > String::Approx > with OPTIMIZE=-g so that we could see the exact line of > apse_set_edit_distance() > the crash happens at.
Before running the big program and the big file, I used valgrind to check the small program. Even though the program ran to completion, valgrind found some memory access errors. See: http://ian.idallen.ca/perltextbug/README-valgrind.txt After the warnings about the C library are a few thousand warnings about "Invalid read" and "Invalid write" by the string library.
From: Jarkko.Hietaniemi <jhi [...] iki.fi>
Subject: Re: [cpan #4390] perl 5.8.1 core dump using String::Approx version 3.22
Date: Fri, 28 Nov 2003 23:13:48 +0200
To: bug-String-Approx [...] rt.cpan.org
RT-Send-Cc:
Okay, thanks, the valgrind errors are a good find. -- Jarkko Hietaniemi <jhi@iki.fi> http://www.iki.fi/jhi/ "There is this special biologist word we use for 'stable'. It is 'dead'." -- Jack Cohen
Show quoted text
> Okay, thanks, the valgrind errors are a good find.
I've uploaded some other runs of valgrind using the small test program: README-valgrind2.txt README-valgrind3.txt I'm running a valgrind of the big program on the big input file; that may take a few hours to finish. I'll also do the big prorgram on the small input file too.
From: idallen [...] idallen.ca
Show quoted text
> I'm running a valgrind of the big program on the big input file; that may > take a few hours to finish.
After three hours, it finished: README-valgrind5.txt (The program finished! No core dump.) I ran the same big program with the same big input file but no valgrind: README-g.txt The program core dumped. As is so often the case with memory errors, running the program with memory debugging on produced different results than running without memory debugging. Knowing nothing about the code, I simply went to where valgrind said the memory was allocated in apse_set_edit_distance (apse.c:451) and added one to the first argument to calloc() and four to the second. I re-ran the small program against the small input file and got zero memory errors. I ran the big program against the big input file without valgrind (this caused the core dump, above) and it worked fine. Over to you!
From: Jarkko Hietaniemi <jhi [...] iki.fi>
Subject: Re: [cpan #4390] perl 5.8.1 core dump using String::Approx version 3.22
Date: Sun, 30 Nov 2003 11:04:42 +0200
To: bug-String-Approx [...] rt.cpan.org
RT-Send-Cc:
(After some debugging with valgrind) This is very curious. I do see the same errors with valgrind -- but when I try to pin them down they are very elusive. If I set up an assertion to the "reset loop" claimed to be doing the naughty memory accesses, the assertion never fails, i.e. the index never points outside the calloc()ated area... -- Jarkko Hietaniemi <jhi@iki.fi> http://www.iki.fi/jhi/ "There is this special biologist word we use for 'stable'. It is 'dead'." -- Jack Cohen
From: Jarkko Hietaniemi <jhi [...] iki.fi>
Subject: Re: [cpan #4390] perl 5.8.1 core dump using String::Approx version 3.22
Date: Sun, 30 Nov 2003 11:09:13 +0200
To: bug-String-Approx [...] rt.cpan.org
RT-Send-Cc:
Scratch my assertion assertion -- I can get it to fail now. Diving back... -- Jarkko Hietaniemi <jhi@iki.fi> http://www.iki.fi/jhi/ "There is this special biologist word we use for 'stable'. It is 'dead'." -- Jack Cohen
From: idallen [...] idallen.ca
Your mailbox is full: (host mail.iki.fi[212.16.100.1] said: 452 4.4.5 Insufficient disk space; try again later (in reply to MAIL FROM command)) jhi@iki.fi