Skip to content

Low level cache failure for sync/reactive/future Cacheable get is not handled by CacheErrorHandler #21590

Closed
@spring-projects-issues

Description

@spring-projects-issues

Jens Wilke opened SPR-17052 and commented

Code from CacheAspectSupport:

// Special handling of synchronized invocation
if (contexts.isSynchronized()) {
...
	try {
		return wrapCacheValue(method, cache.get(key, () -> {
			return unwrapReturnValue(invokeOperation(invoker));
		}));
	}
	catch (Cache.ValueRetrievalException ex) {
		// The invoker wraps any Throwable in a ThrowableWrapper instance so we
		// can just make sure that one bubbles up the stack.
		throw (CacheOperationInvoker.ThrowableWrapper) ex.getCause();
	}
}
  • In the code path for @Cachable(sync=true) CacheErrorHandler is not visited.
  • cast to (CacheOperationInvoker.ThrowableWrapper) is not totally sane, it could be omitted since then the unwrapping would happen in CacheInterceptor.invoke

Affects: 5.0.7

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions