Bug #77308 [NEW]: Unbuffered queries memory leak

From: Date: Mon, 17 Dec 2018 09:16:01 +0000
Subject: Bug #77308 [NEW]: Unbuffered queries memory leak
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218477@lists.php.net to get a copy of this message
From: sjon at hortensius dot net Operating system: archlinux PHP version: 7.3.0 Package: MySQL related Bug Type: Bug Bug description:Unbuffered queries memory leak Description: ------------ commit f1f1f6 broke unbuffered queries in mysqlnd; there is a memory leak causing php to run out of memory Test script: --------------- <?php ini_set('memory_limit', '8M'); $pdo = new PDO('mysql:host=*;dbname=*', '*', '*'); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $pdo->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false); $result = $pdo->query("SELECT * FROM large_table"); foreach ($result as $i => $row) if ($i % 10000 === 0) printf("%10s %10s\n", $i, memory_get_usage()); Expected result: ---------------- reasonable constant memory usage, eg: 0 427648 10000 427936 20000 427968 30000 427968 40000 427936 Actual result: -------------- 0 427296 10000 2000288 20000 3622336 30000 5260736 40000 6915488 Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 16384 bytes) in /php on line 10 -- Edit bug report at https://bugs.php.net/bug.php?id=77308&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77308&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77308&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77308&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=77308&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=77308&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=77308&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=77308&r=needscript Try newer version: https://bugs.php.net/fix.php?id=77308&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=77308&r=support Expected behavior: https://bugs.php.net/fix.php?id=77308&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=77308&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=77308&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=77308&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77308&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=77308&r=dst IIS Stability: https://bugs.php.net/fix.php?id=77308&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=77308&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=77308&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=77308&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=77308&r=mysqlcfg

« previous php.bugs (#218477) next »