|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patchesampq_queue-patch.c (last revision 2012-07-21 06:27 UTC by cg-php at charlesgentry dot com)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-08-23 11:07 UTC] mwilliams at webgains dot com
[2012-08-26 03:03 UTC] pdezwart@php.net
[2012-08-26 03:03 UTC] pdezwart@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: pdezwart
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 08:00:01 2025 UTC |
Description: ------------ If the code in the callback of the consume function throws an exception, PHP will lock up. This is caused by the amqp_consume ignoring exceptions and continuing to try to call the function. This happens with both 1.0.3 and 1.0.4 Test script: --------------- <?php $cnn = new AMQPConnection(); $cnn->connect(); $ch = new AMQPChannel($cnn); $ex = new AMQPExchange($ch); $ex->setName('exchange-' . time()); $ex->setType(AMQP_EX_TYPE_FANOUT); $ex->declare(); $q = new AMQPQueue($ch); $q->setName('queue-' . time()); $q->declare(); $q->bind($ex->getName(), 'routing.*'); $ex->publish('message1', 'routing.1'); $ex->publish('message2', 'routing.2'); $count = 0; function consumeThings($message, $queue) { global $count; $count++; echo $message->getBody() . "-" . $message->getRoutingKey() . "\n"; if ($count == 2) { global $ex,$q; $ex->delete(); $q->delete(); throw new Exception( "Dead" ); } return true; } try{ $q->consume("consumeThings"); }catch( Exception $e ){ print $e->getMessage(); } /*--EXPECT-- message1-routing.1 message2-routing.2 Dead */ Expected result: ---------------- message1-routing.1 message2-routing.2 Dead Actual result: -------------- message1-routing.1 message2-routing.2 and then hang.