[FLUSS-2091][common] Introduced Cycle Detection During Exception Suppression #2112
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
Linked issue: close #2091
Per Issue #2091, this pull request attempts to address an issue that could result in a
StackOverflowErrorstemming from a cycle of cascading exceptions that originally stem from Flink'sSerializedThrowablehandler. This fix has already been made within Flink in this commit which should prevent the behavior (see discussion here for more context).Brief change log
This change introduces a new private functions within the
ExceptionUtilsclass to support exception chain evaluation for suppression and cause chains (existsInExceptionChain). This function is applied during thefirstOrSuppressedfunction call, which introduces a new exception to the existing chain, and traverses both the suppression and cause chains using a graph to evaluate for existence.Tests
The
ExceptionTestUtils.testFirstOrSuppressedCyclePreventionwas initially updated to use an arbitrary recursive exception call to mimic Flink's existingSerializedThrowableto reproduce the original issue (triggering aStackOverflowError). This test was later updated after the fix was applied to ensure that these previous exceptions no longer result in a cycle being created.API and Format
N/A
Documentation
N/A