Skip to content

Record doesn't get to DLT with FATAL exception and single-topic strategy #2118

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

Closed
tomazfernandes opened this issue Feb 18, 2022 · 1 comment · Fixed by #2122
Closed

Record doesn't get to DLT with FATAL exception and single-topic strategy #2118

tomazfernandes opened this issue Feb 18, 2022 · 1 comment · Fixed by #2122

Comments

@tomazfernandes
Copy link
Contributor

tomazfernandes commented Feb 18, 2022

Currently if we throw a FATAL exception as per DLPR classification and we're using single topic strategy for fixed-delay non-blocking retries, the record doesn't get to the DLT.

To reproduce the issue, change the first listener in RetryTopicIntegrationTests to throw a ConversionException instead of the RuntimeException, the test will fail because the dlt countdown latch is never triggered.

This logic was introduced in DLPR to stop infinite loops for FATAL exceptions in DLT processing:

if (tp.topic().equals(record.topic()) && !getClassifier().classify(exception)) {
			this.logger.error("Recovery of " + ListenerUtils.recordToString(record, true)
					+ " skipped because not retryable exception " + exception.toString()
					+ " and the destination resolver routed back to the same topic");
			return;
		}

My suggestion is to have the FATAL classification in the DefaultDestinationTopicResolver, by having it extend the ExceptionClassifier class, and stop forwarding the record there, where we can know for sure we're in a DLT.

Also add a flag to DLPR to toggle the current behavior and set it to false in RetryableTopic's logic.

This solution should also address #2113, and open the way for us to solve #2116.

I'm already working on this and should have a PR open soon, if that's ok.

Let me know if you have any concerns or anything I might be missing.

Thanks

@garyrussell
Copy link
Contributor

@tomazfernandes Thanks; I am off work until Tuesday, so we might not be able to get these changes into Tuesday's releases, unless it's a relatively small PR.

tomazfernandes added a commit to tomazfernandes/spring-kafka that referenced this issue Feb 20, 2022
Fixes spring-projectsGH-2118

The logic introduced to stop endless loops in DLR processing for fatal exceptions interferes with RT's single-topic strategy.
Make it optional and set the default to false in DLPRF for RT.
The loop is now addressed in DefaultDestinationTopicResolver as in spring-projectsGH-2113.
tomazfernandes added a commit to tomazfernandes/spring-kafka that referenced this issue Feb 20, 2022
Resolves spring-projectsGH-2113

Adds exception classification to DefaultDestinationTopicResolver so that fatal exceptions makes records go straight to the DLT.
Also stop DLT processing if such an exception is found (see spring-projectsGH-2118).
garyrussell pushed a commit that referenced this issue Feb 21, 2022
Resolves GH-2113

Adds exception classification to DefaultDestinationTopicResolver so that fatal exceptions makes records go straight to the DLT.
Also stop DLT processing if such an exception is found (see GH-2118).
garyrussell pushed a commit that referenced this issue Feb 21, 2022
Fixes GH-2118

The logic introduced to stop endless loops in DLR processing for fatal exceptions interferes with RT's single-topic strategy.
Make it optional and set the default to false in DLPRF for RT.
The loop is now addressed in DefaultDestinationTopicResolver as in GH-2113.
garyrussell pushed a commit that referenced this issue Feb 21, 2022
Resolves GH-2113

Adds exception classification to DefaultDestinationTopicResolver so that fatal exceptions makes records go straight to the DLT.
Also stop DLT processing if such an exception is found (see GH-2118).
garyrussell pushed a commit that referenced this issue Feb 21, 2022
Fixes GH-2118

The logic introduced to stop endless loops in DLR processing for fatal exceptions interferes with RT's single-topic strategy.
Make it optional and set the default to false in DLPRF for RT.
The loop is now addressed in DefaultDestinationTopicResolver as in GH-2113.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants