NServiceBus - The message does not always deliver and throws an exception. Unable to attract transaction

We are using NServiceBus for production and we see the following error in our log files:

ERROR Our.Namespace.SomeMessageHandler [(null)] <(null)> - MethodName  --> end with exception: NServiceBus.Unicast.Queuing.FailedToSendMessageException: Failed to send message to address: our.namespace.worker@somemachinename ---> System.Messaging.MessageQueueException: Cannot enlist the transaction.
    at System.Messaging.MessageQueue.SendInternal(Object obj, MessageQueueTransaction internalTransaction, MessageQueueTransactionType transactionType)
    at NServiceBus.Unicast.Queuing.Msmq.MsmqMessageSender.NServiceBus.Unicast.Queuing.ISendMessages.Send(TransportMessage message, Address address)
    --- End of inner exception stack trace ---
    at NServiceBus.Unicast.Queuing.Msmq.MsmqMessageSender.ThrowFailedToSendException(Address address, Exception ex)
    at NServiceBus.Unicast.Queuing.Msmq.MsmqMessageSender.NServiceBus.Unicast.Queuing.ISendMessages.Send(TransportMessage message, Address address)
    at NServiceBus.Unicast.UnicastBus.SendMessage(List`1 addresses, String correlationId, MessageIntentEnum messageIntent, Object[] messages)
    at NServiceBus.Unicast.UnicastBus.SendMessage(Address address, String correlationId, MessageIntentEnum messageIntent, Object[] messages)
    at NServiceBus.Unicast.UnicastBus.NServiceBus.IBus.Send(Address address, Object[] messages)
    at Our.Namespace.SomeMessageHandler.MethodName(EventLogVO eventLog, IApplicationContext applContext, CreateEventLogHistory message)

      

The queue on the target machine exists (double check). The weird thing is that it doesn't happen all the time and every message is sent to this queue, but it does sometimes happen (which means there are messages that arrive in this queue).

I searched and did not find a similar case.

What am I missing here?

+3


source to share


2 answers


We recently received this error and flagged it as one of the following:

  • Database performance. We had a long query that we set up, but the problem persists.
  • Large transaction area. You may be doing something that will involve too many resource managers.
  • MSMQ resources. Ultimately, our drive was not fast enough to complete the IO required for what we did with MSMQ.


I would try to track down the true source (hopefully you get some ideas from above). But if all else fails, first turn on System.Transactions logging to see if it's really a timeout. If so, use this section in app.config

+3


source


I had this happen to me in the handler which took a minute to complete, I ended up increasing the timeout by adding it to my app.config

<system.transactions>
  <defaultSettings timeout="00:05:00"/>
</system.transactions>

      

According to this: https://erictummers.wordpress.com/2014/05/28/cannot-enlist-the-transaction/



Also, I changed the machine configuration according to this post: http://blogs.msdn.com/b/ajit/archive/2008/06/18/override-the-system-transactions-default-timeout-of-10 -minutes-in-the-code.aspx

I also wrote a quick app that edits the machine.configs file: https://github.com/hfortegcmlp/MachineConfigEditor

+1


source







All Articles