Edit report at https://bugs.php.net/bug.php?id=64511&edit=1

 ID:                 64511
 Updated by:         yohg...@php.net
 Reported by:        psiek at mscgva dot ch
 Summary:            Strange memory allocation error message spamming
 Status:             Feedback
 Type:               Bug
 Package:            MSSQL related
 Operating System:   ubuntu 12.10
 PHP Version:        5.4.13
 Block user comment: N
 Private report:     N

 New Comment:

[Mon Mar 25 08:53:55 2013] [error] [client x.x.x.x] PHP Fatal error:  Allowed 
memory size of 536870912 bytes exhausted (tried to allocate 140429927214120 
bytes) in Unknown on line 0, referer:

This log indicates that you have been exhausted available memory. (512MB)

When you get query result from your db server, records are stored in memory 
which is not managed by PHP.

If you do

do {
       $rowset = $query->fetchAll(PDO::FETCH_ASSOC);
       if ($rowset)
       {
             $RecordsetFields[] = $rowset;
       }
} while ($query->nextRowset());

Then results are stored in PHP managed memory. I wander why your script 
works(?) 
even with the memory exhaustion error.

Are you sure that query result fit in your PHP managed memory?
How many records are there? and what the size of each record?

Could you use memory_get_usage() 
http://jp2.php.net/manual/en/function.memory-get-usage.php
in the "do" loop to see memory usage of your script and report the result back?


Previous Comments:
------------------------------------------------------------------------
[2013-03-27 11:06:50] psiek at mscgva dot ch

Hi,

Thanks for your reply.
Here is a sample code that reproduce the error. Please note that sometimes this 
code not generate the error, and I can't find why. When you reload the page, it 
mostly generated but a few time not.

<?php
$connection = new PDO('dblib:dbname=xxx;host=yyy;', 'zxzxzx', 'zxzxzx');
$connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$query = $connection->query("xxx.dbo.zzzzz @ServerName = NULL, @ProcessName = 
NULL, @LayoutID = NULL");

$RecordsetFields = array();

do {
       $rowset = $query->fetchAll(PDO::FETCH_ASSOC);
       if ($rowset)
       {
             $RecordsetFields[] = $rowset;
       }
} while ($query->nextRowset());

print_r($RecordsetFields);


The query is working perfectly, excepted the message in error.log.
This is anoyong because we are monitoring errors in real time and this is 
generating 99% of false positives.

Once again, thanks for your help.

Regards,

------------------------------------------------------------------------
[2013-03-26 16:31:38] larue...@php.net

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.



------------------------------------------------------------------------
[2013-03-25 14:09:57] psiek at mscgva dot ch

Description:
------------
Hi,

Each time I use dblib + freetds (read or write) I got following messages :


[Mon Mar 25 08:53:55 2013] [error] [client x.x.x.x] PHP Fatal error:  Allowed 
memory size of 536870912 bytes exhausted (tried to allocate 140429927214120 
bytes) in Unknown on line 0, referer: http://blahblah

All seems to work, excepted the weird message that fill my logs.

I tryed with multiple versions of php (from 5.4.0 up to 5.4.11) on three 
different servers, they all give the same message.

Regards,

Expected result:
----------------
No error message in error/php log

Actual result:
--------------
[Mon Mar 25 08:53:55 2013] [error] [client x.x.x.x] PHP Fatal error:  Allowed 
memory size of 536870912 bytes exhausted (tried to allocate 140429927214120 
bytes) in Unknown on line 0, referer: http://blahblah



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



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

Reply via email to