Uploaded image for project: 'Hibernate ORM'
  1. HHH-7250

Bug in SharedCache handling of Natural-id

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects versions: 4.1.0, 4.1.2
    • Fix versions: 4.1.3
    • Components: hibernate-core
    • Environment:
      EHCache as shared cache implementation, using read-write strategy
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Suitable for new contributors:
      Yes, likely
    • Last commented by a user?:
      true
    • Sprint:

      Description

      Although configuring org.hibernate.cache.LookupNaturalId cache region large enough and eternal, I always have Warning messages like following:

      15:47:27,999  WARN AbstractReadWriteEhcacheAccessStrategy:182 - HHH020008: Cache[hibernate.test.org.hibernate.cache.LookupNaturalId] Key[P##NaturalId[ud1C9grNWA]] Lockable[(null)]
      A soft-locked cache entry was expired by the underlying Ehcache. If this happens regularly you should consider increasing the cache timeouts and/or capacity limits
      15:47:27,999  WARN AbstractReadWriteEhcacheAccessStrategy:182 - HHH020008: Cache[hibernate.test.org.hibernate.cache.LookupNaturalId] Key[P##NaturalId[ud1C9grNWA]] Lockable[Lock Source-UUID:9ea7be15-29d2-432f-ba0b-961392e0c995 Lock-ID:2]
      A soft-locked cache entry was expired by the underlying Ehcache. If this happens regularly you should consider increasing the cache timeouts and/or capacity limits
      

      Debugging into hibernate, I detected that strangely at certain point in StatefulPersistenceContext.java
      method RegionAccessStrategy#unlockRegion ist called, without ever calling lockRegion.
      This unlockRegion call (in EHCache it clears the entire region!) has no sense here,
      with evidency the removal of previousCacheKey item was intended here indeed.
      Please see the pullrequest, it makes the warnings above dissappear.

        Attachments

          Activity

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - Not Specified
                Not Specified
                Logged:
                Time Spent - 2m
                2m