OpenJPA
  1. OpenJPA
  2. OPENJPA-1467

java.lang.IllegalMonitorStateException in ConcurrentDataCache.writeUnlock()

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-M1, 2.0.0-M2, 2.0.0-M3
    • Fix Version/s: 2.0.0-beta
    • Component/s: datacache
    • Labels:
      None

      Description

      I encountered the following exception when doing some load testing:
      Caused by: java.lang.IllegalMonitorStateException
      at java.util.concurrent.locks.ReentrantLock$Sync.tryRelease(ReentrantLock.java:139)
      at java.util.concurrent.locks.AbstractQueuedSynchronizer.release(AbstractQueuedSynchronizer.java:1187)
      at java.util.concurrent.locks.ReentrantLock.unlock(ReentrantLock.java:443)
      at org.apache.openjpa.util.CacheMap.writeUnlock(CacheMap.java:203)
      at org.apache.openjpa.datacache.ConcurrentDataCache.writeUnlock(ConcurrentDataCache.java:108)
      at org.apache.openjpa.datacache.DataCacheStoreManager.cacheStateManager(DataCacheStoreManager.java:382)
      at org.apache.openjpa.datacache.DataCacheStoreManager.initialize(DataCacheStoreManager.java:353)
      at org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:111)
      at org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57)
      at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:998)
      at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:956)
      ... 43 more

      At first glance it seemed impossible that this exception was happening... Everywhere that CacheMap.writeUnlock() is called there is a corresponding CacheMap.writeLock() prior to that call.

      I discovered that the bug is in org.apache.openjpa.datacache.ConcurrentDataCache.removeAllInternal(Class<?> cls, boolean subs). The problem is that this method modifies the underlying cache, but doesn't obtain a writeLock first.

        Activity

        Rick Curtis created issue -
        Rick Curtis made changes -
        Field Original Value New Value
        Summary java.lang.IllegalMonitorStateException in CacheMap.writeUnlock() java.lang.IllegalMonitorStateException in ConcurrentDataCache.writeUnlock()
        Hide
        Rick Curtis added a comment -

        Reverted ConcurrentDataCache.removeAllInternal(...) back to an earlier revision to make it functionally correct. There are still some perf issues, but those will be addressed by another JIRA.

        Show
        Rick Curtis added a comment - Reverted ConcurrentDataCache.removeAllInternal(...) back to an earlier revision to make it functionally correct. There are still some perf issues, but those will be addressed by another JIRA.
        Rick Curtis made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.0.0 [ 12314019 ]
        Resolution Fixed [ 1 ]
        Rick Curtis made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Donald Woods made changes -
        Fix Version/s 2.0.0-beta2 [ 12314802 ]
        Fix Version/s 2.0.0 [ 12314019 ]
        Affects Version/s 2.0.0 [ 12314019 ]
        Donald Woods made changes -
        Fix Version/s 2.0.0-beta [ 12314149 ]
        Fix Version/s 2.0.0-beta2 [ 12314802 ]
        Affects Version/s 2.0.0-beta [ 12314149 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        8m 18s 1 Rick Curtis 18/Jan/10 19:34
        Resolved Resolved Closed Closed
        5s 1 Rick Curtis 18/Jan/10 19:35

          People

          • Assignee:
            Rick Curtis
            Reporter:
            Rick Curtis
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development