php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7369 call chdir() in function php_execute_script hangs httpd process
Submitted: 2000-10-20 12:44 UTC Modified: 2000-11-04 13:16 UTC
From: lrvazquez at megared dot net dot mx Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.2 and 4.0.3pl1 OS: Solaris 7 (SPARC)
Private report: No CVE-ID: None
 [2000-10-20 12:44 UTC] lrvazquez at megared dot net dot mx
   No particular script generate this... I have apache 1.3.12 with php as static module and my scripts work fine, I have no problems with them...

  I have 3 avg requests per second and each httpd daemon use from 0.01% until 0.20% of the processor...

  At this point everything is fine, but suddently appears the follow message in the php log:
"Maximum execution time of 30 seconds exceeded in Unknown on line 0".
  
  Very rare because don't tell the script name and the line, after this the daemon httpd use over 90% of processor, if another error appears then another process begin to eat the
processor but share the load with the first one to complete about 90% and this occurs with each error of this kind.

The scripts never fail, and I make the script generates the "Maximum execution time" error and the message says the script name and the line at this error occurs and no change in the load happens.

I have another rare random error appears:

No content-type in POST request in Unknown on line 0

Any idea ??

---------  stack (proccess looped )--------------------
(gdb) bt
#0  0xff114cec in chdir () from /usr/lib/libc.so.1
#1  0x3484c in php_execute_script (primary_file=0xffbef6c0) at main.c:1140
#2  0xa94a4 in apache_php_module_main (r=0x0, display_source_mode=0)
    at sapi_apache.c:89
#3  0x31944 in send_php ()
#4  0x31988 in send_parsed_php ()
#5  0xf7ea4 in ap_invoke_handler ()
#6  0x1146bc in process_request_internal ()
#7  0x114740 in ap_process_request ()
#8  0x108198 in child_main ()
#9  0x108524 in make_child ()
#10 0x108648 in startup_children ()
#11 0x109038 in standalone_main ()
#12 0x109c34 in main ()
(gdb) quit
------- stack ( normal proccess ) ----------------

(gdb) bt
#0  0xff11450c in __fcntl () from /usr/lib/libc.so.1
#1  0xff10f1b0 in s_fcntl () from /usr/lib/libc.so.1
#2  0x104064 in accept_mutex_on ()
#3  0x107b7c in child_main ()
#4  0x108524 in make_child ()
#5  0x108a9c in perform_idle_server_maintenance ()
#6  0x109300 in standalone_main ()
#7  0x109c34 in main ()
(gdb) quit

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

---------php.ini (Mostly) ----------------------------

engine                  =       On  
short_open_tag  =       On     
asp_tags                =       Off 
precision               =       14  
y2k_compliance  =       Off     
output_buffering        = On    
implicit_flush          = Off
                                   allow_call_time_pass_reference  = On
safe_mode               =       Off
safe_mode_exec_dir      =
                                   safe_mode_allowed_env_vars = PHP_
                                   safe_mode_protected_env_vars = LD_LIBRARY_PATH
disable_functions       =
highlight.string        =       #DD0000
highlight.comment       =       #FF8000
highlight.keyword       =       #007700
highlight.bg            =       #FFFFFF
highlight.default       =       #0000BB
highlight.html          =       #000000
expose_php      =       On
max_execution_time = 30
memory_limit = 8388608
error_reporting =       E_ALL & ~E_NOTICE
display_errors  =       Off 
log_errors              =       On
track_errors    =       Off
error_log       =       /var/log/gps/php
warn_plus_overloading   =       Off
variables_order         =       "EGPCS"
register_globals        =       On
register_argc_argv      =       On
track_vars                      =       On              
gpc_order                       =       "GPC"
magic_quotes_gpc        =       On
magic_quotes_runtime=   Off
magic_quotes_sybase     =       Off
auto_prepend_file       =
auto_append_file        =
default_mimetype = "text/html"
include_path    =                   
doc_root                =
user_dir                =
upload_max_filesize = 2097152
extension_dir   =       ./
enable_dl               = On
define_syslog_variables = Off
debugger.enabled        =       False
sql.safe_mode   =       Off
session.save_handler      = files
session.save_path         = /tmp 
session.use_cookies       = 0
session.name              = sesid
session.auto_start        = 0       
session.cookie_lifetime   = 0
session.cookie_path       = /
session.cookie_domain     =
session.serialize_handler = php 
session.gc_probability    = 1       
session.gc_maxlifetime    = 1440 
session.referer_check     =
session.entropy_length    = 0
session.entropy_file      =
session.cache_limiter     = nocache
session.cache_expire      = 20
mssql.allow_persistent          =       On
mssql.max_persistent            =       -1      
mssql.max_links                         =       -1
mssql.min_error_severity        =       10
mssql.min_message_severity      =       10
mssql.compatability_mode        = Off 
zend_optimizer.optimization_level=15;
zend_extension="/usr/local/lib/Zend/ZendOptimizer.so"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-10-20 20:14 UTC] lrvazquez at megared dot net dot mx
I'm close..

