<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">Looking through the source of rabbitmq-c I see mutex code around ssl initialization (amqp_openssl.c), but I don’t see how that could cause your issue.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">I’m wondering why you’d want to mutex either around the RPC request or if you’re calling amqp_consume_message (<a href="https://github.com/alanxz/rabbitmq-c/blob/master/librabbitmq/amqp_consumer.c#L136">https://github.com/alanxz/rabbitmq-c/blob/master/librabbitmq/amqp_consumer.c#L136</a>). What does putting a lock around your “basic_consume()” invocation achieve?</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">Consuming is an asynchronous operation. You register your app as a consumer with RabbitMQ, then as RabbitMQ sees fit, messages are delivered to your application. Without context, I’m interpreting what you’re doing as if you want to use Basic.Get instead.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div> <div id="bloop_sign_1387222632388444928" class="bloop_sign"></div> <div style="color:gray"><hr style="style:linear">From: <span style="color:black">Gavin M. Roy</span> <a href="mailto:gavinmroy@gmail.com">Gavin M. Roy</a><br>Reply: <span style="color:black">Gavin M. Roy</span> <a href="mailto:gavinmroy@gmail.com">gavinmroy@gmail.com</a><br>Date: <span style="color:black">December 16, 2013 at 2:33:11 PM</span><br>To: <span style="color:black">Raj Kumar Sanpui</span> <a href="mailto:raj.kumar.sanpui@gmail.com">raj.kumar.sanpui@gmail.com</a>, <span style="color:black">Discussions about RabbitMQ</span> <a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>Subject: <span style="color:black"> Re: [rabbitmq-discuss] Why does the queue drop other messages after the first is consumed? <br></span></div> <blockquote type="cite" class="clean_bq"><span><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>
<title></title>
<div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">
What library are you using?</div>
<div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">
<br></div>
<div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">
basic.consume() is not quite as simple as your code would imply.
While it is issuing a RPC request to start consuming, most
libraries have some semantics around its use such as registering a
callback or setting up behaviors for what happens when messages are
received from RabbitMQ. I think there’s more to what’s going on
than you realize.</div>
<div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">
<br></div>
<div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">
<br></div>
<div id="bloop_sign_1387222297580329984" class="bloop_sign"></div>
<div style="color:gray">
<hr style="style:linear">
From: <span style="color:black">Raj Kumar Sanpui</span>
<a href="mailto:raj.kumar.sanpui@gmail.com">Raj Kumar
Sanpui</a><br>
Reply: <span style="color:black">Discussions about
RabbitMQ</span> <a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
Date: <span style="color:black">December 16, 2013 at 2:31:26
PM</span><br>
To: <span style="color:black">Discussions about
RabbitMQ</span> <a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
Subject: <span style="color:black">Re: [rabbitmq-discuss] Why
does the queue drop other messages after the first is
consumed?<br></span></div>
<blockquote type="cite" class="clean_bq">
<div>
<div>
<div dir="ltr"><span>Agreed, but something as simple as:</span>
<div><span><br></span></div>
<div><span>{{{</span></div>
<div><span>pthread_mutex_lock(&mutex);</span></div>
<div><span>basic.consume( );</span></div>
<div><span>pthread_mutex_unlock(&mutex);<br></span></div>
<div><span>}}}</span></div>
<div><span><br></span></div>
<div><span>Should not have any issues (unless the library you are
using has), and there are no issues in above code, if you can
see.</span></div>
<div><span><br></span></div>
<div><span><br></span></div>
</div>
<div class="gmail_extra"><span><br>
<br></span>
<div class="gmail_quote"><span>On Tue, Dec 17, 2013 at 12:40 AM,
Alvaro Videla <span dir="ltr"><<a href="mailto:videlalvaro@gmail.com" target="_blank">videlalvaro@gmail.com</a>></span> wrote:<br></span>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
Well it might be the code is corrupting the channel state,
RabbitMQ<br>
will just act based on the order you send AMQP commands to it. If
your<br>
code sends those commands in the wrong order, then errors
might<br>
happen, for example ack'ing the wrong message or things like
that.<br>
<br>
RabbitMQ is a server, which means, it is not concerned on
which<br>
threading library your application is using, or even if it is
using<br>
threads at all. Your application will send "requests" to RabbitMQ
and<br>
RabbitMQ will service them. In this case the requests are
AMQP<br>
commands.<br>
<br>
Regards,<br>
<br>
Alvaro<br>
<br>
On Mon, Dec 16, 2013 at 6:59 PM, Raj Kumar Sanpui<br>
<div class="HOEnZb">
<div class="h5"><<a href="mailto:raj.kumar.sanpui@gmail.com">raj.kumar.sanpui@gmail.com</a>>
wrote:<br>
> @Alvaro: The same code works perfect, if there are no
pthread_mutex_lock.<br>
><br>
> Can Allan know anything about it.<br>
> @Alan Antonuk: Alan, do you have any issue in your library
with regard to<br>
> thread locks (pthread_mutex_lock) ?<br>
><br>
><br>
><br>
><br>
> On Tue, Dec 17, 2013 at 12:26 AM, Alvaro Videla <<a href="mailto:videlalvaro@gmail.com">videlalvaro@gmail.com</a>><br>
> wrote:<br>
>><br>
>> Well, perhaps either your code or the AMQP library has
that problem.<br>
>> RabbitMQ doesn't know anything about application specific
code.<br>
>><br>
>> On Mon, Dec 16, 2013 at 6:48 PM, Raj Kumar Sanpui<br>
>> <<a href="mailto:raj.kumar.sanpui@gmail.com">raj.kumar.sanpui@gmail.com</a>>
wrote:<br>
>> > Seems like rabbitmq has an allergy towards thread
locks.<br>
>> > Invoke a consumer thread (basic.consume) calling
pthread_mutex_lock( )<br>
>> > and<br>
>> > all but one message gets dropped. Same works
absolutely fine, if no<br>
>> > thread<br>
>> > locks are used.<br>
>> ><br>
>> ><br>
>> > On Mon, Dec 16, 2013 at 11:22 PM, Michael
Klishin<br>
>> > <<a href="mailto:mklishin@gopivotal.com">mklishin@gopivotal.com</a>><br>
>> > wrote:<br>
>> >><br>
>> >> On 16 Dec 2013, at 21:47, Raj Kumar Sanpui
<<a href="mailto:raj.kumar.sanpui@gmail.com">raj.kumar.sanpui@gmail.com</a>><br>
>> >> wrote:<br>
>> >><br>
>> >> > In between, do we have any man page for
basic.consume?<br>
>> >> ><br>
>> >> > What does "no ack", "exclusive", "local"
stands for?<br>
>> >><br>
>> >> Ignore local. Exclusive means that there can only
ever be one consumer<br>
>> >> on<br>
>> >> the queue.<br>
>> >><br>
>> >> no ack means “no manual ack”, that is, you don’t
intend to use manual<br>
>> >> acknowledgements of<br>
>> >> deliveries. See tutorial 2: <a href="http://www.rabbitmq.com/getstarted.html" target="_blank">http://www.rabbitmq.com/getstarted.html</a><br>
>> >> and <a href="http://www.rabbitmq.com/amqp-0-9-1-reference.html#domain.no-ack" target="_blank">http://www.rabbitmq.com/amqp-0-9-1-reference.html#domain.no-ack</a><br>
>> >><br>
>> >> MK<br>
>> >><br>
>> >> Software Engineer, Pivotal/RabbitMQ<br>
>> >><br>
>> >><br>
>> >>
_______________________________________________<br>
>> >> rabbitmq-discuss mailing list<br>
>> >> <a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
>> >> <a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
>> ><br>
>> ><br>
>> ><br>
>> > _______________________________________________<br>
>> > rabbitmq-discuss mailing list<br>
>> > <a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
>> > <a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
>> ><br>
>> _______________________________________________<br>
>> rabbitmq-discuss mailing list<br>
>> <a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
>> <a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
><br>
><br>
><br>
> _______________________________________________<br>
> rabbitmq-discuss mailing list<br>
> <a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
> <a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
><br>
_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
</div>
</div>
</blockquote>
</div>
<br></div>
_______________________________________________<br>
rabbitmq-discuss mailing list<br>
rabbitmq-discuss@lists.rabbitmq.com<br>
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss<br>
</div>
</div>
</blockquote>
</div></div></span></blockquote></body></html>