PHP 4.0 Bug #7984 Updated: Apparent memory access problem after object assignment causes PWS to crash
| From: | cynic@php.net | Date: | Mon, 08 Jan 2001 18:57:52 +0000 |
| Subject: | PHP 4.0 Bug #7984 Updated: Apparent memory access problem after object assignment causes PWS to crash | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-43430@lists.php.net to get a copy of this message | ||
ID: 7984
Updated by: cynic
Reported By: bughuntr@ctelcom.net
Old-Status: Open
Status: Feedback
Bug Type: Reproduceable crash
Assigned To:
Comments:
please, provide the shortest possible script reproducing the error.
Previous Comments:
---------------------------------------------------------------------------
[2000-11-26 21:21:42] bughuntr@ctelcom.net
This is a _very_ complex script that heavily uses objects. The first few lines
are the web page printout. The next lines are the function that crashes the system.
It uses mysql and PWS on win98. ( It will later be used on linux. It is GPL, and is
a distributive monitoring system.) PWS crashes consistently at this point, and must be restarted.
every few times, the win98 machine must be rebooted.
the array_walk function is being called:
array_walk($TestActionResult,"CheckTestActionResult");
The object definitions are:
class MySQLPollConfig
{
var $configured; // if TRUE, this is configured
var $MySQLConnect;
var $poll_rate;
var $MySQLConnectCount;
function MySQLPollConfig()
{
$this->configured = FALSE;
$this->poll_rate = FALSE;
$this->MySQLConnect = 0;
$this->MySQLConnectCount = 0;
}
};
class AlarmInfoClass
{
var $HistoryID; // the ID in the History table
var $AlarmState;// the alarm id found
var $Status;// the current status ID of the alarm
var $Type; // type, either Success or Fail
var $MachineID; // the machine that the alarm belongs to
var $New; // if TRUE, this was just updated with new info
var $ID; // if in the database, this ID is non-zero
var $ServiceID; // the id of the service involved
function AlarmInfoClass()
{// make sure all variables exist
$this->HistoryID=0;
$this->AlarmState=0;
$this->Status=0;
$this->Type=0;
$this->MachineID=0;
$this->New=FALSE;
$this->ID=0;
$this->ServiceID=0;
}
};
class ActionResultClass
{
var $ServiceID;
var $MonitoredMachineID;
var $Result;
function ActionResultClass()
{
$this->ServiceID=0;
$this->MonitoredMachineID=0;
$this->Result = 0;
}
};
-------------------------------------------------------------
the web page output.
--------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//SoftQuad Software//DTD HoTMetaL PRO 6.0::19990601::extensions to
HTML 4.0//EN" "hmpro6.dtd"> <HTML> <HEAD> <TITLE>MoM
execution test page</TITLE> <META HTTP-EQUIV="Content-Type"
CONTENT="text/html; charset=iso-8859-1"> </HEAD> <BODY
BGCOLOR="#FFFFFF"> <H1 ALIGN="center"><FONT FACE="Arial,
Helvetica, sans-serif" SIZE="+7">MoM</FONT></H1> <P>
<BR>
<!--global.c-->
<!--momfuncs.c-->
<!--readconf.c-->
<!--setupfn.c-->
<!--momact.c-->
GetServiceInfo: No value for $MMValue->FKServiceID<BR>
GetTestActionInfo(0,0,Resource id #2): No value for FKServiceID<BR>
Error in Database!! No Service Entries scanned!<BR>
----->defining debug in file mom.c at line 226<BR>
<BR><B>Function==MonitorMachines file momact.c line 323</B><BR>
walking MonitoredMachineArray<BR>
<BR><B>Function==RunTestAction(0, 0): file momact.c line 139</B><BR>
RunTestAction: No value for $MMValue->FKServiceID in file momact.c, line 146<BR>
<BR><B>Function==RunTestAction(Object, 2): file momact.c line 139</B><BR>
<BR><B>Function==RunAction(4,2) file momact.c line 71</B><BR>
Running PHP Command String<BR>
$ExecString="echo "Test Sendmail!<BR>n"; return(SUCCESS);"<BR>
Test Sendmail!<BR>
$Result="1"<BR>
$TestActionResult["4"]=RunAction($ActionID,$MMKey)<BR>$ActionID = 4<BR>
-----------------------<BR>
For Object 'TesActionResult':<BR>
ServiceID -> 1<BR>
MonitoredMachineID -> 2<BR>
Result -> 1<BR>
-----------------------<BR>
<BR>walking TestActionArray<BR>
<BR><B>Function==CheckTestActionResult(0,0) file momact.c line 198</B><BR>
Key 0 not used<BR>
<BR><B>Function==CheckTestActionResult(Object,4) file momact.c line
198</B><BR>
key 4 for object Object
<BR>-----------------------<BR>
For Object 'ActionResult ($ARValue)':<BR>
ServiceID -> 1<BR>
MonitoredMachineID -> 2<BR>
Result -> 1<BR>
-----------------------<BR>
new action result!<BR>
$Alarm was NOT set<BR>
-----------------------<BR>
For Object 'ActionResult':<BR>
ServiceID -> 1<BR>
''''''''''''''''''''''''''''''''''
web page ended at last line before blank line
''''''''''''''''''''''''''''''''
function CheckTestActionResult($ARValue,$ARKey)
{
global $MySQLConfig; // the mysql configurationinfo
global $AlarmType;
global $StatusType;
global $Service;
global $Alarm;
global $LastActionResult;
global $LastAlarm;
global $TestActionResult;
if (defined("DEBUG"))
print("<BR><B>Function==CheckTestActionResult($ARValue,$ARKey) file
".__FILE__." line ".__LINE__."</B><BR>n");
if ($ARKey == 0)
{
if (defined("DEBUG"))
echo "Key 0 not used<BR>n";
return;
}
else
if (defined("DEBUG"))
echo "key $ARKey for object $ARValuen<BR>";
if (defined("DEBUG"))
DisplayObject($ARValue,"ActionResult ($ARValue)");
$DoWork = FALSE;
if (!isset($LastActionResult["$ARKey"]))
{
if (defined("DEBUG"))
echo "new action result!<BR>n";
$DoWork = TRUE;//something has changed
}
else
{
if (defined("DEBUG"))
echo "Check last action result<BR>n";
if ($ARValue->Result != $LastActionResult["$ARKey"]->Result)
{
$DoWork = TRUE;
$LastActionResult["$ARKey"] = $ARValue; // save the object
}
}
if ($DoWork)// only do this if something changed
{
$AlarmObj = new AlarmInfoClass;
// pick up the status, if it exists
if (isset($Alarm["$ARKey"]))
{
if (defined("DEBUG"))
echo "$Alarm was set<BR>n";
$LastAlarm["$ARKey"] = $Alarm["$RKey"];
}
else
if (defined("DEBUG"))
echo "$Alarm was NOT set<BR>n";
DisplayObject($ARValue,"ActionResult");
exit;
/*
misc here
*/
}
------------------------
a gdb backtrace on windows???? can I do this????
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=7984