Skip to content

Not configuring delayed delivery results in message being stuck and logs flooded when recoverability is executed #804

@andreasohlund

Description

@andreasohlund

Describe the bug

When delayed delivery is not configured (default is not configured) the endpoint will enter a tight loop logging an exception when a retry is attempted(retries are on by default) since delayed delivery is not available. This results in logs being flooded due to the message being retried constantly.

NOTE: The transport detects this and triggers a critical error which by default logs and keeps running

Expected behavior

Not sure yet

Actual behavior

Exception logged in a tight loop

Versions

Please list the version of the relevant packages or applications in which the bug exists.

  • All versions greater than v1.1

Steps to reproduce

https://github.com/antmeehan/NServiceBus-MSMQ-EndlessLogging/blob/master/Program.cs

Relevant log output

2025-01-31 10:23:59,892 [28] FATAL NServiceBus - Failed to execute recoverability policy for message with native ID: `fade6432-f177-4546-b67a-f9941bce78dc\-1672808665`
System.ArgumentNullException: Value cannot be null.
Parameter name: address
   at NServiceBus.Transport.Msmq.MsmqAddress.Parse(String address) in /_/src/NServiceBus.Transport.Msmq/MsmqAddress.cs:line 22
   at NServiceBus.Transport.Msmq.MsmqMessageDispatcher.SendToDelayedDeliveryQueue(TransportTransaction transaction, UnicastTransportOperation transportOperation) in /_/src/NServiceBus.Transport.Msmq/MsmqMessageDispatcher.cs:line 106
   at NServiceBus.Transport.Msmq.MsmqMessageDispatcher.Dispatch(TransportOperations outgoingMessages, TransportTransaction transaction, CancellationToken cancellationToken) in /_/src/NServiceBus.Transport.Msmq/MsmqMessageDispatcher.cs:line 38
   at (ArrayClosure , IDispatchContext )
   at NServiceBus.RoutingToDispatchConnector.Invoke(IRoutingContext context, Func`2 stage) in /_/src/NServiceBus.Core/Pipeline/Outgoing/RoutingToDispatchConnector.cs:line 51
   at NServiceBus.AttachSenderRelatedInfoOnMessageBehavior.Invoke(IRoutingContext context, Func`2 next) in /_/src/NServiceBus.Core/Pipeline/Outgoing/AttachSenderRelatedInfoOnMessageBehavior.cs:line 43
   at NServiceBus.RecoverabilityRoutingConnector.<Invoke>d__1.MoveNext() in /_/src/NServiceBus.Core/Recoverability/RecoverabilityRoutingConnector.cs:line 28
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NServiceBus.RecoverabilityPipelineExecutor`1.<Invoke>d__1.MoveNext() in /_/src/NServiceBus.Core/Recoverability/RecoverabilityPipelineExecutor.cs:line 54
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at NServiceBus.RecoverabilityPipelineExecutor`1.<Invoke>d__1.MoveNext() in /_/src/NServiceBus.Core/Recoverability/RecoverabilityPipelineExecutor.cs:line 54
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NServiceBus.Transport.Msmq.ReceiveStrategy.<HandleError>d__8.MoveNext() in /_/src/NServiceBus.Transport.Msmq/ReceiveStrategy.cs:line 121

Additional Information

Workarounds

  • Configure delayed delivery
  • Disable delayed retries

Possible solutions

  • Skip delayed retries when they are not available
  • Throw at startup to prevent the endpoint from starting in this configuration

Additional information

User report: https://discuss.particular.net/t/log-fills-up-when-recoverability-policy-fails/4223/2
Related to: #541

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions