[rabbitmq-discuss] Connection.createChannel() hangs using amqp-client 3.1.1
Tim Watson
tim at rabbitmq.com
Fri Jun 7 09:57:43 BST 2013
Hi Jonathan,
Ok, you can safely ignore what I've written below. What's actually going on (thanks to Matthias for pointing it out) is that the ShutdownListener callbacks run in the connection's thread, so the call to createChannel causes a deadlock since it blocks waiting for a response (whilst the connection's thread is stuck executing the listener). I'm going to add some notes to the API documentation explaining that, so future users don't get caught out in the same way.
The canonical approach to dealing with this is to have the shutdown listener callback signal your own (application) thread, from which you can manage recovery without risking deadlock in this fashion.
Cheers,
Tim
On 7 Jun 2013, at 09:38, Tim Watson wrote:
> Hi Jonathan,
>
> On 6 Jun 2013, at 23:42, Jonathan Halterman wrote:
>> I hit on a scenario where connection.createChannel() may hang forever. The scenario: obtain a channel and attempt to publish to a non-existent exchange. The channel will be shutdown. Attempt to establish a new (replacement) channel via Connection.createChannel(), which hangs forever. A simple version of this scenario:
>>
>
> This should not be happening. Are you absolutely sure you're using version 3.1.1 of the java client library, since a similar bug (involving accidentally re-used channel ids) was fixed in a previous release: http://hg.rabbitmq.com/rabbitmq-java-client/rev/ea7d68c2154d
>
>> From Tracer:
>>
>> 1370554962786: <Tracer-0> ch#1 <- {#method<channel.close>(reply-code=404, reply-text=NOT_FOUND - no exchange 'foo' in vhost '/', class-id=60, method-id=40), null, ""}
>> 1370554962788: <Tracer-0> ch#1 -> {#method<channel.close-ok>(), null, ""}
>> 1370554974891: <Tracer-0> ch#1 -> {#method<channel.open>(out-of-band=), null, ""}
>> 1370554974970: <Tracer-0> ch#1 <- {#method<channel.open-ok>(channel-id=), null, ""}
>>
>
> That last line seems very odd - I would've expected to a see a channel id in there, though truth be told I'm not overly familiar with the Tracer tool in the java client.
>
>> Any ideas why things are hanging?
>>
>
> According to the last line of the trace you've supplied, a new channel was opened successfully, though there's no channel id present which is worrying. Please confirm that you are definitely using the right version (i.e., where did you obtain the amqp-client binary from) and we'll take a closer look.
>
> Cheers,
> Tim
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
More information about the rabbitmq-discuss
mailing list