Search code examples
msmqrebuspoison-queue

Move to Rebus error queue not triggered after maximum abort failures


The default Rebus configuration, according to the error handling wiki, should move a poison message to the error queue. It is not happening in a situation where a third party component is causing a stackoverflow exception. The underlying queue is msmq, so the poison message abort counter is incremented.

Is this behavior because the application exception/exit is causing Rebus to lose its tracking? Either using in-memory counting for failed messages or exit before accounting for the message.


Solution

  • Sorry, but the reason Rebus does not track the error in this case, is becase it's generally not possible to catch StackOverflowException in C#(*)

    You're out of luck here, sorry. 😐 Tell whoever made that 3rd party component to fix their recursion. 😁


    (*) It's only possible if the CLR is running with some specific flag set to true AND if the StackOverflowException was thrown "manually". If the exception is from the runtime due to an actual stack overflow, then it's impossible to catch.