ID:               14599
 Comment by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Closed
 Bug Type:         Reproducible crash
 Operating System: SuSE Linux 6.4
 PHP Version:      4.1.0
 New Comment:

I get this all the time when I include a recursive function call. I've
tried rewriting the function several ways and get intermitten
Segmentation faults.

I"ve tried just opening the fh and going down recursive directories
with this, got the seg faults often.This version
buffers the file names in an array, closes the directory handle then
processes the array, to count certain types of files in the directory
tree. Still segfaults often enough to make it unreliable. I turned on
the autoflush in php.ini and it dies in this routine.

FreeBSD 4.5-RELEASE
Apache/1.3.26 (Unix) PHP/4.2.2 mod_ssl/2.8.9 OpenSSL/0.9.6g
RegisterGlobals = On  :)

function CountFiles($dir,$d) {
  global $home;
  global $prod_count;
  $farray = array(); $d++;
  if (is_dir("$home$dir")) {
    print "<!-- ISDIR dir=$dir level=$d -->\n";
    if ($dfh = @opendir("$home$dir")) {
        while (($fil = readdir($dfh)) !== false) {
                if (!preg_match("/^\.+$/", $fil)) {
                        array_push($farray,"$fil");
                }
        }
        closedir($dfh);
        if (count($farray) > 0) {
          while (list ($key, $file) = each ($farray)) { 
            if (is_dir("$home$dir/$file")) {
                CountFiles("$dir/$file",$d);
                flush();
            } else if (preg_match("/^thumb_\w+\.|\.wav$|\.aif$/", $file))
{                               $prod_count++;
                print "<!-- POST dir=$dir/$file prod_count=$prod_count -->\n";
                flush();
            }
        }
      }
    }
  }
  flush();
}

It's not entirely reproducible, but once I got a directory where it
causes the segfault I can comment out this routine and it's okay,
comment it back and reload and it segfaults.
So in that sense it's reproducible. Restarting the web server has no
effect. Though if I reload enough times sometimes the script completes,
there is definitely some sort of bug, maybe the filehandle or array
declaration isn't local or leaks out, not sure.


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

[2002-01-09 02:10:59] [EMAIL PROTECTED]

No feedback. Closing.

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

[2001-12-19 07:30:43] [EMAIL PROTECTED]

Please provide a small script which can be used to produce this error,
and also, if you can, provide a backtrace.

http://bugs.php.net/bugs-generating-backtrace.php


R.

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

[2001-12-19 07:21:39] [EMAIL PROTECTED]

PHP script stops 3/4 of the way down a medium sized page. This happens
in exactly the same place.

Apache log shows:

[Wed Dec 19 11:24:55 2001] [notice] child pid 13078 exit signal
Segmentation fault (11)
[Wed Dec 19 11:26:55 2001] [notice] child pid 12877 exit signal
Segmentation fault (11)
[Wed Dec 19 11:27:51 2001] [notice] child pid 13465 exit signal
Segmentation fault (11)
[Wed Dec 19 11:28:45 2001] [notice] child pid 13468 exit signal
Segmentation fault (11)
[Wed Dec 19 11:30:54 2001] [notice] child pid 13469 exit signal
Segmentation fault (11)
[Wed Dec 19 11:34:17 2001] [notice] child pid 13566 exit signal
Segmentation fault (11)
[Wed Dec 19 11:34:37 2001] [notice] child pid 13580 exit signal
Segmentation fault (11)
[Wed Dec 19 11:34:39 2001] [notice] child pid 13581 exit signal
Segmentation fault (11)
[Wed Dec 19 11:34:48 2001] [notice] child pid 13582 exit signal
Segmentation fault (11)
[Wed Dec 19 11:39:15 2001] [notice] caught SIGTERM, shutting down
[Wed Dec 19 11:43:15 2001] [notice] Apache/1.3.12 (Unix)  (SuSE/Linux)
mod_fastcgi/2.2.2 mod_perl/1.21 PHP/4.1.0 configured -- res
uming normal operations
[Wed Dec 19 11:43:15 2001] [notice] suEXEC mechanism enabled (wrapper:
/usr/sbin/suexec)
ild pid 13078 exit signal Segmentation fault (11)[Wed Dec 19 12:05:32
2001] [notice] child pid 163 exit signal Segmentation fault

The PHP page is meant to output a html form containing hidden form
fields.



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


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

Reply via email to