1
votes

I am having issues after migrating to NService 4 (4.0.4). When a message handling fails, it looks like whole NServiceBus is stopping and not doing any work (messages from MSMQ are not consumed any more). After looking into logs, I found the following errors:

NServiceBus.log:

2013-10-02 17:49:31.5786 | FATAL | 110 | Fault manager failed to process the failed message with id aa32dce1-f408-4f6d-b448-a24b0118ec27 System.InvalidOperationException: Could not forward failed message to error queue '[email protected]@localhost' as it could not be found. ---> NServiceBus.Unicast.Queuing.QueueNotFoundException: Failed to send message to address: [[email protected]@localhost] ---> System.Messaging.MessageQueueException: The queue does not exist or you do not have sufficient permissions to perform the operation. at System.Messaging.MessageQueue.MQCacheableInfo.get_WriteHandle() at System.Messaging.MessageQueue.StaleSafeSendMessage(MQPROPS properties, ITransaction transaction) at System.Messaging.MessageQueue.StaleSafeSendMessage(MQPROPS properties, IntPtr transaction) at System.Messaging.MessageQueue.SendInternal(Object obj, MessageQueueTransaction internalTransaction, MessageQueueTransactionType transactionType) at NServiceBus.Transports.Msmq.MsmqMessageSender.Send(TransportMessage message, Address address) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Transports\Msmq\MsmqMessageSender.cs:line 60 --- End of inner exception stack trace --- at NServiceBus.Transports.Msmq.MsmqMessageSender.Send(TransportMessage message, Address address) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Transports\Msmq\MsmqMessageSender.cs:line 76 at NServiceBus.Faults.Forwarder.FaultManager.SendFailureMessage(TransportMessage message, Exception e, Boolean serializationException) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Faults\Forwarder\FaultManager.cs:line 48 --- End of inner exception stack trace --- at NServiceBus.Faults.Forwarder.FaultManager.SendFailureMessage(TransportMessage message, Exception e, Boolean serializationException) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Faults\Forwarder\FaultManager.cs:line 78 at NServiceBus.Unicast.Transport.FirstLevelRetries.TryInvokeFaultManager(TransportMessage message, Exception exception) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Unicast\Transport\FirstLevelRetries.cs:line 71InnerExceptionNServiceBus.Unicast.Queuing.QueueNotFoundException: Failed to send message to address: [[email protected]@localhost] ---> System.Messaging.MessageQueueException: The queue does not exist or you do not have sufficient permissions to perform the operation. at System.Messaging.MessageQueue.MQCacheableInfo.get_WriteHandle() at System.Messaging.MessageQueue.StaleSafeSendMessage(MQPROPS properties, ITransaction transaction) at System.Messaging.MessageQueue.StaleSafeSendMessage(MQPROPS properties, IntPtr transaction) at System.Messaging.MessageQueue.SendInternal(Object obj, MessageQueueTransaction internalTransaction, MessageQueueTransactionType transactionType) at NServiceBus.Transports.Msmq.MsmqMessageSender.Send(TransportMessage message, Address address) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Transports\Msmq\MsmqMessageSender.cs:line 60 --- End of inner exception stack trace --- at NServiceBus.Transports.Msmq.MsmqMessageSender.Send(TransportMessage message, Address address) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Transports\Msmq\MsmqMessageSender.cs:line 76 at NServiceBus.Faults.Forwarder.FaultManager.SendFailureMessage(TransportMessage message, Exception e, Boolean serializationException) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Faults\Forwarder\FaultManager.cs:line 48InnerExceptionSystem.Messaging.MessageQueueException (0x80004005): The queue does not exist or you do not have sufficient permissions to perform the operation. at System.Messaging.MessageQueue.MQCacheableInfo.get_WriteHandle() at System.Messaging.MessageQueue.StaleSafeSendMessage(MQPROPS properties, ITransaction transaction) at System.Messaging.MessageQueue.StaleSafeSendMessage(MQPROPS properties, IntPtr transaction) at System.Messaging.MessageQueue.SendInternal(Object obj, MessageQueueTransaction internalTransaction, MessageQueueTransactionType transactionType) at NServiceBus.Transports.Msmq.MsmqMessageSender.Send(TransportMessage message, Address address) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Transports\Msmq\MsmqMessageSender.cs:line 60

