Uploaded image for project: 'Spring Data REST'
  1. Spring Data REST
  2. DATAREST-1506

Accidental cache evictions in PersistentEntitiesResourceMappings

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 3.2.6 (Moore SR6)
    • Fix Version/s: 3.2.7 (Moore SR7)
    • Component/s: Repositories
    • Labels:
      None
    • Environment:
      Windows 10 with java 11

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              olivergierke Oliver Drotbohm
              Reporter:
              alienisty alienisty
              Last updater:
              Mark Paluch
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: