Skip to content

Occasional "CHANNEL_ERROR - expected 'channel.open'" when trying to delete/purge a queue in tests #434

@vorou

Description

@vorou

Here's a piece of TearDown (called after each test):

var queueName = ((RabbitBus) bus).Conventions.QueueNamingConvention(typeof (TestMessage), subscriptionId);
var queue = bus.Advanced.QueueDeclare(queueName);
bus.Advanced.QueuePurge(queue);

The last line is used to be QueueDelete, I've changed it to Purge recently as a wild guess to get rid of the error we get sometimes. But the error is still there:

RabbitMQ.Client.Exceptions.OperationInterruptedException : The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=504, text="CHANNEL_ERROR - expected 'channel.open'", classId=60, methodId=80, cause=
--TearDown
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at EasyNetQ.RabbitAdvancedBus.QueuePurge(IQueue queue)
at DataAccess.Tests.Messaging.EasyNetQSenderTests.TearDown() in c:\BuildAgent\work\72cd9a366486513b\Source\DataAccess.Tests\Messaging\EasyNetQSenderTests.cs:line 29
--OperationInterruptedException
at RabbitMQ.Client.Impl.SimpleBlockingRpcContinuation.GetReply()
at RabbitMQ.Client.Framing.Impl.Model._Private_QueuePurge(String queue, Boolean nowait)
at EasyNetQ.Producer.ClientCommandDispatcherSingleton.<>c__DisplayClass5`1.<Invoke>b__3(IModel channel)
at EasyNetQ.Producer.PersistentChannel.InvokeChannelActionInternal(Action`1 channelAction, DateTime startTime)
at EasyNetQ.Producer.PersistentChannel.InvokeChannelAction(Action`1 channelAction)
at EasyNetQ.Producer.ClientCommandDispatcherSingleton.<>c__DisplayClass5`1.<Invoke>b__2()

I'm not sure how to reproduce it — I just ran the fixture locally for 10 times, and there was no error.

I can share more code if you need it. I also would be happy to use any other way to clean the queue in TearDown, if it's more robust.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions