1 Reply Latest reply on May 10, 2017 7:03 AM by prinzs

    ReferentialIntegrityException when trying to delete versions of nodes

    prinzs

      Hi,

       

      we are trying to delete all versions (except root and base) from all nodes in our repository. The following exception is thrown for many versions (every other version):

       

      ERROR: An error occured while trying to delete the version 1.11! Continuing with next node...

      javax.jcr.ReferentialIntegrityException: Cannot remove some nodes because they are still strongly referred by existing nodes: {/{http://www.jcp.org/jcr/1.0}system/{http://www.jcp.org/jcr/1.0}versionStorage/{}43/{}e5/{}d9/{}43e5d989d89d6b2306db52a52e3da0d0c3433f55/{}1.11=[/{http://www.jcp.org/jcr/1.0}system/{http://www.jcp.org/jcr/1.0}versionStorage/{}43/{}e5/{}d9/{}43e5d989d89d6b2306db52a52e3da0d0c3433f55/{}1.13, /{http://www.jcp.org/jcr/1.0}system/{http://www.jcp.org/jcr/1.0}versionStorage/{}43/{}e5/{}d9/{}43e5d989d89d6b2306db52a52e3da0d0c3433f55/{}1.9]}

          at org.modeshape.jcr.JcrVersionHistoryNode.removeVersion(JcrVersionHistoryNode.java:264)

          at org.modeshape.jcr.JcrVersionHistoryNode.removeVersion(JcrVersionHistoryNode.java:182)

          at de.company.tools.command.DeleteVersionsOfAllNodesCommand.doExecute(DeleteVersionsOfAllNodesCommand.java:92)

          at org.apache.karaf.shell.console.AbstractAction.execute(AbstractAction.java:34)

          at org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:41)

          at org.apache.karaf.shell.commands.basic.AbstractCommand.execute(AbstractCommand.java:34)

          at org.apache.karaf.shell.compat.CommandTracker$1.execute(CommandTracker.java:112)

          at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:67)

          at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:87)

          at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:480)

          at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:406)

          at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)

          at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:182)

          at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:119)

          at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:94)

          at org.apache.karaf.shell.impl.console.ConsoleSessionImpl.run(ConsoleSessionImpl.java:270)

          at java.lang.Thread.run(Thread.java:745)

       

      Some versions of a node seem to have strong references on some other versions of the same node and modeshape can't cope with these references.

      We tried to debug modeshape and we think it is a bug which occures somewhere in WriteableSessionCache.persistChanges . Unfortunately we can not find the cause of this because the method is huge and rather complex.

      Also, we can't provide an example as we can not reliably reproduce the problem.

       

      We are on ModeShape 4.6.0 and checked if there has been a bugfix in newer versions but we could not find something. Did we miss something? Have you seen this error before and could give us some hints?

       

      Thanks,

      Simon