MsmqDequeueStrategy.log has lots of:

2013-10-02 17:49:32.5579 | ERROR | 57 | Error processing message. System.ObjectDisposedException: The semaphore has been disposed. at System.Threading.SemaphoreSlim.Release(Int32 releaseCount) at NServiceBus.Transports.Msmq.MsmqDequeueStrategy.Action() in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Transports\Msmq\MsmqDequeueStrategy.cs:line 227 at System.Threading.Tasks.Task.Execute()

FaultManager.log:

2013-10-02 17:49:31.5746 | FATAL | 110 | Could not forward failed message to error queue '[email protected]@localhost' as it could not be found.

I init NSB as follows:

Configure.Serialization.Xml();
Configure.Features.Enable<TimeoutManager>();
Configure.Features.Enable<Sagas>();

var conf = Configure.With(assemblies)
.CustomConfigurationSource(new BusConfigSource(assemblies))
.DefineEndpointName(ConfigurationManager.AppSettings["InputQueue"])
.CastleWindsorBuilder(container)
.MessageForwardingInCaseOfFault()
.UseInMemoryTimeoutPersister()
.UseTransport<Msmq>()
.PurgeOnStartup(false)
.FileShareDataBus(WebConfigurationManager.AppSettings["NServiceBusFileShare"])
.UnicastBus()
.LoadMessageHandlers()
.MsmqSubscriptionStorage()
.CreateBus()
    .Start(() => Configure.Instance.ForInstallationOn<Windows>().Install());

EDIT: more info. I host NSB in IIS. I Publish, Send and handle messages in it.

Web.config looks like this: Web.config

2
It looks like an error in config as the queue it is trying to send to is quite obviously malformed. Could you post your config?David Boike
I noticed that after disabling SecondLevelRetries things started to working. However I want them running. Also I tried enabling timeouts and I have similar issues. I get error saying 2013-10-03 13:35:12.8477 | WARN | 59 | failed handling message. NServiceBus.Unicast.Queuing.QueueNotFoundException: Failed to send message to address: [[email protected]@localhost] ---> System.Messaging.MessageQueueException: The queue does not exist or you do not have sufficient permissions to perform the operation.stachu

2 Answers

3
votes

The problem is in your Init code...

.DefineEndpointName(ConfigurationManager.AppSettings["InputQueue"])

I don't see that in the screenshot of your Web.config you provided, but based on the error, I'm guessing you have that defined as "administration.worker@localhost". This should be only "administration".

Endpoint name and input queue are not the same thing. Starting from your endpoint name, NServiceBus infers the names of all the queues from there. So input queue is {EndpointName}@localhost. If you're running a master node with an attached worker, the worker's input queue is {EndpointName}.Worker@localhost. The Timeout queue is {EndpointName}.Timeouts@localhost, etc.

Of course you don't usually have to define the endpoint name in an NServiceBus.Host endpoint, but it looks like you are self-hosting in a web application.

Here's more information on the NServiceBus Input Queue / Endpoint Name from the docs.

0
votes

This is a funny looking address: [email protected]@localhost

you may need to add in your config file:

<section name="MessageForwardingInCaseOfFaultConfig" type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core" />

and set

<MessageForwardingInCaseOfFaultConfig ErrorQueue="error"/>

Take a look at the Error handling sample (if you installed NServiceBus it will be in %ProgramFiles%\Particular Software\NServiceBus\v4.0\NServiceBus\Samples\ErrorHandling)

or in Github https://github.com/Particular/NServiceBus/tree/develop/Samples/ErrorHandling

Hope this helps