NServiceBus & AzureServiceBus transport - exception when finishing message processing

I’m seeing some odd connectivity (presumably) issues with ASB after my handler is run successfully and I’m unable to track down the root cause (or workarounds). This causes (in my opinion) unnecessary retries.

Basically I have a simple handler that sends out emails using SMTP. Email is sent out fine, but later it still fails with the exception:

Microsoft.Azure.ServiceBus.ServiceBusException: 'sender23' is closed
   at Microsoft.Azure.ServiceBus.Core.MessageReceiver.DisposeMessagesAsync(IEnumerable`1 lockTokens, Outcome outcome)
   at Microsoft.Azure.ServiceBus.RetryPolicy.RunOperation(Func`1 operation, TimeSpan operationTimeout)
   at Microsoft.Azure.ServiceBus.RetryPolicy.RunOperation(Func`1 operation, TimeSpan operationTimeout)
   at Microsoft.Azure.ServiceBus.Core.MessageReceiver.CompleteAsync(IEnumerable`1 lockTokens)
   at NServiceBus.Transport.AzureServiceBus.MessagePump.ProcessMessage(Task`1 receiveTask)

This causes the message to be retried and email will be sent out again.

And I’m not been able to figure out why this happens or what can I do about it. And I noticed same exception in another endpoint also, which uses the same ASB namespace. Message processing time is minimal, under 300ms. So I don’t suspect any locking issues with messages.

I’m using NServiceBus 7.1.6 and NServiceBus.Transport.AzureServiceBus 1.0.0, application is dotnet core console application which runs on Windows.

Hi Siim,

This might be related to the issue described in the announcement here. If you follow the link, it will take you to the ASB client GitHub issue. I encourage to track that issue for progress and add a comment to indicate you’re affected.

PS: please note that there’s been a patch released and version 1.0.1 of the transport is available. It doesn’t address this specific issue, but another one.

Hi,

Thanks for reply. I was aware of 1.0.1 patch, but it didn’t seem to relate with my issue.

As of the ASB GitHub issue, it indeed seems similar and I keep an eye on it.

Hi Siim,

A new version of the transport has been published.
Please see the release announcement here .