ID:               26286
 Comment by:       hakk at email dot it
 Reported By:      igg10 at alu dot ua dot es
 Status:           No Feedback
 Bug Type:         Apache2 related
 Operating System: Windows 2000
 PHP Version:      4.3.4
 New Comment:

Apache: 2.0.49 (happens with apache 1.3.31 too)
PHP:    5.0.0RC2
OS:     Windows XP PRO SP1

The code below reproduces the crash on my machine.

<?
class my_error {
  private $_errors;
                private $_errorNumber;

  function __construct() {
    set_error_handler(array(&$this, 'handler'), E_ALL);
                                $this->_errorNumber = 0;
  }

  function handler($errno, $errstr, $errfile, $errline, $errctx) {
    echo "ERROR= $errno<br> $errstr<br> $errfile<br> $errline<br>
$errctx<br>";
    echo $this->_errorNumber."<br>";

    /* if you comment out the next 4 statements, everything works
correctly */
                        $this->_errors[$this->_errorNumber]['errno'] = $errno; 
                                $this->_errors[$this->_errorNumber]['errstr'] = 
$errstr;
                                $this->_errors[$this->_errorNumber]['errfile'] = 
$errfile;
                                $this->_errors[$this->_errorNumber]['errline'] = 
$errline;
                                $this->_errorNumber++;
  }
}

class my_class {
  function throw_exception($param1, $param2) {
    echo "$param1, $param2";
    throw new Exception();
  }
}

$err = new my_error; //if i dont use my own error handling class,
everything works out
try {
  $test = new my_class;
  call_user_func_array(array($test, "throw_exception"),
array('a','b')); //makes apache crash
  //$test->throw_exception('a','b'); this works with no problems
}
catch(Exception $e) {
  echo $e;
}
?>

A few notes...
If i dont use my error_class, everything works fine, and PHP gives me
this warning
"Warning: call_user_func_array() [function.call-user-func-array]:
Unable to call my_class::throw_exception() in C:\Programmi\Apache
Group\Apache2\htdocs\testfield\exception.php on line 40"
problably since i threw an exception in that function.

If i use my error_class and i dont use the call_user_func_array, but
instead i call $test->throw_exception() everything works fine again
(because no Warning is generated?)

If i use my error class and call call_user_func_array then everything
blows up and apache restarts giving
"[Mon May 17 15:59:16 2004] [notice] Parent: child process exited with
status 3221225477 -- Restarting."

Hope this helps.


Previous Comments:
------------------------------------------------------------------------

[2004-05-04 09:25:24] gaida at gmxpro dot net

Apache: Apache 2.0.49 (Win32)
PHP   : PHP 4.3.6
MySQL : MySQL 4.0.14-NT
OS    : Windows XP Pro SP1

Server crashes only (Parent: child process exited with status
3221225477 -- Restarting.) when Turck MMCache (version 2.4.6 for php
4.3.6) is enabled and JPGraph generated images were accessed. If
mmcache is disabled in php.ini (mmcache.enable="0") everythings runs a
lot slower but at least without crashes.

------------------------------------------------------------------------

[2004-05-01 06:38:56] peter at helpnet dot com dot au

I get both
Parent: child process exited with status 3221225477
and
Parent: child process exited with status 1073807364
alternating in a seemingly random order.

Win2000.
Apache 2 2.0.47. I am about to try 2.0.49.
PHP 4.3.4 then 4.3.6. I upgraded to 4.3.6 but it did not solve the
problem.

I get the error in code using XML but not MySQL. The error first
occurred when I opened lots of classes and created lots of objects.
Each element in a small XML file became an object which in turn may
include other objects. Some objects are from classes extending
classes.

I figured it might be a memory problem so extended memory from 8MB to
18 MB. That did not change anything.

My next guess was a file open resource problem. Some of the objects
read directories to count input files. I removed some of the files to
decrease files within a directory. That did not work. I can understand
that as I have had 100000 or more files in one directory and the script
has worked. My tests are currently using less than 100 files per
directory.

I removed some of the directories but that did not stop the problem. I
removed some of the lower level directories and that stopped the
problem for a while. There appears to be a resource issue when working
down through a directory tree several levels.

I added print statements to trace the execution. Adding lots of print
statements made the problem happen faster but on some occasions I have
used many more print statements without this problem.

The print statements did not always print up to where the code stopped
so I added file logging. Opening output files made the problem worse.
That reinforces the idea that there is a resource problem.

I set the log code to open, write to, and close a log file. At first
that worked. As soon as I run xml_parser_free, the file logging stops.
The file log code can write the next message but no more. After that it
can open and write to the file but not close the file.

This error occurs with modpython and some other Apache stuff. I think
we are hitting a resource limit within Apache. Neither PHP nor Apache
has code to detect the problem.

------------------------------------------------------------------------

[2004-04-19 08:39:10] cpuidle at gmx dot de

Windows error reporting mentions:
szModName: php5ts.dll
szModVer:  5.0.0.0
offset:    00052dc6

Can provide full memory dump from winXP error reporting on request (12m
unzipped).

Cheers,
Andi

------------------------------------------------------------------------

[2004-04-19 07:34:56] cpuidle at gmx dot de

Same issue for me, using Apache 2.0.49, PHP5RC1
Seems to be happening in conjunction with MySQL?

------------------------------------------------------------------------

[2004-04-09 09:51:28] hagen at xiag dot ch

The same on WindowsXP SP1,
PHP 5RC1 as a module on Apache 2.0.48.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/26286

-- 
Edit this bug report at http://bugs.php.net/?id=26286&edit=1

Reply via email to