perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug MacEachern <>
Subject Re: END blocks in perl modules
Date Wed, 01 Mar 2000 05:49:36 GMT
On Sat, 12 Feb 2000, Ilya Obshadko wrote:

> Hello modperl,
>   Yet another mystic thing. I've been messing around with
>   IPC::Shareable. The purpose was just simple: create shared memory
>   segment on startup, give access to it for all child processes,
>   destroy this segment after httpd shutdown. I've encountered a
>   strange problem with the last action. I did not understand what's
>   going on until I've printed PIDs that execute cleanup to STDERR.
>   Then I found that END block IS NOT BEING EXECUTED BY PARENT
>   HTTPD PROCESS. Of course httpd child, that is executed with ordinary
>   user privileges, cannot destrroy shm object owned by root :(
>   Question 2 all, (and especially to Doug): was this behaviour
>   implemented 'on purpose', or it is just 'undocumented feature'? ;)

END blocks are not run by the parent process, because the child_exit
handler is not called by the parent process.  the parent calls setuid
after it gets ahold of port 80 anyhow, so you wouldn't have root privs to
destroy the shm object.  why not just create it during PerlChildInit?
if you really need an END in the parent process, we could make that happen
using atexit()

View raw message