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

Accidental cache evictions in PersistentEntitiesResourceMappings [DATAREST-1506] #1864

spring-projects-issues opened this issue Apr 8, 2020 · 1 comment
in: repository status: duplicate type: bug


Copy link

@spring-projects-issues spring-projects-issues commented Apr 8, 2020

alienisty opened DATAREST-1506 and commented

PersistentEntitiesResourceMappings uses a ConcurrentReferenceHashMap as a cache for mapped ResourceMetadata. Such map uses Soft references and therefore the can be garbage collected when under limited memory. Even if getMetadataFor() uses a lazy repopulation style, which is fine for such caches, the iterator() method, used by exportsTopLevelResourceFor() uses a copy of the cache, as it is, to select the candidates, but they might be gone because of garbage collection and the method doesn't try (and cannot) rebuild the information.
The cache field should just be a ConcurrentHashMap to avoid losing mapping at runtime, which they might initially work and then suddenly stop working, without any trace or exception

Affects: 3.2.6 (Moore SR6)

Issue Links:

  • DATAREST-1502 Use ConcurrentHashMap in PersistentEntitiesResourceMappings instead of ConcurrentReferenceHashMap
Copy link

@spring-projects-issues spring-projects-issues commented Apr 8, 2020

Oliver Drotbohm commented

Mark Paluch already fixed this in DATAREST-1502. Thanks for taking the time to report that though. Feel free to give the snapshots a try!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
in: repository status: duplicate type: bug
None yet

No branches or pull requests

2 participants