Subject: | Lingua::Ispell Large-scale Issue |
Linux System information:
1. Lingua::Ispell version 0.07
2. Perl version 5.10.1 (*) built for i486-linux-gnu-thread-multi
3. Xubuntu Linux desk01 2.6.32-22-generic #33-Ubuntu SMP Wed Apr 28
13:27:30 UTC 2010 i686 GNU/Linux
Description of Issue:
I've been successfully using your Lingua::Ispell module on a rather
large and huge scale, within one Perl program process, and it was
failing consistently after a while, with regard to the IPC::Open2::open2
ispell sub-processes. I found a very large number of defunct ispell
processes left-over hanging in the process list, by using 'ps -ef | grep
ispell'.
After referring to the IPC::Open2 man page, I fixed my problem by
putting a 'waitpid' line in your module after the 'kill' of the
Lingua::Ispell::pid in your Lingua::Ispell::_exit() subroutine. This
gives the sub-processes time to clean up quickly, before you go off and
running to do more work.
Here's what I did in Lingua/Ispell.pm, following the 'waitpid'
suggestion in the IPC::Open2 man-page:
sub _exit {
if ( $Lingua::Ispell::pid ) {
close Reader;
close Writer;
kill $Lingua::Ispell::pid;
print STDERR "Waiting ...\t"; ##DEBUG
waitpid( $Lingua::Ispell::pid, 0 ); ## REPAIR ispell defuncts
print STDERR "Wait is over.\n"; ##DEBUG
$Lingua::Ispell::pid = undef;
}
}
Thanks for Sharing!