In my application, I'm intercepting calls to EntityManager#createQuery and perform blocking operations in that interceptor. Due to the synchronized block, my virtual thread cannot dismount from the platform thread, therefore pinning it. Running with -Djdk.tracePinnedThreads=full produces stack traces that point to the snippet above:
Version: Spring Data JPA 3.3.0.
The method uses a
synchronized
block, causing thread pinning: https://github.com/spring-projects/spring-data-jpa/blob/23167429949292b203ad86f3c7da30f807c912b5/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/PartTreeJpaQuery.java#L300-L302In my application, I'm intercepting calls to
EntityManager#createQuery
and perform blocking operations in that interceptor. Due to thesynchronized
block, my virtual thread cannot dismount from the platform thread, therefore pinning it. Running with-Djdk.tracePinnedThreads=full
produces stack traces that point to the snippet above:Please consider replacing this (and other
synchronized
blocks/methods) withReentrantLock
to avoid thread pinning.