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).
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.