Skip to content

Incorrect handling of consecutive faulty items in chunk scanning #4370

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

Open
fmbenhassine opened this issue May 11, 2023 · 4 comments
Open

Incorrect handling of consecutive faulty items in chunk scanning #4370

fmbenhassine opened this issue May 11, 2023 · 4 comments
Labels
has: minimal-example Bug reports that provide a minimal complete reproducible example in: core related-to: fault-tolerance type: bug

Comments

@fmbenhassine
Copy link
Contributor

As of v5.0.1, the FaultTolerantChunkProcessor is unable to skip two consecutive faulty items when scanning chunks.

Here is a failing test (currently disabled in FaultTolerantChunkProcessorTests):

@Test
void testWriteRetryOnTwoExceptions() throws Exception {
	SimpleRetryPolicy retryPolicy = new SimpleRetryPolicy();
	retryPolicy.setMaxAttempts(2);
	batchRetryTemplate.setRetryPolicy(retryPolicy);
	processor.setWriteSkipPolicy(new AlwaysSkipItemSkipPolicy());
	processor.setItemWriter(new ItemWriter<String>() {
		@Override
		public void write(Chunk<? extends String> chunk) throws Exception {
			if (chunk.getItems().contains("fail")) {
				throw new IllegalArgumentException("Expected Exception!");
			}
		}
	});
	Chunk<String> inputs = new Chunk<>(Arrays.asList("3", "fail", "fail", "4"));
	Exception exception = assertThrows(RuntimeException.class, () -> processor.process(contribution, inputs));
	assertEquals("Expected Exception!", exception.getMessage());
	// first retry
	exception = assertThrows(RuntimeException.class, () -> processor.process(contribution, inputs));
	assertEquals("Expected Exception!", exception.getMessage());
	// retry exhausted, now scanning
	processor.process(contribution, inputs);
	// skip on this attempt
	exception = assertThrows(RuntimeException.class, () -> processor.process(contribution, inputs));
	assertEquals("Expected Exception!", exception.getMessage());
	// 2nd exception detected
	exception = assertThrows(RuntimeException.class, () -> processor.process(contribution, inputs));
	assertEquals("Expected Exception!", exception.getMessage());
	// still scanning
	processor.process(contribution, inputs);
	assertEquals(2, contribution.getSkipCount());
	assertEquals(2, contribution.getWriteCount());
	assertEquals(0, contribution.getFilterCount());
}

This test started failing after resolving #4314.

@fmbenhassine fmbenhassine added type: bug in: core has: minimal-example Bug reports that provide a minimal complete reproducible example related-to: fault-tolerance labels May 11, 2023
@fmbenhassine fmbenhassine changed the title Incorrect handling of two consecutive faulty items in chunk scanning Incorrect handling of consecutive faulty items in chunk scanning May 11, 2023
@mariusbreivik
Copy link

mariusbreivik commented Jul 31, 2023

@fmbenhassine what's the status on this issue?

@saugion
Copy link

saugion commented Jan 2, 2024

+1, I'm stuck with the same issue. Do you know any workaround? @fmbenhassine

@ozlemkaradeniz
Copy link

Hi, I am stuck with this problem, what is the current status of the issue? @fmbenhassine
Thanks

@fmbenhassine
Copy link
Contributor Author

The status of this issue is in standby. It will be fixed in the new implementation of the chunk-oriented processing model, see #3950.

#3950 is currently released as experimental, and should land as beta in the core framework in v6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has: minimal-example Bug reports that provide a minimal complete reproducible example in: core related-to: fault-tolerance type: bug
Projects
None yet
Development

No branches or pull requests

4 participants