#48528 [NEW]: mysqlnd causes PDO/MySQLi to leak memory
| From: | bugs dot php dot net at moesen dot nu | Date: | Thu, 11 Jun 2009 12:17:58 +0000 |
| Subject: | #48528 [NEW]: mysqlnd causes PDO/MySQLi to leak memory | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-138205@lists.php.net to get a copy of this message | ||
From: bugs dot php dot net at moesen dot nu
Operating system: Linux 2.6
PHP version: 5.3CVS-2009-06-11 (snap)
PHP Bug Type: MySQL related
Bug description: mysqlnd causes PDO/MySQLi to leak memory
Description:
------------
PHP 5.3 leaks memory when using the MySQL functions, both through PDO and
MySQLi directly. When recompiled without mysqlnd, the same code works
fine.
./configure --with-mysql=shared,mysqlnd --with-mysqli=shared,mysqlnd
--with-pdo-mysql=shared,mysqlnd [ . . . ]
Recompiled today's snapshot without the ',mysqlnd'.
Reproduce code:
---------------
PDO:
$db = new PDO($dsn, $user, $pass);
$stmt = $test->prepare('SELECT * FROM tech_eciffOkcab.crawlPriceComp');
$result = $stmt->execute();
while($result && $row = $stmt->fetch(PDO::FETCH_ASSOC)) {
echo memory_get_usage(), "\n";
}
MySQLi:
$db = new MySQLi($host, $user, $pass);
$result = $db->query('SELECT * FROM tech_eciffOkcab.crawlPriceComp');
while ($result && $row = $result->fetch_assoc()) {
echo memory_get_usage(), "\n";
}
Expected result:
----------------
Consistent memory_get_usage();
I.e., no extra memory required, and thus no out-of-memory errors.
Actual result:
--------------
Linearly increasing memory_get_usage();
PDO:
23168400
23169064
...
33552804
33552916
-> OOM and segfault.
MySQLi:
23168216
23168700
...
33552812
33552924
-> OOM and segfault.
--
Edit bug report at http://bugs.php.net/?id=48528&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48528&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48528&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48528&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=48528&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48528&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=48528&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=48528&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=48528&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=48528&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=48528&r=support
Expected behavior: http://bugs.php.net/fix.php?id=48528&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=48528&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=48528&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=48528&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48528&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48528&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=48528&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=48528&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=48528&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=48528&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=48528&r=mysqlcfg