Bug #77308 [Com]: Unbuffered queries memory leak

From: Date: Wed, 06 Mar 2019 09:28:22 +0000
Subject: Bug #77308 [Com]: Unbuffered queries memory leak
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-219867@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
 Comment by:         alex at alex-at dot 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:

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.


Previous Comments:
------------------------------------------------------------------------
[2019-02-01 09:05:18] nikic@php.net

Related To: Bug #77554

------------------------------------------------------------------------
[2019-01-14 11:00:06] dmitry@php.net

Automatic comment on behalf of dmitry@zend.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=1a306cc9a1679a758c859731a78429429830a439
Log: Fixed bug #77308 (Unbuffered queries memory leak)

------------------------------------------------------------------------
[2019-01-02 11:30:19] nikic@php.net

Uh sorry, that's what I get for not reading the description...

Link to the commit: https://github.com/php/php-src/commit/f1f1f63ce1a9f984595ce0f61e69169297df7164

------------------------------------------------------------------------
[2019-01-02 11:22:32] sjon at hortensius dot net

I've already bisected this as mentioned, caused by f1f1f6

------------------------------------------------------------------------
[2019-01-02 11:14:56] nikic@php.net

@dmity: Probably related to the mysqlnd arena improvements.

Massif trace:

97.88% (10,719,359B) (heap allocation functions) malloc/new/new[], --alloc-fns, etc.
->91.19% (9,987,510B) 0x953317: __zend_malloc (zend_alloc.c:2904)
| ->76.79% (8,409,934B) 0x9525C8: _emalloc (zend_alloc.c:2494)
| | ->73.05% (8,000,688B) 0x89116A: _mysqlnd_emalloc (mysqlnd_alloc.c:99)
| | | ->72.90% (7,984,000B) 0x8D3CDD: mysqlnd_arena_alloc (mysqlnd_block_alloc.c:66)
| | | | ->72.90% (7,984,000B) 0x8D430D: mysqlnd_mempool_get_chunk (mysqlnd_block_alloc.c:148)
| | | |   ->72.90% (7,984,000B) 0x8A119A: php_mysqlnd_read_row_ex (mysqlnd_wireprotocol.c:1384)
| | | |     ->72.90% (7,984,000B) 0x8A358B: php_mysqlnd_rowp_read (mysqlnd_wireprotocol.c:1724)
| | | |       ->72.90% (7,984,000B) 0x8BF0CE: mysqlnd_mysqlnd_result_unbuffered_fetch_row_c_pub
(mysqlnd_result.c:677)
| | | |         ->72.90% (7,984,000B) 0x8C5755: mysqlnd_mysqlnd_res_fetch_row_c_pub
(mysqlnd_result.c:1757)
| | | |           ->72.90% (7,984,000B) 0x65C177: pdo_mysql_stmt_fetch (mysql_statement.c:660)
| | | |             ->72.90% (7,984,000B) 0x64853F: do_fetch_common (pdo_stmt.c:676)
| | | |               ->72.90% (7,984,000B) 0x648BF1: do_fetch (pdo_stmt.c:831)
| | | |                 ->72.90% (7,984,000B) 0x64F1BF: pdo_stmt_iter_move_forwards
(pdo_stmt.c:2447)
| | | |                   ->72.90% (7,984,000B) 0xA214AA: ZEND_FE_FETCH_R_SPEC_VAR_HANDLER
(zend_vm_execute.h:21484)
| | | |                     ->72.90% (7,984,000B) 0xA624CD: execute_ex (zend_vm_execute.h:57707)
| | | |                       ->72.90% (7,984,000B) 0xA656DA: zend_execute
(zend_vm_execute.h:60833)
| | | |                         ->72.90% (7,984,000B) 0x98AE19: zend_execute_scripts
(zend.c:1568)
| | | |                           ->72.90% (7,984,000B) 0x8F0BE1: php_execute_script
(main.c:2630)
| | | |                             ->72.90% (7,984,000B) 0xA6842F: do_cli (php_cli.c:997)
| | | |                               ->72.90% (7,984,000B) 0xA695A5: main (php_cli.c:1389)

Presumably freeing chunks from the arena doesn't work properly anymore.

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


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


Thread (13 messages)

« previous php.bugs (#219867) next »