Edit report at https://bugs.php.net/bug.php?id=55384&edit=1

 ID:                 55384
 Updated by:         bj...@php.net
 Reported by:        peter dot colclough at toolstation dot com
 Summary:            AMQP::consume()
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            Unknown/Other Function
 Operating System:   Ubuntu 10 , 64Bit
 PHP Version:        5.3.7RC4
 Block user comment: N
 Private report:     N

 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Please file pecl extension issues in their own bug tracker, 
http://pecl.php.net/bugs/report.php?package=amqp


Previous Comments:
------------------------------------------------------------------------
[2011-08-09 11:03:07] peter dot colclough at toolstation dot com

Description:
------------
---
>From manual page: http://www.php.net/amqpqueue.consume
---
Using this against a RabbitMQ server...

This is a very small snippet of very simple code. If you use the consume on a 
durable message on a durable queue, this just eats up memory, and kills teh 
machine, when it hits around 7k messages.
Using get() all is Ok. It looks like a memory leak somewhere in teh AMQP 
code....

Test script:
---------------
include_once('../config/config.php');
$nMessNum = 4000;
$nCount = 0;
$nTimeLimit = 600;

$nI = 0;
$sMessRoute = '';
while($nI++ < 10000){
$sMessRoute .= 'a';
} 

$nstart = microtime_float();
$amp = new AMQPConnection($RABBIT_SERVERS);
if($amp->connect()){
        echo('Connected to Host'."\n");
        // Declare a new exchange
        $options = AMQP_DURABLE;
        $ex = new AMQPExchange($amp,'stone_warren');
        $ex->declare('stone_warren', AMQP_EX_TYPE_FANOUT, AMQP_DURABLE);
  
        // Create a new queue
        $q = new AMQPQueue($amp);
        $q->declare('queue1',AMQP_DURABLE);

        // Bind it on the exchange to routing.key
        $ex->bind('queue1', 'routing.key');

        // consume a message to the exchange with a routing key...and ack it.
        $options = array(
                'min'=>1,
           'max'=>10,
           'ack'=>true
        );
        
        $nMsgCount = 0;
        $tsStart = time();
           
        while(1){                       // Forever
                        
           $nCount++;
           // This dies soon... after about 7k messages
           $msg = $q->consume($options);
           //$msg = $q->get(0);
           echo(print_r($msg, true)."\n");
                
           usleep(10000);
           if((file_exists('consumer'.$nType.'.stop')) ||
              ((time() - $tsStart)  >               $nTimeLimit)){
                   break;
            }
        }

}else{
        echo("Failed to connect \n");
} 
// END OF CODE


Expected result:
----------------
Should run forever, consuming messages placed on the queue by a similar 
process. Using get() I was able to process 23m messages over a 3 day period. 
Using consume(), I die in a matter of minutes.



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



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55384&edit=1

Reply via email to