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

Blocking call detected in ConcurrentReferenceHashMap by BlockHound #33450

Closed
micopiira opened this issue Aug 30, 2024 · 1 comment
Closed

Blocking call detected in ConcurrentReferenceHashMap by BlockHound #33450

micopiira opened this issue Aug 30, 2024 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@micopiira
Copy link
Contributor

Affects: 6.1.11

BlockHound seems to detect a blocking call in ConcurrentReferenceHashMap, relevant lines from stacktrace:

reactor.blockhound.BlockingOperationError: Blocking call! jdk.internal.misc.Unsafe#park
    at java.base/jdk.internal.misc.Unsafe.park(Unsafe.java) ~[?:?]
    at java.base/java.util.concurrent.locks.LockSupport.park(LockSupport.java:221) ~[?:?]
    at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:754) ~[?:?]
    at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:990) ~[?:?]
    at java.base/java.util.concurrent.locks.ReentrantLock$Sync.lock(ReentrantLock.java:153) ~[?:?]
    at java.base/java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:322) ~[?:?]
    at java.base/java.lang.ref.ReferenceQueue.poll(ReferenceQueue.java:182) ~[?:?]
    at org.springframework.util.ConcurrentReferenceHashMap$ReferenceManager.pollForPurge(ConcurrentReferenceHashMap.java:1025) ~[spring-core-6.1.11.jar:6.1.11]
    at org.springframework.util.ConcurrentReferenceHashMap$Segment.restructureIfNecessary(ConcurrentReferenceHashMap.java:575) ~[spring-core-6.1.11.jar:6.1.11]
    at org.springframework.util.ConcurrentReferenceHashMap$Segment.getReference(ConcurrentReferenceHashMap.java:496) ~[spring-core-6.1.11.jar:6.1.11]
    at org.springframework.util.ConcurrentReferenceHashMap.getReference(ConcurrentReferenceHashMap.java:266) ~[spring-core-6.1.11.jar:6.1.11]
    at org.springframework.util.ConcurrentReferenceHashMap.get(ConcurrentReferenceHashMap.java:236) ~[spring-core-6.1.11.jar:6.1.11]
    at java.base/java.util.concurrent.ConcurrentMap.computeIfAbsent(ConcurrentMap.java:329) ~[?:?]
    at org.springframework.data.mapping.callback.DefaultReactiveEntityCallbacks.callback(DefaultReactiveEntityCallbacks.java:73) ~[spring-data-commons-3.3.2.jar:3.3.2]

Maybe the ConcurrentReferenceHashMap$Segment#restructureIfNecessary or ConcurrentReferenceHashMap$ReferenceManager#pollForPurge just needs to be whitelisted in SpringCoreBlockHoundIntegration?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Aug 30, 2024
@jhoeller jhoeller added the in: core Issues in core modules (aop, beans, core, context, expression) label Aug 31, 2024
@simonbasle simonbasle self-assigned this Sep 16, 2024
@simonbasle simonbasle added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Sep 16, 2024
@simonbasle simonbasle added this to the 6.2.0-RC2 milestone Sep 16, 2024
@simonbasle
Copy link
Contributor

I think we can indeed add pollForPurge in the allow-list. I was however unable to produce a unit test that makes BlockHound fail on that particular method. Do you happen to have a reproducible case by any chance ?

@simonbasle simonbasle modified the milestones: 6.2.0-RC2, 6.1.14 Sep 17, 2024
simonbasle added a commit that referenced this issue Sep 17, 2024
This commit adds more test coverage of SpringCoreBlockHoundIntegration.

See gh-33450
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants