Skip Menu |

This queue is for tickets about the Text-Aspell CPAN distribution.

Report information
The Basics
Id: 20262
Status: resolved
Priority: 0/
Queue: Text-Aspell

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

Bug Information
Severity: Important
Broken in: 0.05
Fixed in: 0.06



Subject: aspell segfaulting when run under mod_perl
Dear Bill, I found Text::Aspell to segfault when run under mod_perl. I traced the problem down to DESTROY method -- when I commented it out, apache stopped segfaulting. I then replaced two occurences of safemalloc and safefree with their regular equivalents (see the attached patch) and things started to work. I am not sure this is the best solution to the problem, because I do not know *why* it fixed the problem (why are you using safe* functions?) Note that this problem has been reported a couple of times before (see the links below), but I could google no solution to this. What are your thoughts on this? Thank you, - Dmitri. Text::Aspell 0.05 Fedora Core 5 gcc (GCC) 4.1.1 20060525 (Red Hat 4.1.1-1) Perl v5.8.8 built for i386-linux-thread-multi aspell 0.60.3-5 apache 2.2.0 mod_perl 2.0.2 http://lists.kuro5hin.org/pipermail/scoop-help/2003-May/001859.html http://lists.kuro5hin.org/pipermail/scoop-help/2003-May.txt
Subject: aspell.xs.patch.txt
--- Aspell.xs.orig 2006-07-03 14:46:24.000000000 -0400 +++ Aspell.xs 2006-07-03 14:46:29.000000000 -0400 @@ -54,7 +54,7 @@ new(CLASS) char *CLASS CODE: - RETVAL = (Aspell_object*)safemalloc( sizeof( Aspell_object ) ); + RETVAL = (Aspell_object*)malloc( sizeof( Aspell_object ) ); if( RETVAL == NULL ){ warn("unable to malloc Aspell_object"); XSRETURN_UNDEF; @@ -80,7 +80,7 @@ if ( self->speller ) delete_aspell_speller(self->speller); - safefree( (char*)self ); + free( (char*)self ); int
(apologize if this appears as a duplicate -- comment did not show up the first time). I tried investigating this further. Unfortunately, I am far from Perl internals hacker, but this is what I have come up with: - safemalloc is translated to Perl_safesysmalloc on my system (ran with gcc -E Aspell.c to figure that out). - Perl_safesysmalloc is used to make sure threads do not break each other's memory allocations. - aspell is not thread-safe (http://aspell.net/), so using safemalloc instead of malloc does not make a difference -- Text::Aspell is not thread-safe anyway. Given the above, I propose using regular malloc/free for the time being. - Dmitri.