ConcurrentHashMap.computeIfAbsent used in AdvisedSupport can cause virtual thread pinning #32958
Closed
Description
When running Spring Boot application with -Djdk.tracePinnedThreads=full
, this log message appears in the logs:
VirtualThread[#218,backgroundjob-worker]/runnable@ForkJoinPool-1-worker-11 reason:MONITOR
java.base/java.lang.VirtualThread$VThreadContinuation.onPinned(Unknown Source)
java.base/jdk.internal.vm.Continuation.onPinned0(Unknown Source)
java.base/java.lang.VirtualThread.park(Unknown Source)
...
java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(Unknown Source) <== monitors:1
org.springframework.aop.framework.AdvisedSupport.getInterceptorsAndDynamicInterceptionAdvice(AdvisedSupport.java:503)
synchronized
usage in ConcurrentHashMap
seems to be a known problem, but still not solved.
Would it be possible to avoid usage of ConcurrentHashMap
in org.springframework.aop.framework.AdvisedSupport.java:503
and use something like HashMap
and ReadWriteLock
instead?