akalend / amqpcpp

rabbitcpp is a C++ library for Message Queue Server RabbitMQ
MIT License
228 stars 142 forks source link

Consumer is not working after some time #100

Closed durgesh-tanuku closed 1 year ago

durgesh-tanuku commented 2 years ago

After running the consumer for sometime, the program is not receiving any messages posted into the queue. In GDB, the code is getting blocked at "amqp_simple_wait_frame" method of AMQPQueue.cpp file.


(gdb) bt
#0  0x00007ffff7c81997 in __GI___poll (fds=0x7fffffffd980, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007ffff7f69a45 in recv_with_timeout () from /usr/local/lib/x86_64-linux-gnu/librabbitmq.so.4
#2  0x00007ffff7f6a3f9 in wait_frame_inner () from /usr/local/lib/x86_64-linux-gnu/librabbitmq.so.4
#3  0x00007ffff7f6a9af in amqp_simple_wait_frame_noblock () from /usr/local/lib/x86_64-linux-gnu/librabbitmq.so.4
#4  0x00007ffff7fa336f in AMQPQueue::sendConsumeCommand (this=0x5555555ade20) at src/AMQPQueue.cpp:463
#5  0x00007ffff7fa2f5e in AMQPQueue::Consume (this=0x5555555ade20, parms=256) at src/AMQPQueue.cpp:390
#6  0x0000555555556edc in main (argc=3, argv=0x7fffffffe028) at consume.cpp:64
LDRS-jtwine commented 1 year ago

If your "for some time" is a small number of messages, like < 100 of them, make sure you are ACKing your messages by calling AMQPQueue::Ack() for each message received if you have not set the NoAck flag when you are consuming messages.

durgesh-tanuku commented 1 year ago

The issue is resolved after reducing the heartbeat interval