dquangsinh / php-amqplib

Automatically exported from code.google.com/p/php-amqplib
GNU Lesser General Public License v2.1
0 stars 0 forks source link

basic_consume() throws an exception after 5 secs. #15

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run the demo amqp_consumer.php
2. Wait 5 seconds.
3. The program crashes.

What is the expected output? What do you see instead?
I expect the consumer to idle indefinitely and output the data from the
message queue should amqp_publisher send something.
Intead I get the following error after 5 seconds:

PHP Fatal error:  Uncaught exception 'Exception' with message 'Error
reading data. Recevived 0 instead of expected 1 bytes' in
/usr/share/php/amqp_wire.inc:316
Stack trace:
#0 /usr/share/php/amqp_wire.inc(347): AMQPReader->rawread(1)
#1 /share/userdir/daharon/php-amqplib-read-only/amqp.inc(493):
AMQPReader->read_octet()
#2 /share/userdir/daharon/php-amqplib-read-only/amqp.inc(513):
AMQPConnection->wait_frame()
#3 /share/userdir/daharon/php-amqplib-read-only/amqp.inc(166):
AMQPConnection->wait_channel(1)
#4 /share/userdir/daharon/php-amqplib-read-only/amqp.inc(250):
AbstractChannel->next_frame()
#5 /share/userdir/daharon/php-amqplib-read-only/demo/amqp_consumer.php(48):
AbstractChannel->wait()
#6 {main}
  thrown in /usr/share/php/amqp_wire.inc on line 316

What version of the product are you using? On what operating system?
SVN downloaded on 4-23-2010

Please provide any additional information below.
If I quickly run the amqp_producer, the consumer will successfully get the
messages and output them.
It only fails if the producer hasn't sent anything for 5 seconds.

Original issue reported on code.google.com by dalij...@gmail.com on 28 Apr 2010 at 7:08

GoogleCodeExporter commented 8 years ago
On what operating system?
Fedora 10, Linux 2.6.27.41-170.2.117.fc10.x86_64, PHP 5.2.9, RabbitMQ 1.7.0

Original comment by dalij...@gmail.com on 28 Apr 2010 at 7:12

GoogleCodeExporter commented 8 years ago
What version of the product are you using?
Revision 25

Original comment by dalij...@gmail.com on 28 Apr 2010 at 7:17

GoogleCodeExporter commented 8 years ago
Increasing the value of read_write_timeout for the AMQPConnection constructor 
allows
the consumer to keep alive longer.  But does not seem to fix the root problem
(whatever it is, not sure).

Original comment by dalij...@gmail.com on 28 Apr 2010 at 9:11

GoogleCodeExporter commented 8 years ago
On further inspection, it looks like it's mainly the buffer_read_timeout in
AMQPReader that is making AMQPReader->rawread() fail.

I'm not sure what to do here.  I really want to use the basic_consume 
functionality,
but it feels kind of wrong to stick the wait() function in a try block and just 
keep
ignoring exceptions.

Original comment by dalij...@gmail.com on 28 Apr 2010 at 10:38

GoogleCodeExporter commented 8 years ago
This issue/patch solved the problem.  He just removed the buffer_read_timeout 
check.
http://code.google.com/p/php-amqplib/issues/detail?id=12&can=1

Original comment by dalij...@gmail.com on 28 Apr 2010 at 11:50