php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19852 httpd processes eat my cpu
Submitted: 2002-10-10 12:09 UTC Modified: 2002-10-30 01:00 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:0 of 0 (0.0%)
From: lrvazquez at megared dot net dot mx Assigned:
Status: No Feedback Package: Apache related
PHP Version: 4.2.3 OS: Solaris 7
Private report: No CVE-ID: None
 [2002-10-10 12:09 UTC] lrvazquez at megared dot net dot mx
Description:
   Since I upgraded from php-4.0.6 and apache-1.3.26 to php-4.2.3/apache-1.3.27, the httpd processes increase the load.

   Normally with the same scripts a process consumed from 0.00% to 1.00% avg, but now I have 12 processes over 1.00% (13.00% topest) while I have just 4 connections avg per minute.

   My cpu normally is 90% idle, now because httpd is 30% idle. I have a box with 2 cpus, this line going to show you the info:

CPU states: 29.3% idle, 43.9% user, 26.6% kernel,  0.2% iowait,  0.0% swap

Any ideas.

PHP conf:
./configure --with-apache=../apache_1.3.27 --enable-versioning \
--without-mysql --with-sybase=/usr/local/freetds --without-gd \
--enable-track-vars --with-system-regex --enable-trans-id \
--with-snmp --enable-ucd-snmp-hack

Apache conf:
APACHE 1.3.27

set PREFIX=/usr/local
set PERL5=/usr/local/bin/perl
setenv LIBS_SHLIB -lbind
setenv CFLAGS -I/usr/local/include
setenv LDFLAGS -L/usr/local/lib
setenv LIBS -lbind
setenv LD_LIBRARY_PATH /usr/local/lib

./configure      --prefix=${PREFIX} \
                 --with-layout=GNU \
                 --sysconfdir=${PREFIX}/etc/apache \
                 --includedir=${PREFIX}/include/apache \
                 --localstatedir=/var \
                 --datadir=${PREFIX}/www \
                 --suexec-docroot=${PREFIX}/www/data \
                 --proxycachedir=${PREFIX}/www/proxy \
                 --libexecdir=${PREFIX}/libexec/apache \
                 --without-confadjust \
                 --enable-shared=remain \
                 --enable-module=most \
                 --activate-module=src/modules/php4/libphp4.a \
                 --with-perl=${PERL5}

OS: 
solaris% uname -a
SunOS solaris 5.7 Generic_106541-07 sun4u sparc SUNW,Ultra-250

Unfortunaly I don't have installed gdb in the box.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-10 18:19 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip


 [2002-10-11 13:14 UTC] lrvazquez at megared dot net dot mx
It works worst.

