php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66848 AMQPConnection::setHost() has a memory leak
Submitted: 2014-03-07 16:48 UTC Modified: 2021-06-10 15:36 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: john at eagleeye dot com Assigned: cmb (profile)
Status: Closed Package: amqp (PECL)
PHP Version: 5.5.10 OS: Centos 6.5
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
13 + 10 = ?
Subscribe to this entry?

 
 [2014-03-07 16:48 UTC] john at eagleeye dot com
Description:
------------
AMQPConnection::setHost() has a memory leak

Test script:
---------------
for ($ii = 0; $ii < 200; $ii++) {
    $amqp_connection = new \AMQPConnection();

    if ($ii % 50 == 0) echo $ii.' '.number_format(memory_get_usage()/1024).'KiB'.PHP_EOL;
}
echo $ii.' '.number_format(memory_get_usage()/1024).'KiB'.PHP_EOL.PHP_EOL;

for ($ii = 0; $ii < 200; $ii++) {
    $amqp_connection = new \AMQPConnection();
    $amqp_connection->setHost('127.0.0.1');      // the only difference

    if ($ii % 50 == 0) echo $ii.' '.number_format(memory_get_usage()/1024).'KiB'.PHP_EOL;
}
echo $ii.' '.number_format(memory_get_usage()/1024).'KiB'.PHP_EOL.PHP_EOL;


Expected result:
----------------
memory usage should not increase regardless of the number of iterations of the second loop

Actual result:
--------------
Typical output demonstrating that the second loop with the call the setHost() continually increases memory usage

0 224KiB
50 224KiB
100 224KiB
150 224KiB
200 224KiB

0 224KiB
50 226KiB
100 227KiB
150 229KiB
200 230KiB

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-03-07 17:04 UTC] john at eagleeye dot com
I thought some more environment details might help

$ php -v
                                                                                PHP 5.5.10 (cli) (built: Mar  5 2014 16:41:29) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
    with Xdebug v2.2.4, Copyright (c) 2002-2014, by Derick Rethans


$ pecl list
Installed packages, channel pecl.php.net:
=========================================
Package   Version    State
amqp      1.4.0beta1 beta
gearman   1.1.2      stable
igbinary  1.1.2dev   stable
jsonc     1.3.3      stable
memcache  3.0.8      beta
memcached 2.1.0      stable
mongo     1.4.5      stable
pecl_http 2.0.4      stable
propro    1.0.0      stable
raphf     1.0.4      stable
redis     2.2.4      stable
ssh2      0.12       beta
xdebug    2.2.3      stable
xhprof    0.9.4      beta
zip       1.12.4     stable

$ yum list | grep rabbit
367:librabbitmq.x86_64                     0.5.0-1.el6.remi          @remi          
368:librabbitmq-devel.x86_64               0.5.0-1.el6.remi          @remi          
369:librabbitmq-tools.x86_64               0.5.0-1.el6.remi          @remi          
656:rabbitmq-server.noarch                 3.1.5-1.el6               @epel          
17149:rabbitvcs-cli.noarch                   0.14.2.1-5.el6            epel           
17150:rabbitvcs-core.noarch                  0.14.2.1-5.el6            epel           
17151:rabbitvcs-gedit.x86_64                 0.14.2.1-5.el6            epel           
17152:rabbitvcs-nautilus.x86_64              0.14.2.1-5.el6            epel           
17153:rabbitvcs-thunar.x86_64                0.14.2.1-5.el6            epel
 [2021-06-10 15:36 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-06-10 15:36 UTC] cmb@php.net
The amqp bug tracker is now on Github[1].  If this is still an
issue, please report there.

[1] <https://github.com/php-amqp/php-amqp/issues>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 09:01:27 2024 UTC