ID: 21478
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Status: Verified
Bug Type: Scripting Engine problem
Operating System: linux
PHP Version: 4CVS-2003-01-06 (dev)
New Comment:
Another reproducing script:
Happens with HEAD as of today.
./configure --with-gd --with-zlib-dir=/usr --with-mysql --enable-ftp
--enable-bcmath --enable-maintainer-zts --enable-sockets
--with-gmp=/usr --with-imap --with-imap-ssl=/usr/src/openssl-0.9.6g
I've gotten similar results with simpler ./configure lines and simpler
scripts, but this is the configuration that is immediately available to
me.
#!sapi/cli/php
<?php
class debugfilter extends php_user_filter {
function filter($in, $out, &$consumed, $closing) {
while ($bucket = stream_bucket_make_writeable($in)) {
$bucket->data = strtoupper($bucket->data);
stream_bucket_append($out, $bucket);
$consumed += strlen($bucket->data);
}
return PSFS_PASS_ON;
}
}
stream_register_filter("myfilter","debugfilter");
$fp = fopen("test.txt","w");
stream_filter_append($fp, "myfilter");
stream_filter_append($fp, "myfilter");
stream_filter_append($fp, "myfilter");
fwrite($fp, "This is a test.\n");
print "Done.\n";
fclose($fp);
// Uncommenting the following 'print' line causes the segfault to stop
occuring
// print "2\n";
readfile("test.txt");
?>
Previous Comments:
------------------------------------------------------------------------
[2003-03-26 18:18:33] [EMAIL PROTECTED]
http://sunshine.krneki.org/test.phps
this is a suspicious function inside my code, but i dont know if its my
fault or not... you can spot that this function is a class member
($this references inside), the rest of the class is unimportant..
http://www.php.net/manual/en/language.references.return.php
a comment on this page from "giorgio dot galloNOSPAM at
NOSPAMdedalomedia dot it" describes pretty accurate behaviour i
pressume on my side, but the result beeing segfaults and not some
spooky/eerie values.
nowhere here does it say i should do stuff like:
$v = &$object; return $v;
inside functions which return references, correct? should i?
ill pack up my current code and try two sollutions, one to use $v =
&$object; return $v;... and the other just to plainly remove the "&"
infront of the function name and make it return by value...
can i please get some feedback on this, my mail is open, and i'm
willing to help you in any way possible...
------------------------------------------------------------------------
[2003-03-26 05:43:49] [EMAIL PROTECTED]
this bug just doesnt seem to get away fully... i've acctually (on the
safe side) got around to compile 4.3.1 stable official release and
using
it on the software..
i still get occasional random segfaults.. but the problem is that they
occur after some time, and i cant reproduce them in any way, because
they are TOTALLY random..
is a funny memory leak of somekind possible?
im getting more bugs than ever, and i can't seem to put a finger on
either one of them, it appears every time i start gdb on apache i cant
bring it to crash... i tried this now for atleast an hour, with no
success..
ugh it hit me... thread safety perhaps? i've tried in gdb and as far as
i
understand that is only 1 thread.. and i couldnt reproduce it inside
gdb... i have http://sunshine.krneki.org/phpinfo.php ... to go over it
the
extensions i really use are ftp, gd2, sockets, mysql, xml, aggregate (i
think this isnt an extension, but i noticed "object overloading" in
phpinfo somewhere).. im unsure about the rest..
is it possible that one of theese extensions isnt quite thread safe?
i also use stuff like "function &mod($name)" inside an object to return
a reference to an object.. and then $var = &$obj->mod("name"); to
assign it in the code.. since this is the.. one.. probablly only major
change i did to the code besides using aggregate() and ... well..
nothing else...
dual proc or not, the segfaults still happen...
my next "sollution/test" will be to remove references from the code and
try to solve modularity in a more "global" type of way... to see if the
crashes go away... i have about a week to come up with something,
then it's serious ass raping time, cause ill miss a BIG BIG BIG
deadline.
if someone wants to look at the code, i have no problem in putting up a
tgz with a test database.. but realise that a small reproducible script
is
wishfull thinking.. just the /include dir should be around 170k (but it
is
clean code, really ;))
any guides how i could debug this in threaded mode / all apache
threads?
------------------------------------------------------------------------
[2003-03-25 10:55:16] [EMAIL PROTECTED]
I'm setting back to verified, since polita infact has a reproducable
version above?
As i said, i might be wrong and mine is not related to politas
directly, but the same behaviour applies (only a bit different
backtrace which leads me to the conclusion that the behaviour might not
be related).
------------------------------------------------------------------------
[2003-03-20 17:06:04] [EMAIL PROTECTED]
Closed then.
------------------------------------------------------------------------
[2003-03-20 03:06:54] [EMAIL PROTECTED]
sniper: i tried the latest stable snapshot (php4-STABLE-200303200830)
and i couldnt reproduce the bug anymore..
but then, if its as elusive as polita said in #2 any changes to the
code might have made it dissapear (had lots of them in the last 2
days)..
I also tried php4-200303182230 to confirm that that might not be the
case, but it has gone away also... if i spot any more segfaults ill do
the wise thing and archive the scripts / database, if it can be
reproduced ;)
------------------------------------------------------------------------
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/21478
--
Edit this bug report at http://bugs.php.net/?id=21478&edit=1