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

 ID:                 63642
 Updated by:         m...@php.net
 Reported by:        amex at bucksvsbytes dot com
 Summary:            No "out of memory" error during ->fetchAll() from
                     PostgreSQL
-Status:             Assigned
+Status:             Not a bug
 Type:               Bug
 Package:            PDO related
 Operating System:   Ubuntu
 PHP Version:        5.3.19
 Assigned To:        willfitch
 Block user comment: N
 Private report:     N

 New Comment:

Cannot reproduce.  This is probably your kernel OOM killer tricking you.

cli -d error_reporting=-1 -d memory_limit=5M -r '$pdo = new 
PDO("pgsql:user=phptest dbname=phptest"); $stm = $pdo->query("select 
repeat(\x27a\x27, 5*1024*1025) as data"); var_dump($stm->fetchAll());'

Fatal error: Allowed memory size of 5242880 bytes exhausted at 
/home/mike/src/php-5.4/ext/pdo/pdo_stmt.c:641 (tried to allocate 5248001 bytes) 
in Command line code on line 1


Previous Comments:
------------------------------------------------------------------------
[2012-12-19 00:09:58] amex at bucksvsbytes dot com

Yes, my PHP development system displays every error, warning, and notice on 
screen.

------------------------------------------------------------------------
[2012-12-18 21:17:38] willfi...@php.net

Without looking into this too far, have you verified that 
error_reporting/display_errors are set to levels that are sufficient to display 
or 
record this error?

------------------------------------------------------------------------
[2012-11-29 00:25:41] amex at bucksvsbytes dot com

Description:
------------
In PHP 5.3.10 and PostgreSQL 9.1, when executing PDOStatement::fetchAll(), if 
the retrieved data busts the PHP memory limit, the script dies quietly, without 
throwing an "out of memory" error.

Test script:
---------------
//ini_set('memory_limit','256M');
$dsn=;//appropriate Data Source Name string
$sql=;//any query that returns slightly more data than the PHP memory limit 
allows (default limit is 128 MB on my server)
$db=new PDO($dsn);
$result=$db->query($sql);
$datarray=$result->fetchAll();//fetch all rows into an array


Expected result:
----------------
When fetchAll() retrieves too much data, the script dies quietly, instead of 
throwing an "out of memory" error.
When I uncomment the first line, the script runs to completion, thus proving 
that the quiet death was due to lack of memory.

The problem seems to relate to the postgresql driver, as the same thing happens 
when I use pg_connect/pg_query/pg_fetch_all instead of PDO to get data from the 
same query.

This is the only PHP "out of memory" condition I've ever seen where no error is 
thrown.




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



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

Reply via email to