Skip to content
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

CacheErrorHandler doesn't work for Cacheable when sync=true for Redis #41702

Closed
adamcamp opened this issue Aug 6, 2024 · 1 comment
Closed
Labels
status: duplicate A duplicate of another issue

Comments

@adamcamp
Copy link

adamcamp commented Aug 6, 2024

When using the @Cacheable annotation with sync=true parameter, the exceptions are thrown without calling the CacheErrorHandler for underlying cache issues.

**Expected behavior: ** Below code prints "Test Passed" and exit code is 0, logging the connection failure to Redis.

**Actual behavior: ** Below code throws connection exception, never logs the message, and exit code is 1.

@SpringBootApplication
@EnableCaching
public class DemoApplication implements CachingConfigurer {

	@Override
	public CacheErrorHandler errorHandler() {
		return new LoggingCacheErrorHandler(true);
	}
	
	@Cacheable(value="test", sync=true)
	public String cacheTest(String test) {
		return test;
	}
	
	public static void main(String[] args) {
		ApplicationContext context = SpringApplication.run(DemoApplication.class, args);
		
		System.out.println(context.getBean(DemoApplication.class).cacheTest("Test Passed"));
	}
}

If we change the sync=true to sync=false then the code works as expected, but when sync=true it fails and never calls the error handler.

image

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 6, 2024
@mhalbritter
Copy link
Contributor

Duplicate of spring-projects/spring-framework#21590.

@mhalbritter mhalbritter closed this as not planned Won't fix, can't repro, duplicate, stale Aug 6, 2024
@mhalbritter mhalbritter added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants