On Mon, 15 May 2000, Leonardo Madrigal wrote:
> Hi everyone!
>
> Im working on some scripts that run under mod_perl via
> Apache::Registry, on the latest stable versions of mod_perl and apache
> under FreeBSD 3.3-stable.
>
>
> This scripts make authentication to cybercash using the api that they
> provide.
>
> The problem is that in the API are 2 programs (binarys made in C) that
> are called, if i ran the scripts under Apache::Registry, when the perl
> scripts are done and the httpd proccess end, the 2 programs now are in
> zombie state, for every request.
>
> If i dont use mod_perl the scripts are ok. No zombie proccesses.
>
> This is the code from cybercash that runs the first one:
> MCKencrypt="/usr/local/bin/mckencrypt";
> unless (open2(\*CIPHER, \*PLAINTEXT, $MCKencrypt)) {
> return($E_EncryptFailed, &MCKGetErrorMessage($E_EncryptFailed));
> }
>
> As you can see, they use open() and my perl was not compiled with sfio
> support.
i don't see you call close() on CIPHER and PLAINTEXT, which will
trigger a zombie since those filehandles are global. if you at least
local-ize them, or use a lexical glob (like Symbol::gensym or 'open my
$fh, ...' w/ 5.6.0), Perl will take care to cleanup for you.