Bug #77308 [Csd]: Unbuffered queries memory leak

From: Date: Thu, 07 Nov 2019 08:26:35 +0000
Subject: Bug #77308 [Csd]: Unbuffered queries memory leak
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-223619@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77308&edit=1 ID: 77308 Updated by: sjon@php.net Reported by: sjon at hortensius dot net Summary: Unbuffered queries memory leak Status: Closed Type: Bug Package: MySQL related Operating System: archlinux PHP Version: 7.3.0 Assigned To: dmitry Block user comment: N Private report: N New Comment: @kinimodmeyer the problem as originally reported has been fixed. Unless the exact same reproduction script causes the exact same error, you are probably running into another bug that needs a separate bug-report. Previous Comments: ------------------------------------------------------------------------ [2019-11-07 07:38:24] kinimodmeyer at gmail dot com why is the state closed? the problem still exists. see alex of 2019-03-18 12:38 UTC ------------------------------------------------------------------------ [2019-03-18 12:38:12] alex at alex-at dot net Still present in 7.3.3 Some details of test run: --- 1. Versions #/opt/php71/bin/php -v PHP 7.1.27 (cli) (built: Mar 18 2019 13:00:22) ( ZTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies # /opt/php72/bin/php -v PHP 7.2.16 (cli) (built: Mar 18 2019 13:03:57) ( ZTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies # /opt/php73/bin/php -v PHP 7.3.3 (cli) (built: Mar 18 2019 13:07:58) ( ZTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.3, Copyright (c) 1998-2018 Zend Technologies --- 2. Top data for ~10 sec of script run 7.1: 112241 root 20 0 307892 13932 8396 R 100.0 0.2 0:11.82 /opt/php71/bin/php ./test.php 7.2: 111796 root 20 0 310480 14228 8460 R 99.7 0.2 0:10.41 /opt/php72/bin/php ./test.php 7.3: 110517 root 20 0 1148804 848480 8716 R 99.7 10.4 0:10.37 /opt/php73/bin/php ./test.php You can easily see RES size growing from stable 14M on PHP 7.1/7.2 to 840M+ on PHP 7.3. The script fails with out of memory error eventually (Allowed memory size of 1073741824 bytes exhausted (tried to allocate 16384 bytes) in /config/scripts/test.php on line 10) --- 3. Script excerpt (it's ultimately simple, but the query returns 11+ million rows) #!/opt/php73/bin/php <?php error_reporting(E_ALL); ini_set('display_errors', 1); ini_set('memory_limit', '1G'); $db = new MySQLi('<server>', '<login>', '<password>', 'radius'); $res = $db->query('SELECT AcctSessionId AS sid, AcctUniqueId AS uid FROM radacct ORDER BY AcctSessionId, AcctUniqueId', MYSQLI_USE_RESULT); while (is_array($row = $res->fetch_assoc())); $res->free(); --- ------------------------------------------------------------------------ [2019-03-18 11:57:36] alex at alex-at dot net No, not running PDO, just new MySQLi class instantiation. Will check 7.3.3 and report though. ------------------------------------------------------------------------ [2019-03-06 09:34:36] nikic@php.net @alex: If you are disabling emulated prepared statements, then you're likely hitting bug #77599, which is fixed in 7.3.3. ------------------------------------------------------------------------ [2019-03-06 09:28:22] alex at alex-at dot net Still experiencing unbuffered query memory leak on 7.3.2. The test case is simple: obtaining 11 million rows with just fetch_assoc in a loop, no other code. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=77308 -- Edit this bug report at https://bugs.php.net/bug.php?id=77308&edit=1

« previous php.bugs (#223619) next »