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

ConcurrentReferenceHashMap does not enforce visibility of cached EntrySet [SPR-16994] #21532

spring-issuemaster opened this issue Jul 2, 2018 · 0 comments


Copy link

@spring-issuemaster spring-issuemaster commented Jul 2, 2018

Juergen Hoeller opened SPR-16994 and commented

ConcurrentReferenceHashMap.entrySet() tries to reuse a cached EntrySet instance but stores it in a regular field which doesn't guarantee visibility to other threads. Operating against a volatile field is the cleaner arrangement here.

Also, ConcurrentReferenceHashMap does not implement isEmpty(), relying on AbstractMap's computation of the full size. This can be optimized by simply backing out once a non-empty hash segment has been found.

Affects: 4.3.18, 5.0.7

Issue Links:

  • #16066 Memory leak in ConcurrentReferenceHashMap
  • #16342 ConcurrentReferenceHashMap doesn't limit upper concurrency level
  • #21126 Inconsistent handling of null values through Java 8 accessors in ConcurrentReferenceHashMap

Referenced from: commits 44b2657, ce0323f, 779cf8d

Backported to: 4.3.19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.