Now I have 25 processes over 1.00% :(
 [2002-10-11 15:44 UTC] sniper@php.net
Can you please try coming up with some short script which causes this?

 [2002-10-14 14:06 UTC] lrvazquez at megared dot net dot mx
Sorry by the delay.
I come back to php4.0.4pl1 in the production box.
I going to install 4.2.3 on a devel box I got today.
This is maybe the most executed script, is my index.php, it show you a template depending of the special variable "modo" and the client's IP.
Script:

<?php
session_start() ;
if ( ! session_is_registered('__session_ip') ) {
   $__session_ip = $HTTP_SERVER_VARS['REMOTE_ADDR'] ;
   session_register('__session_ip') ;
} else {
   if ( $__session_ip != $HTTP_SERVER_VARS['REMOTE_ADDR'] ) {
      session_unset() ;
      session_destroy() ;
      session_start() ;
      $__session_ip = $HTTP_SERVER_VARS['REMOTE_ADDR'] ;
      session_register('__session_ip') ;
      unset($HTTP_POST_VARS['modo']) ;
   }
}

$sig_titulo = "::: Servicio al Cliente :::" ;
$modo = 0 ;
$sesion_act = false ;
$conf_ipsautorizadas = "10.39.192.240,10.36.0.50" ;

if ( ! isset( $HTTP_POST_VARS['modo'] ) ) {
   $IP = $HTTP_SERVER_VARS['REMOTE_ADDR'] ;
   $octs = explode(".", $IP) ;
   $ipa = explode(".", $IP) ;
   $ipl = ($ipa[1] << 16) + ($ipa[2] << 8) + $ipa[3] ;

   $base =     2125824 ;
   $mask =     15757312 ;

   $bpcconfig =    0 ;
   $mpcconfig =    3072 ;
   $bpcpre =       1024 ;
   $mpcpre =       3072 ;
   $bpccortada =   3072 ;
   $mpccortada =   3072 ;
   $bpcnueva =     2048 ;
   $mpcnueva =     3072 ;

   if ( ($ipl & $mask) == $base ) {
      if ( ($ipl & $mpcpre ) == $bpcpre ) {
         $modo = 24 ; /* PCPre */
         $sig_titulo = "::: Aviso Importante:::" ;
      } elseif ( ($ipl & $mpcnueva) == $bpcnueva ) {
         $modo = 12 ; /* PCNueva */
         $sig_titulo = "::: Acceso Restringido :::" ;
      } elseif ( ($ipl & $mpcconfig) == $bpcconfig ) {
         $modo = 10 ; /* PCConfig */
         $sig_titulo = "::: M\363dulo de Activaci\363n :::" ;
      } elseif ( ($ipl & $mpccortada) == $bpccortada ) {
         $modo = 11 ;  /* PCCortada */
         $sig_titulo = "::: Acceso Restringido :::" ;
      }
   } else {  /* Paginas que no son de gps directo al home page */
      if ( ! strstr(",$conf_ipsautorizadas,", "," . $IP . "," ) ) {  /* Si no es acceso remoto */
         $modo = 13 ;
         $sig_titulo = "::: Acceso no permitido :::" ;
      } else {
          $modo = 10 ;
          $sig_titulo = "::: M\363dulo de Activaci\363n :::" ;
      }
   }
} else {
   $modo = $HTTP_POST_VARS['modo'] ;
}

/* Pagina, Sesion o No Sesion, Nivel minimo, Pagina en caso de no tener acceso, Precedencia */
$paginas[8] = array("informes.php", 0, 0, 0, "") ;
$paginas[9] = array("suscripciones.php", 0, 0, 0, "") ;
$paginas[10] = array("activacion.php", 0, 0, 0, "") ;
$paginas[11] = array("cortada.php", 0, 0, 11, "") ;
$paginas[12] = array("nueva.php", 0, 0, 12, "") ;
$paginas[13] = array("invalido.php", 0, 0, 13, "") ;
$paginas[14] = array("actvalida.php", 1, 1, 10, ",10,") ;
$paginas[15] = array("cambio-activa.php", 1, 1, 10, ",14,") ;
$paginas[16] = array("termina-act.php", 1, 8, 10, ",14,") ;
$paginas[20] = array("guardian.php", 1, 10, 30, "") ;
if ( ! isset( $paginas[$modo]) ) {
   if ( session_is_registered('__session_nivel') && $__session_nivel >= 10 )
      $sesion_act = true ;
   include ("indice.php") ;
   exit() ;
}

$tiempoexpira = session_is_registered('__session_tiempo') ? $__session_tiempo + 300 : time()+300 ;
$tiempoactual = time();

if (session_is_registered('__session_tiempo') && ($__session_nivel >= 10) && ($tiempoexpira < $tiempoactual))
{
  //session_unset();

  //session_destroy();

  //$modo = 70;
  $__session_nivel = 8;
  session_register('__session_nivel');

  $modo = 40;
}
list( $archivo, $sesion, $nivel, $modo_redir, $precedencia) = $paginas[$modo] ;

/**********************  Parte de la inclusion ******************************/

if ( $sesion && !session_is_registered('__session_nivel') )
 {
   include ($paginas[$modo_redir][0]) ;
 }
elseif ( $__session_nivel < $nivel )
 {
   include ($paginas[$modo_redir][0]) ;
 }
elseif ( $precedencia != "" && ! strstr($precedencia . "$modo,", "," . $__session_modo . ",") )
 {
   include ($paginas[$modo_redir][0]) ;
 }
else
 {
   include ($archivo) ;
 }

/****************************************************************************/

include "pie.php" ;
$__session_modo = $modo ;
$__session_tiempo = time() ;
session_register('__session_modo') ;
session_register('__session_tiempo') ;
?>
 [2002-10-14 18:45 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip

This is most likely fixed.

 [2002-10-30 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over 2 weeks, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC