Message failed at endpointQueue.Timeouts queue

Hello,

facing one issue , below i have mentioned scenario for same.

NSB version : 5.2.14 , SQL Transport

Scenario :

  1. Message failed first 3 attempt to endpointQueue, message moved to endpointQueue.Timeouts for Second level retry.

2019-11-13 01:21:06.9957 Warn NServiceBus.Faults.Forwarder.FaultManager Message with ‘3842CAC4-B9A0-8223-0DCC-509A6F75849B’ id has failed FLR and will be handed over to SLR for retry attempt 1.

  1. It failed in endpointQueue.Timeouts queue with below message & dint try for Second level retry

2019-11-13 01:21:07.1643 Info NServiceBus.Unicast.Transport.TransportReceiver Failed to process message
NHibernate.StaleStateException: Batch update returned unexpected row count from update; actual row count: -1; expected: 1
at NHibernate.AdoNet.Expectations.VerifyOutcomeBatched(Int32 expectedRowCount, Int32 rowCount)
at NHibernate.AdoNet.SqlClientBatchingBatcher.DoExecuteBatch(IDbCommand ps)
at NHibernate.AdoNet.AbstractBatcher.ExecuteBatchWithTiming(IDbCommand ps)
at NHibernate.AdoNet.AbstractBatcher.ExecuteBatch()
at NHibernate.Engine.ActionQueue.ExecuteActions()
at NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session)
at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)
at NHibernate.Impl.SessionImpl.Flush()
at NServiceBus.Persistence.NHibernate.AmbientTransactionAwareWrapper.Commit() in C:\BuildAgent\work\5135de308b2f3016\src\NServiceBus.NHibernate\Internal\AmbientTransactionAwareWrapper.cs:line 49
at NServiceBus.TimeoutPersisters.NHibernate.TimeoutPersister.StoreTimeoutEntity(TimeoutData timeout, IDbConnection connection, Guid timeoutId) in C:\BuildAgent\work\5135de308b2f3016\src\NServiceBus.NHibernate\TimeoutPersisters\TimeoutPersister.cs:line 128
at NServiceBus.TimeoutPersisters.NHibernate.TimeoutPersister.Add(TimeoutData timeout) in C:\BuildAgent\work\5135de308b2f3016\src\NServiceBus.NHibernate\TimeoutPersisters\TimeoutPersister.cs:line 98
at NServiceBus.Timeout.Core.DefaultTimeoutManager.PushTimeout(TimeoutData timeout) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Timeout\Core\DefaultTimeoutManager.cs:line 26
at NServiceBus.Timeout.Hosting.Windows.TimeoutMessageProcessor.HandleInternal(TransportMessage message) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Timeout\Hosting\Windows\TimeoutMessageProcessor.cs:line 134
at NServiceBus.Timeout.Hosting.Windows.TimeoutMessageProcessor.Handle(TransportMessage message) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Timeout\Hosting\Windows\TimeoutMessageProcessor.cs:line 60
at NServiceBus.Satellites.SatelliteLauncher.HandleMessageReceived(Object sender, TransportMessageReceivedEventArgs e, ISatellite satellite) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Satellites\SatelliteLauncher.cs:line 89
at NServiceBus.Unicast.Transport.TransportReceiver.OnTransportMessageReceived(TransportMessage msg) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Unicast\Transport\TransportReceiver.cs:line 413
at NServiceBus.Unicast.Transport.TransportReceiver.ProcessMessage(TransportMessage message) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Unicast\Transport\TransportReceiver.cs:line 344
at NServiceBus.Unicast.Transport.TransportReceiver.TryProcess(TransportMessage message) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Unicast\Transport\TransportReceiver.cs:line 230
at NServiceBus.Transports.SQLServer.AmbientTransactionReceiveStrategy.TryReceiveFrom(TableBasedQueue queue) in C:\BuildAgent\work\888dd942b44bad5a\src\NServiceBus.SqlServer\AmbientTransactionReceiveStrategy.cs:line 57

can see post on similar error at NHibernate.StaleStateException: Batch update returned unexpected row count from update; actual row count: -1; expected: 1

NOCOUNT set to OFF , still getting this error

It’s clear that NOCOUNT is still ON. Did you really set it to OFF at the Server?

Alternatively, you can use a custom connection factory as mentioned here:

Also, you are running an older versions, I advise you to upgrade to at least:

I didn’t notice earlier that you are using SQL transport. You should be able to set a custom connection factory there for the SQL transport:

Thank you, provided solution has resolved the problem.

https://docs.particular.net/transports/sql/connection-settings?version=sqltransport_2#custom-sql-server-transport-connection-factory