Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-2190

Lock Garage Collection can cause NPE as locks are removed by sessions



      I am utilizing locks in my application code, however I am not explicitly unlocking them. It is my understanding that if the locks are session scoped they will expire when Session.logout is explicitly called. However, every five minutes the following NullPointerException is logged during a scheduled LockGarbageCollectionTask (see attached stack trace).

      Randall Hauch said in the discussion thread:

      From the stack trace, it looks like the CachedNode instance held in the 'locks' variable on line 817 of SystemContent is actually null and thus causing the NullPointerException. Since the key (identifier) for this node was obtained as being one of the children of the "/jcr:system/mode:locks" parent node, my guess is that some concurrent operations are removing locks that otherwise attempt to get cleaned up in this LockGarbageCollectionTask. Essentially, a lock is removed after the set of children (e.g., locks) has been obtained but before all locks have been processed.

      The second stack trace (see attached) occurs when attempting to view the locks under "/jcr:system/mode:locks".

      Again, Randall Hauch said:

      As for your latest exception, I think this is caused by the same situation as your original problem: the underlying node is being removed from the repository while the iterator is in the middle of iterating over the children of the parent node.

        Gliffy Diagrams




              • Assignee:
                hchiorean Horia Chiorean
                mashama Mashama McFarlane
              • Votes:
                0 Vote for this issue
                3 Start watching this issue


                • Created: