PHP 4.0 Bug #8429 Updated: erealloc() problem
| From: | stas@php.net | Date: | Mon, 08 Jan 2001 19:01:29 +0000 |
| Subject: | PHP 4.0 Bug #8429 Updated: erealloc() problem | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-43432@lists.php.net to get a copy of this message | ||
ID: 8429
Updated by: stas
Reported By: bughuntr@ctelcom.net
Old-Status: Open
Status: Feedback
Bug Type: Class/Object related
Assigned To:
Comments:
Could you produce minimal PHP code that reproduces the
problem? 1000 lines of DB-dependant application is pretty
hard to investigate. Also, do you have some non-standard PHP
modules in your application?
Previous Comments:
---------------------------------------------------------------------------
[2000-12-26 13:52:18] bughuntr@ctelcom.net
Under Linux, memory appears to be corrupted after Alarm object newed/ or call to DisplayObject
function. This is part of a large/complex script, around 1000 lines.
Using BODY debugger, variables having weird stuff in them. It is like the memory manager gets
hosed. I would be willing to give entire script/database configuration set to anyone. The
application is GPL'd. I've got a sample database for MySQL that configures and loads as
follows:
mysql <mom1create.sql
mysql <testdb.sql
the crash occurs with either of the following:
(command Line)
php mom.c
crash looks like this:
888888888888888888888888888888888888888888888888888888888888
+++++++++++++++++++<BR>walking TestActionArray<BR>+++++++++++++++++++<BR>
<BR><B>Function==CheckTestActionResult(0,0) file /home/httpd/html/mom/momact.c line
203</B><BR>
Key 0 not used<BR>
<BR><B>Function==CheckTestActionResult(Object,2) file /home/httpd/html/mom/momact.c line
203</B><BR>
key 2 for object Object
<BR>-----------------------<BR>
For Object 'ActionResult ($ARValue)':<BR>
-----------------------<BR>
new action result!<BR>
Creating New Alarm Info Object<BR>
$Alarm was NOT set<BR>
-----------------------<BR>
For Object 'ActionResult':<BR>
-----------------------<BR>
FATAL: erealloc(): Unable to allocate 1699901065 bytes
888888888888888888888888888888888888888888888888888888
(browser)
http://127.0.0.1/mom/mom.php
System is running 128 meg on linux.
The objects's variables having weird stuff in them is shown in this printout:
999999999999999999999999999999999999999999999999999999999999
printout of web page:
9999999999999999999999999999999999999999999999999999999999
----->defining debug in file /home/httpd/html/mom/mom.c at line 242
Function==MonitorMachines file /home/httpd/html/mom/momact.c line 334
walking MonitoredMachineArray
Function==RunTestAction(0, 0): file /home/httpd/html/mom/momact.c line 139
Function==RunTestAction(Object, 1): file /home/httpd/html/mom/momact.c line 139
Function==RunAction(2,1) file /home/httpd/html/mom/momact.c line 71
Running PHP Command String
$ExecString="echo 'Sendmail is being Tested
';return(SUCCESS);"
Sendmail is being Tested
$Result="1"
$TestActionResult["2"]=RunAction($ActionID,$MMKey)
$ActionID = 2
-----------------------
For Object 'TesActionResult':
ServiceID -> 1
MonitoredMachineID -> 1
Result -> 1
-----------------------
+++++++++++++++++++
walking TestActionArray
+++++++++++++++++++
Function==CheckTestActionResult(0,0) file /home/httpd/html/mom/momact.c line 201
Key 0 not used
Function==CheckTestActionResult(Object,2) file /home/httpd/html/mom/momact.c line 201
key 2 for object Object
-----------------------
For Object 'ActionResult ($ARValue)':
ServiceID -> 1
MonitoredMachineID -> 1
Result -> 1
-----------------------
new action result!
Creating New Alarm Info Object
$Alarm was NOT set
-----------------------
For Object 'ActionResult':
ServiceID -> 1
MonitoredMachineID -> ActionResult
Result -> 1
-----------------------
$ServiceID=1, $MachineID=D? d[
ExitNow called from 264 in file /home/httpd/html/mom/momact.c
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function DisplayObject(&$Obj,$Name)// crash occurs even when obj //copied by not using & in
front of $Obj parameter description
{
echo "-----------------------<BR>n";
echo "For Object '$Name':<BR>n";
while ( list($key,$value) = each($Obj) )
{
if (gettype($key) == "string")
echo "$key -> $value<BR>n";
}
echo "-----------------------<BR>n";
}
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
{
if (defined("DEBUG"))
echo "Creating New Alarm Info Object<BR>n";
$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["$ARKey"];
}
else
if (defined("DEBUG"))
echo "$Alarm was NOT set<BR>n";
DisplayObject($ARValue,"ActionResult");
$MachineID = $ARValue->MonitoredMachineID;
$ServiceID = $ARValue->ServiceID;
if (defined("DEBUG"))
echo "$ServiceID=$ServiceID, $MachineID=$MachineID<BR>n";
ExitNow(__LINE__,__FILE__);
if ($ARValue->Result == FAIL)
{
$ID = $Service["$ServiceID"]->FKStatusIDDefaultFail ;
$AlarmObj->Type = FAIL;
$AlarmObj->AlarmState = $Service["$ServiceID"]->FKAlarmIDDefaultFail;
}
else
{
$ID = $Service["$ServiceID"]->FKStatusIDDefaultSucceed ;
$AlarmObj->Type = SUCCESS;
if(defined("DEBUG"))
DisplayObject($Service["$ServiceID"],"Service");
$AlarmObj->AlarmState = $Service["$ServiceID"]->FKAlarmIDDefaultsucceed;
}
$AlarmObj->Status = $ID ;
$AlarmObj->MachineID = $MachineID;
$AlarmObj->New = TRUE; // indicate this is a new set
$AlarmObj->ID = 0; // not yet stored in database
$AlarmObj->ServiceID = $ServiceID;
$Alarm["$ARKey"]= $AlarmObj;
unset($AlarmObj); // force freeing of memory
}
}
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=8429