New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent unnecessary duplicated lines in backtraces #2780
Conversation
This commit removes the `i` counter that was effectively guaranteeing duplicated entries in the backtrace (eg. with a checkpoint) in the case where the triggering exception was reused. The only differentiator was then the indentation (driven by `i`). This is especially visible when using a `checkpoint(String)` operator along a `retry`. Provided the same exception instance is emitted on each retry loop, `checkpoint` will add to the backtrace on each loop. This commit removes the `i` from the tracking of existing backtraces and thus ensures that for the same parent subscriber, prefix and description there will be only one entry in the backtrace. Fixes #2774.
intriguing that this is related to:
.. its a useful clue to look in my code to see where i may be caching something that's unexpected! |
So I had a logic error in my code. I was retrying a As a pattern, this is bad, as retry won't ever succeed. The check against The current implementation failed by filling my disk with the repeated checkpoints. What if the check for the same exception instance was kept, but instead of appending to the message it modified the message to indicate that it was repeated? |
I've thought about that but that implies more complex logic for tracking. What's worse is that even simpler cases quickly become tricky to represent: for example, just creating 2 chains out of the same (erroring) source: Flux<String> source = Flux.error(new RuntimeException("shared"));
Flux<String> chain1 = source.map(s -> s.toLowerCase());
Flux<String> chain2 = source.filter(s -> s.isEmpty()); This confuses the backtrace production, which would display both Deep down, it's a matter of trying to represent a graph as a single sequence / line... 🤯 |
I wonder to what extent it makes sense to target 3.3.x with this one. it is a change in behavior after all. |
Note: The |
thank you @simonbasle
this is perfect. it removes the opportunity for accidental catastrophe while leaving hints |
I have devoted a bit more time to this, and ended up refactoring the "error has been observed" part of the traceback:
It looks like this:
(in the above we see 3 "roots", and 2 different sub-chains are better identified) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
todo:
outdated description: