ID: 16272
Updated by: b0nfire@fdns.net
Reported By: jweiss@greyzone.com
Status: Open
Bug Type: MySQL related
Operating System: Linux 2.4.x
PHP Version: 4.1.2
New Comment:
We are experiencing similar problems on our slack 8.0 box:
apache 1.3.26
php 4.1.2
mysql 3.23.49a
We initially saw the follow apache logs:
[Tue Jun 25 05:44:31 2002] [notice] child pid 4503 exit signal
Segmentation fault (11)
[Tue Jun 25 06:11:08 2002] [notice] child pid 17668 exit signal
Segmentation fault (11)
Which similar logs are generated with a pre 1.3.26 apache DOS attack
script... but since 1.3.26 is apparently patched this should not be a
factor..
We also have a small built in wrapper that reports any connection
failure attempts.. We have not seen any in months and since upgrading
php we have started to see them more frequently...
One note though is that all of our crashes thusfar have all occurred on
1 peticular script that processes file uploads. This script has worked
flawlessly for many months..
Sorry no backtrace so far.. I'll try and grab one..
Previous Comments:
------------------------------------------------------------------------
[2002-04-18 15:23:25] jweiss@greyzone.com
I would like to thank fcaprioli for the additional input;
unfortunately, it does not resolve our problem. If you look at the code
snippet that I submitted earlier, you can see that we already include
the link ID in our query: i.e.,
"$res=mysql_db_query($this->dbase,$query,$dbLink)", where $dbLink is
the link ID. So basically, we're where we were before: stuck with
intermittent failures.
------------------------------------------------------------------------
[2002-04-11 07:20:28] fcaprioli@inwind.it
I was affected by the same bug, but I've found a workaround.
On linux 2.4.18, glibc 2.2.3 and MySQL 3.23.49, apache 1.3.24 with php
4.1.2 statically compiled (mysql external driver,
--with-mysql=mysql_install_dir)
by explicitly indicating the link id, mysql seems to work fine. So
$conn = mysql_pconnect("host","username","pass");
mysql_select_db("db1");
$query = mysql_query("SELECT * FROM xxx")
while ($row = mysql_fetch_array($query)) do_stuff();
would randomly segfault apache, while
$conn = mysql_pconnect("host","username","pass");
mysql_select_db("db1",$conn);
$query = mysql_query("SELECT * FROM xxx",$conn)
while ($row = mysql_fetch_array($query)) do_stuff();
works without problem.
------------------------------------------------------------------------
[2002-04-03 14:24:47] ronen@greyzone.com
I just set up a separate box to test if this bug has anything to do
with what version of glibc is used.
The bug is still there in the following setup:
glibc-2.2.4-19.3 (RedHat Linux 7.2)
MySQL-3.23.42-1
PHP v4.1.2 compiled as a static module for Apache 1.3.22
------------------------------------------------------------------------
[2002-03-26 13:42:23] jweiss@greyzone.com
The bug still shows up in 4.2.0RC1
------------------------------------------------------------------------
[2002-03-26 13:41:16] jweiss@greyzone.com
The segfault occurs in the following code snippet (a db wrapper that we
wrote for MySQL). What is odd is that this only happens on occasion:
this method is called exceptionally often in our code and only breaks
(in 4.1.x, not 4.0.x) once in a while and not on exceptional
queries--we have, for instance, seen it break on a query that returns
only one row. Anyway, here's the code:
/**
* send a query to the DBMS using the dbLinkID
* @param $dbLink - the link connection ID [INT]
* @param $query [STRING]
* @return the query in ORACLE format $result[FIELDNAME][ROWNUM]=value
[2D HASH]
* @access public
*/
function db_query($dbLink, $query){
$res=mysql_db_query($this->dbase,$query,$dbLink);
while($row=@mysql_fetch_array($res,MYSQL_ASSOC)){
while(list($key,$val)=@each($row)){
$result[$key][]=$val;
}
$x++;
}
if(!is_array($result)) $result=array();
return $result;
}
Thanks for looking into this.
--jonathan
------------------------------------------------------------------------
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/16272
--
Edit this bug report at http://bugs.php.net/?id=16272&edit=1