perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Foertsch <torsten.foert...@gmx.net>
Subject Re: AW: Apache::SizeLimit ( mp1 and mp2 )-> I think there is a logical error in the code ...
Date Fri, 10 Jun 2005 07:17:55 GMT
I think that can be considered a bug in mp1. I remember I tried to show the 
behaviour with mp2 without success when the first message of the thread came 
in. A check on the source shows that mp2 has a ChildInit handler that resets 
PL_ppid if MP_MAINTAIN_PPID is defined. mp1 has obviously no such hook.

Andreas, have you tried out to call Perl::AfterFork::reinit from a 
ChildInitHandler? It may be a cleaner solution if other modules also happen 
to use Perl's getppid.

Torsten

On Friday 10 June 2005 08:10, Andreas.Nolte@Bertelsmann.de wrote:
> Hi y`all,
>
> Just as a follow-up:
>
> - replacing getppid with with syscall( &SYS_getppid ) and requiring
> syscall.ph did the job ! - test system is Suse Linux Enterprise 9 SP1 with
> mp 1
>
> THX @ Torsten !
>
> Cheers
>
> Andreas
>
> -----Ursprüngliche Nachricht-----
> Von: Torsten Foertsch [mailto:torsten.foertsch@gmx.net]
> Gesendet: Dienstag, 24. Mai 2005 11:19
> An: modperl@perl.apache.org
> Betreff: Re: Apache::SizeLimit ( mp1 and mp2 )-> I think there is a logical
> error in the code ...
>
> On Tuesday 24 May 2005 09:39, Andreas.Nolte@Bertelsmann.de wrote:
> > I claim, the "main process " detection does never work and does not
> > make sense. Why? Not even when the apache is started on boot through
> > init, the PPID will be 1, but some shell / rc pid.  You can only find
> > the PPID in the PID file that apache writes. But still: this should
> > never be the case - right ?
>
> Normally Apache forks on startup to get rid of its parent. So the
> init-process (1) inherits the orphan. Then Apache spawns its workers that
> are direct children of the master Apache. Hence the test is in principle
> right.
>
> r2@opi:~> ps -lC httpd
> F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
> 5 S     0  7155     1  0  76   0 -  2756 -      ?        00:00:00 httpd
> 5 S    30  7158  7155  0  80   0 -  2774 322495 ?        00:00:00 httpd
> 5 S    30  7159  7155  0  80   0 -  2774 semtim ?        00:00:00 httpd
>
> PID 7155 is the main apache. It's PPID is 1.
>
> But there is a problem with Perls getppid() implementation. Modern Perls
> issue the syscall only once and cache the result. Maybe you somehow hit
> that. Normally the cache is invalidated when Perl forks, but Apache does
> its own fork. Thus maybe the cache remains.
>
> I'd try to replace getppid with syscall( &SYS_getppid ) and see if it
> changes anything.
>
> Torsten

Mime
View raw message