Endpoint in endless loop when stacktrace is too long
When we try to handle a message which contains a lot of errors and we throw an exception with a too long message and stacktrace the endpoint is coming in an endless loop, because endpoint tries to move the message to the error queue (with all (too large) headers). Azure Service Bus gives an AMQP 37 error which is mapped to an Unknown error, and then the NServiceBus does an endless retry.
NServiceBus protects itself against too long exception messages, but the same thing also can happen with a stacktrace.
headers["NServiceBus.ExceptionInfo.Message"] = e.GetMessage().Truncate(16384);
headers["NServiceBus.ExceptionInfo.StackTrace"] = e.ToString();
I think the same truncate must be done with the stacktrace, and maybe we can better use e.StackTrace
@JSCProjects Have you taken a look at the Stack Trace Cleaning sample in our docs? There is an example in it that shows how to reduce the size of the header text and replace the header value with that reduced text. https://docs.particular.net/samples/logging/stack-trace-cleaning/#manipulate-error-queue-header
@dbelcham @SeanFeldman We are seeing this currently. Can I get an updated link to replace the broken one? Thanks!
Hey @bbrandt, this PR removed the sample. Perhaps some bits and pieces could be helpful.