<div dir="ltr">Thanks, Ben. I'll apply the patch.<br><br>Incidentally this is the only part of the entire Erlang Rabbit code base that uses queue:head/1 :)<br><br>I'm glad that I was not hallucinating; I was so tired when I looked at that code the screen was getting blurred...<br>
<br>Ironically, I looked suspiciously at the use of cast in the code, but then I thought, why not be able to cast? I thought wrong.<br><br>Edwin<br><br><div class="gmail_quote">On Tue, Sep 23, 2008 at 7:49 AM, Ben Hood <span dir="ltr"><<a href="mailto:0x6e6562@gmail.com">0x6e6562@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Edwin,<br>
<div><div></div><div class="Wj3C7c"><br>
On Tue, Sep 23, 2008 at 5:49 AM, Edwin Fine<br>
<<a href="mailto:rabbitmq-discuss_efine@usa.net">rabbitmq-discuss_efine@usa.net</a>> wrote:<br>
> I believe this is coming from the Erlang client, in<br>
> amqp_channel:rpc_bottom_half/2. I can't tell you why your program is doing<br>
> this, only where the error message originates. It seems to be happening in<br>
> response to receiving a tx.select_ok, AFAICS.<br>
><br>
> If you look at the code for rpc_bottom_half (reproduced at the end of this<br>
> email for convenience), the line<br>
><br>
> {{value, {From,_}}, NewRequestQueue} = queue:out(RequestQueue)<br>
><br>
> will create the error message you are seeing if RequestQueue is empty. This<br>
> can clearly be seen in the shell:<br>
><br>
> 1> EmptyQ = queue:new().<br>
> {[],[]}<br>
> 2> {{value, {From,_}}, NewRequestQueue} = queue:out(EmptyQ).<br>
> ** exception error: no match of right hand side value {empty,{[],[]}}<br>
><br>
> I don't know if this is a bug or one of those "can't happen" things that<br>
> just didn't give a nice error message. I suspect the latter, because the<br>
> code just cannot continue without the value of "From" to send a reply to.<br>
> Why should the function have been called with a reply if the reply queue is<br>
> empty? Something's wrong somewhere.<br>
><br>
> In addition, maybe I am too tired to see straight, but this looks really<br>
> suspect:<br>
><br>
> catch case queue:head(NewRequestQueue) of<br>
> empty -><br>
> ok;<br>
> {NewFrom,Method} -><br>
> Do2(Writer,Method)<br>
> end,<br>
><br>
> This is because queue:head/1 exits when it is empty and does not return<br>
> 'empty', so the catch will return an EXIT:<br>
><br>
> 1> catch queue:head(queue:new()).<br>
> {'EXIT',{empty,[{queue,head,[{[],[]}]},<br>
> {erl_eval,do_apply,5},<br>
> {erl_eval,expr,5},<br>
> {shell,exprs,6},<br>
> {shell,eval_exprs,6},<br>
> {shell,eval_loop,3}]}}<br>
><br>
> I think this should be<br>
><br>
> catch case queue:head(NewRequestQueue) of<br>
> {'EXIT', {empty,_}} -><br>
> ok;<br>
> {NewFrom,Method} -><br>
> Do2(Writer,Method)<br>
> end,<br>
><br>
<br>
</div></div>Thanks for pointing this one out - it was a branch of the code that<br>
had never been visited by any tests before :-(<br>
<br>
I've applied this patch to the client - see<br>
<a href="http://hg.rabbitmq.com/rabbitmq-erlang-client/rev/ef7db7bfc51a" target="_blank">http://hg.rabbitmq.com/rabbitmq-erlang-client/rev/ef7db7bfc51a</a><br>
<br>
Currently it is only on that branch - this will be merged back into<br>
the mainline when the peer QA is done.<br>
<br>
Note that this is not the solution for the TX issue - that will be<br>
addressed separately.<br>
<font color="#888888"><br>
Ben<br>
<br>
</font></blockquote></div><br></div>