Affects: \<5.1.3.RELEASE> java version : 1.8.0_261


https://bugs.openjdk.java.net/browse/JDK-8062841 ConcurrentHashMap.computeIfAbsent stuck in an endless loop 1. enabled cache @EnableCaching 2. use sync = true @Cacheable(value = "xxx" , sync =true) 3. trigger bug at org.springframework.cache.interceptor.CacheAspectSupport start with: 381 line code : return wrapCacheValue(method, cache.get(key, () -> unwrapReturnValue(invokeOperation(invoker)))); 4. stuck in an endless loop 560ef7318901bfe1194e708770be75b

Comment From: snicoll

@250846434 looking at the issue report, I don't really understand why you believe this is a bug in the Spring cache abstraction. Can you expand what you're expecting from this report exactly?

Have you confirmed this is that issue for a start (i.e. upgrading to a more recent JDK changes the outcome of that call).

Comment From: 250846434

@snicoll i see the java 11 source code. the ConcurrentHashMap throw a IllegalStateException . so,i think this bug exist in spring cache. b22ff863fae01686991c1c22261e2d0

Comment From: snicoll

What bug would that be exactly? If you have recursive @Cacheable calls with synchronization enabled, this is bound to happen. Can you share a sample project that reproduces the problem? You can do so by attaching a zip to this issue or sharing the link to a github repository.

Comment From: 250846434

@snicoll I changed my Java version to Java11,this bug still exists. but is not a infinite loop. It throw a IllegalStateException. 551a0cd9980a4cbd2918fa88e4b0eb9

Comment From: snicoll

I got you. The fix in the JDK is to prevent such use case rather than blocking. Can you share the sample that I've requested?

Comment From: 250846434

@snicoll I later set up a test project to try to reproduce the problem and submit it to Github

Comment From: 250846434

I'm sorry. The problem is really not a Spring Cache problem. I found the problem.Because AOP proxys twice. so CacheInterceptor invoke twice.

Comment From: snicoll

Thanks for letting us know.