Uploaded image for project: '[Read Only] - Hippo Repository'
  1. [Read Only] - Hippo Repository
  2. REPO-2143

Jackrabbit ItemNotFoundException thrown from NodeTypeManager.unregisterNodeType

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • jackrabbit-2.16.2-h2
    • 13.0.0, jackrabbit-2.16.2-h3
    • None
    • None

    Description

      While standard Jackrabbit doesn't support unregistration of NodeTypes, we added (internal) support for this within hippo-jackrabbit.

      However, the cache handling in the VirtualNodeTypeStateProvider (handling the state of the nodetypes under /jcr:system/jcr:nodeTypes) contains a bug which can lead to a ItemNotFoundException thrown (see REPO-2063):

      ERROR localhost-startStop-1 [VirtualNodeTypeStateManager.nodeTypesUnregistered:202] Unable to index removed nodetypes: [{http://www.onehippo.org/jcr/hipposys/nt/1.0}initializeitem]
      javax.jcr.ItemNotFoundException: null
      	at org.apache.jackrabbit.core.NodeImpl$1.perform(NodeImpl.java:1124) ~[jackrabbit-core-2.16.1-h2.jar:2.16.1-h2]
      	at org.apache.jackrabbit.core.NodeImpl$1.perform(NodeImpl.java:1111) ~[jackrabbit-core-2.16.1-h2.jar:2.16.1-h2]
      	at org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:216) ~[jackrabbit-core-2.16.1-h2.jar:2.16.1-h2]
      	at org.apache.jackrabbit.core.ItemImpl.perform(ItemImpl.java:91) ~[jackrabbit-core-2.16.1-h2.jar:2.16.1-h2]
      	at org.apache.jackrabbit.core.NodeImpl.getNode(NodeImpl.java:1111) ~[jackrabbit-core-2.16.1-h2.jar:2.16.1-h2]
      	at org.apache.jackrabbit.core.NodeImpl.getNode(NodeImpl.java:1095) ~[jackrabbit-core-2.16.1-h2.jar:2.16.1-h2]
      	at org.apache.jackrabbit.core.nodetype.virtual.VirtualNodeTypeStateManager.nodeTypesUnregistered(VirtualNodeTypeStateManager.java:190) [jackrabbit-core-2.16.1-h2.jar:2.16.1-h2]
      	at org.apache.jackrabbit.core.nodetype.NodeTypeRegistry.notifyUnregistered(NodeTypeRegistry.java:1875) [jackrabbit-core-2.16.1-h2.jar:2.16.1-h2]
      	at org.apache.jackrabbit.core.nodetype.NodeTypeRegistry.unregisterNodeTypes(NodeTypeRegistry.java:333) [jackrabbit-core-2.16.1-h2.jar:2.16.1-h2]
      	at org.apache.jackrabbit.core.nodetype.NodeTypeRegistry.unregisterNodeTypes(NodeTypeRegistry.java:278) [jackrabbit-core-2.16.1-h2.jar:2.16.1-h2]
      	at org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl.unregisterNodeTypes(NodeTypeManagerImpl.java:637) [jackrabbit-core-2.16.1-h2.jar:2.16.1-h2]
      	at org.apache.jackrabbit.spi.commons.nodetype.AbstractNodeTypeManager.unregisterNodeType(AbstractNodeTypeManager.java:125) [jackrabbit-spi-commons-2.16.1-h2.jar:?]

      This is caused by the node state cache maintained in the VirtualNodeTypeStateProvider which is cleared/discarded after every nodetype change.

      This cache is automaticall rebuild everytime the root state (for /jcr:system/jcr:nodeTypes) is accessed, but to do so it needs to read the current registered nodetypes in the NodeTypeRegistry.

      However, in case of unregistration of a nodetype, which first updates the NodeTypeRegistry and then notifies all listeners, which includes the VirtualNodeTypeStateManager,  an (notification) event must be raised for the removed nodetypes for which it tries to read its state from the VirtualNodeTypeStateProvider.

      So, if any nodetype change, which discards the cache, is immediately followed by a nodetype unregistration, without first rebuilding that cache, this will result in an ItemNotFoundException, as shown above.

      To fix this bug, the VirtualNodeTypeStateProvider calls to discardAll() always must immediately be followed by forced rebuilding the node state cache by calling getRootState().

      And this must be done there, because this code flow can also be triggered through external (cluster) event notifications on nodetype changes: a simplistic workaround by accessing the local root nodetypes node isn't sufficient for that reason. 

       

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              adouma Ate Douma (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: