[imp] run away ispell processes
Adam Arrowood
adam@oit.gatech.edu
Thu, 11 Jul 2002 15:19:55 -0400
Darci Tartari wrote:
> Same happened to me! When IMP run ispell all my CPU is loaded with that
> process. I am using a FreeBSD 4.5 and Horde 2.1-RC3, imp 3.1-RC3, turba
> 1.1-RC-3, kronolith 1.0, nag 1.0, passwd 2.0, php 4.1.1 with FTP
> Support: Yes; Gettext Support: Yes; IMAP Support: Yes; LDAP Support: No;
> MCAL Support: Yes; Mcrypt Support: Yes; MySQL Support: Yes; PostgreSQL
> Support: Yes; XML Support: Yes.
>
> I do not know how to deal with this situation....
>
> Bye,
>
> Darci Tartari
>
> Mark G. Thomas wrote:
>
>> Hi,
>>
>> On Sun, Jun 02, 2002 at 08:01:33AM -0600, Shawn Robinson wrote:
>>> At 06:45 PM 2002/04/17 -0400, Chuck Hagenbuch wrote:
>>>> Quoting Jeff Tucker <jefft@wciatl.com>:
>>>>> I'm definitely experiencing it and had to disable spell checking on my
>>>>> system because of it. I routinely got these runaway ispells using as
>>>>> much processor time as possible.
>>>>>
>>>> Well, we need feedback from people who can actually reproduce the
>>>> problem...
>>>>
>>>> -chuck
>>>>
>>> Did this one get resolved? I can't find the solution.
>>>
>>
>> I'm also experiencing it here. Exactly same symptoms as described
>> below. I'm running Solaris-8, imp-3.0, horde-2.0, turba-1.0. I eagerly
>> await any suggestions about how to resolve this. Ever since my users
>> got a taste of spell checking they have been bugging me to enable it
>> again...
>>
>> - Mark Thomas
>>
>>> Seems to be a pipe control issue of some sort. The httpd process
>>> that starts the 'echo $string | /usr/locla/bin/ispell ' starts
>>> growing uncontrollably, (in my case it has eaten up close to 1.5GB
>>> before I've killed it). After 'kill -9'ing the httpd process, the
>>> associate ispell process starts taking up the CPU, when trussing it,
>>> you can see that it's trying to write to the pipe, and is receiving a
>>> SIGPIPE, and looping uncontrollably. Then, after a 'kill' on the
>>> ispell process, httpd takes it's turn at sucking up the CPU cycles.
>>> After you kill on that httpd process, you're happy again, until next
>>> time.
>>> I lost my truss data, but I can send it on next time it happens.
>>>
>>> [...]
>>>
>>> Regards,
>>> Shawn Robinson
I have run into the same problem, and think I have a work around. It
seems to be a problem with echo'ing large (>1024 character) strings
piped into ispell. I have written some test cases in php (outside of
IMP), and it does occur, but not every time. I can say that it I've only
had it happen with large messages, but not every large message hangs it.
Anyway, my work around is to dump the message into a tmp file and
call a shell script to pipe it through ispell.
1) created a shell script, /usr/local/bin/ispell-imp , containing:
#! /bin/sh
/usr/bin/cat $1 | /usr/local/bin/ispell -a
Of course you may have to change some paths, depending on your
system... Then I chmod it 755 to make it executable.
2) in imp/spelling.php, changed the exec line that calls the
spellchecker to:
//exec("echo $tocheck | " . $conf['utils']['spellchecker'] . ' -a ' .
$spell_opt, $warnings);
$tmpfname = tempnam ("/tmp", "IMP-spellcheck");
$fp = fopen($tmpfname, "w");
fwrite($fp, $tocheck);
fclose($fp);
exec("/usr/local/bin/ispell-imp $tmpfname", $warnings);
unlink($tmpfname);
That *seems* to work. We are running IMP rotor'd across four machines
and the hanging ispell problem was happening several times an hour on
all four machines. After making the change(s), I haven't seen a single
hung process. It's been 24 hours, so I'm kinda assuming it works...
I kind of like this way of doing it, given that shellescaping could be
turned off...
Your milage may vary, but I hope this helps...
-adam
--
Adam Arrowood || http://www.gatech.edu/adam || adam@oit.gatech.edu
Office of Information Technology/O&E/CS
Georgia Institute of Technology, Atlanta, GA USA
(404) 894-0372 work || (404) 310-0108 cell