You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Marc Gràcia <mg...@oasyssoft.com> on 2005/05/24 11:48:32 UTC

Re: Apache::SizeLimit ( mp1 and mp2 )-> I think there is a logical error in the code ...

El dt 24 de 05 del 2005 a les 11:19 +0200, en/na Torsten Foertsch va
escriure:

> 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.

In Apache::GTopLimit i had to modify the source to use Linux::Pid
package to get the pid instead of the default
function. If not allways returned the parent pid.
After all this, everything worked fine...
It seems to me the same problem.


> 
> I'd try to replace getppid with syscall( &SYS_getppid ) and see if it changes 
> anything.
> 
> Torsten

Re: Apache::SizeLimit ( mp1 and mp2 )-> I think there is a logical error in the code ...

Posted by Torsten Foertsch <to...@gmx.net>.
On Tuesday 24 May 2005 11:48, Marc Gràcia wrote:
> > 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.
>
> In Apache::GTopLimit i had to modify the source to use Linux::Pid
> package to get the pid instead of the default
> function. If not allways returned the parent pid.
> After all this, everything worked fine...
> It seems to me the same problem.

I've just uploaded Perl::AfterFork to CPAN. The module implements a function 
that does what Perl is doing after a successful fork in the child. That also 
may help.

Torsten