Bug #55384 [NEW]: AMQP::consume()
| From: | peter dot colclough at toolstation dot com | Date: | Tue, 09 Aug 2011 11:03:07 +0000 |
| Subject: | Bug #55384 [NEW]: AMQP::consume() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-162481@lists.php.net to get a copy of this message | ||
From:
Operating system: Ubuntu 10 , 64Bit
PHP version: 5.3.7RC4
Package: Unknown/Other Function
Bug Type: Bug
Bug description:AMQP::consume()
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 bug report at https://bugs.php.net/bug.php?id=55384&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55384&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55384&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55384&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=55384&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55384&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=55384&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=55384&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=55384&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=55384&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=55384&r=support
Expected behavior: https://bugs.php.net/fix.php?id=55384&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=55384&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=55384&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=55384&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55384&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=55384&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=55384&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=55384&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=55384&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=55384&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=55384&r=mysqlcfg