I debug the looped proccess and I found that executing at line:

result = OG(php_header_write)(str, str_length);

I lost the tracking...
I make a Crtl-C and the proccess is interrumped at chdir function....
The stack :

(gdb) bt

#0  php_ub_body_write_no_header (
    str=0xc9c258 "bla bla (string omited) " ..., str_length=10148) at output.c:312
#1  0x827dc in php_ob_send () at output.c:253
#2  0x82238 in php_end_ob_buffer (send_buffer=1) at output.c:120
#3  0x8226c in php_end_ob_buffers (send_buffer=1) at output.c:133
#4  0xa94b4 in apache_php_module_main (r=0x0, display_source_mode=0) at sapi_apache.c:93
#5  0x31944 in send_php ()
#6  0x31988 in send_parsed_php ()
#7  0xf7ea4 in ap_invoke_handler ()
#8  0x1146bc in process_request_internal ()
#9  0x114740 in ap_process_request ()
#10 0x108198 in child_main ()
#11 0x108524 in make_child ()
#12 0x108648 in startup_children ()
#13 0x109038 in standalone_main ()
#14 0x109c34 in main ()

I keep debbuging...
 [2000-10-20 20:27 UTC] lrvazquez at megared dot net dot mx
Because never reach php_ob_destroy() at function php_end_ob_buffer, never decrement output->globals->nesting_level is looped I think

Keeping debugging

 [2000-11-01 12:54 UTC] lrvazquez at megared dot net dot mx
I think this is a anormal behavior...
OK I found the problem's origin...
I have httpd as static module and the "output_buffering" variable set "On"..
When I execute any script and interrupt it by navigator then the error happens...

When I turn off the variable then php works fine...

Here is a script that generate the error interrupting by navigator when is executing.

<?
function getmicrotime(){
    $mtime = explode( " ", microtime());
    $mt = $mtime[1] . substr($mtime[0],1);
    return ($mt);
}

function getkbit($filename="rndfile1"){
    flush();
    $t1 = getmicrotime();
    flush();
    $size = readfile($filename);
    flush();
    print ("Termino") ;
    $t2 = getmicrotime();
    $dif = round(($t2 - $t1), 6) ;
    $kbit = (8 * $size/($dif))/1024;
    return array($kbit, $size, $dif, $t1, $t2);
}

$ttime = 0;
$tsize = 0;
$i = 1;
$fileno = 1;
$maxloop = 30;
while (($ttime < 8) && ($maxloop > 0)) {
    $rndfile = "rndfile".$fileno;
    print  "<!-- \n";
    $ka = getkbit($rndfile);
    print  "\n-->\n";

    $tsize += $ka[1];
    $ttime += $ka[2];

    $kspeed = round($ka[0]);           // Obtener kbit/sec
    $ksize = $ka[1] / 1024;            // Obtnener KB
    $ktime = $ka[2]; // Obtener el tiempo
    print ("Prueba $i: $ksize KB cargados en $ktime (" . $ka[4] . ", " . $ka[3] . ") secs a la velocidad de $kspeed kbit/sec<br>\n") ;
    $i++;
    if (($fileno < 6) && ($ka[2] < 2)) {
        $fileno++;
    }
    $maxloop--;
}

$ksize = $tsize / 1024;            // Obtener KB
$ktime = $ttime; 
$kspeed = $ttime != 0 ? round((8*$tsize/$ttime)/1024) : "altisima";  // Obtener kbit/sec

print "<p>Promedio: $ksize KB cargados en $ktime segundos a la velocidad de <b>$kspeed kbit/sec</b></p>\n";

?>

 [2000-11-03 20:38 UTC] sniper@php.net
Does this happen with latest snapshot from snaps.php.net ?

--Jani
 [2000-11-04 13:16 UTC] lrvazquez at megared dot net dot mx
Thanks,

	It's worked !!!!

	I wait the release...

	This report is close.

Ramiro
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Jul 15 18:00:01 2026 UTC