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

[prev] [thread] [next] [Date index for 2005/05/24]

From: Marc =?ISO-8859-1?Q?Gr=E0cia?=
Subject: Re: Apache::SizeLimit ( mp1 and mp2 )-> I think there is a logical error in the code ...
Date: 09:48 on 24 May 2005
--=-ESwWUX1d5RUSAihmiPfP
Content-Type: text/plain
Content-Transfer-Encoding: 7bit


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@xxxxxxxxxxx.xx 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

--=-ESwWUX1d5RUSAihmiPfP
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.2.5">
</HEAD>
<BODY>
<BR>
El dt 24 de 05 del 2005 a les 11:19 +0200, en/na Torsten Foertsch va escriure:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">On Tuesday 24 May 2005 09:39, <A HREF="mailto:Andreas.Nolte@xxxxxxxxxxx.xx">Andreas.Nolte@xxxxxxxxxxx.xx</A>; wrote:</FONT>
<FONT COLOR="#000000">&gt; I claim, the &quot;main process &quot; detection does never work and does not make</FONT>
<FONT COLOR="#000000">&gt; sense. Why? Not even when the apache is started on boot through init, the</FONT>
<FONT COLOR="#000000">&gt; PPID will be 1, but some shell / rc pid. &nbsp;You can only find the PPID in the</FONT>
<FONT COLOR="#000000">&gt; PID file that apache writes. But still: this should never be the case -</FONT>
<FONT COLOR="#000000">&gt; right ? </FONT>

<FONT COLOR="#000000">Normally Apache forks on startup to get rid of its parent. So the init-process </FONT>
<FONT COLOR="#000000">(1) inherits the orphan. Then Apache spawns its workers that are direct </FONT>
<FONT COLOR="#000000">children of the master Apache. Hence the test is in principle right.</FONT>

<FONT COLOR="#000000">r2@opi:~&gt; ps -lC httpd</FONT>
<FONT COLOR="#000000">F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD</FONT>
<FONT COLOR="#000000">5 S     0  7155     1  0  76   0 -  2756 -      ?        00:00:00 httpd</FONT>
<FONT COLOR="#000000">5 S    30  7158  7155  0  80   0 -  2774 322495 ?        00:00:00 httpd</FONT>
<FONT COLOR="#000000">5 S    30  7159  7155  0  80   0 -  2774 semtim ?        00:00:00 httpd</FONT>

<FONT COLOR="#000000">PID 7155 is the main apache. It's PPID is 1.</FONT>

<FONT COLOR="#000000">But there is a problem with Perls getppid() implementation. Modern Perls issue </FONT>
<FONT COLOR="#000000">the syscall only once and cache the result. Maybe you somehow hit that. </FONT>
<FONT COLOR="#000000">Normally the cache is invalidated when Perl forks, but Apache does its own </FONT>
<FONT COLOR="#000000">fork. Thus maybe the cache remains.</FONT>
</PRE>
</BLOCKQUOTE>
In Apache::GTopLimit i had to modify the source to use Linux::Pid package to get the pid instead of the default<BR>
function. If not allways returned the parent pid.<BR>
After all this, everything worked fine...<BR>
It seems to me the same problem.<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
<PRE>

<FONT COLOR="#000000">I'd try to replace getppid with syscall( &amp;SYS_getppid ) and see if it changes </FONT>
<FONT COLOR="#000000">anything.</FONT>

<FONT COLOR="#000000">Torsten</FONT>
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>

--=-ESwWUX1d5RUSAihmiPfP--

Re: Apache::SizeLimit ( mp1 and mp2 )-> I think there is a logical error in the code ...
Marc =?ISO-8859-1?Q?Gr=E0cia?= 09:48 on 24 May 2005

Generated at 15:53 on 25 May 2005 by mariachi v0.52