2 Replies Latest reply on Sep 20, 2016 10:26 AM by amischler

    [Modeshape 4.6.0.Final] System node corruption after application crash

    amischler

      Hi,

       

      We are using Modeshape as an embedded database for a desktop application. Our application is configured with a file based Infinispan cache.

       

      Regularly some databases get corrupted after an application crash. Modeshape is still able to read the Infinispan cache, but in most cases the system node is corrupted or inconsistent. We are able to fix the databases by forcing Modeshape to create a backup of this repository and then we manually edit the generated bin file to restore the missing system nodes (usually the { "id" : "e03bade317f1e7mode:namespaces" } node or other system nodes). The rest of the database seems to be fine.

       

      Do you know how this issue might happen and how we could prevent this situation to happen when the application crashes ?

       

      We use Modeshape 4.6.0.Final and the following configuration :

       

      modeshape.json

       

      {

        "name": "dsdk-repository",
        "workspaces": {

         "default": "default",
         "allowCreation": true
        },
        "security": {

         "anonymous": {

         "roles": [

         "readonly",
         "readwrite",
         "admin"
         ],
         "useOnFailedLogin": false
         }

        },
        "storage": {

         "cacheConfiguration": "infinispan-configuration.xml",
         "cacheName": "persisted-repository",
         "binaryStorage": {

         "type": "file",
         "directory": "${application.workspace}/binaries",
         "minimumBinarySizeInBytes": 999
         }

        },
        "node-types": [

         "cnd/dsdk.cnd"
        ],
        "indexProviders": {

         "local": {

         "classname": "org.modeshape.jcr.index.local.LocalIndexProvider",
         "directory": "${application.workspace}/indexes"
         }

        },
        "indexes": {

         "smartTextKeys": {

         "kind": "value",
         "provider": "local",
         "synchronous": "true",
         "nodeType": "dsdk:smarttext",
         "columns": "smartTextKey(STRING)"
         },
         "nodesByName": {

         "kind": "value",
         "provider": "local",
         "synchronous": "true",
         "nodeType": "nt:base",
         "columns": "name(STRING)"
         },
         "nodeTypes": {

         "kind": "nodeType",
         "provider": "local",
         "synchronous": "true",
         "nodeType": "nt:base",
         "columns": "jcr:primaryType(STRING)"
         },
         "nodesByPath": {

         "kind": "value",
         "provider": "local",
         "synchronous": "true",
         "nodeType": "nt:base",
         "columns": "jcr:path(PATH)"
         },
         "deletedNodes": {

         "kind": "nodeType",
         "provider": "local",
         "synchronous": "true",
         "nodeType": "mix:deleted",
         "columns": "jcr:mixinTypes(STRING)"
         }

        },
        "sequencing": {

         "sequencers": {

         "JPEG optimization sequencer": {

         "classname": "com.dooapp.dsdk.core.ui.document.optim.JpegOptimSequencer"
         },
         "Image resizer sequencer": {

         "classname": "com.dooapp.dsdk.core.ui.document.optim.ImageResizerSequencer"
         }

        }

        }

      }

       

      infinispan-configuration.xml

       

      <?xml version="1.0" encoding="UTF-8"?>
      <infinispan xmlns="urn:infinispan:config:7.2">

        <cache-container default-cache="persisted-repository" shutdown-hook="REGISTER">
        <jmx duplicate-domains="true"></jmx>
        <local-cache name="persisted-repository">
        <transaction transaction-manager-lookup="org.infinispan.transaction.lookup.GenericTransactionManagerLookup"
         mode="NON_XA"
         locking="PESSIMISTIC"/>
        <persistence passivation="false">
        <file-store shared="false"
         preload="false"
         fetch-state="false"
         purge="false"
         path="${application.workspace}/content">
        </file-store>

        </persistence>
        </local-cache>

        </cache-container>

      </infinispan>

       

      Thanks for your help!

        • 1. Re: [Modeshape 4.6.0.Final] System node corruption after application crash
          hchiorean

          This is highly dependent on your local code and application logic; it's not something which can be "investigated" out of context. So you have to investigate this locally and try to trace the reason for the data corruption.

           

          There have been numerous issues throughout time related to ISPN, transactions and data corruption, which is one of the reasons that ModeShape 5 moved away from Infinispan.

          • 2. Re: [Modeshape 4.6.0.Final] System node corruption after application crash
            amischler

            I understand that it is dependent on the application logic. Which surprised me is that only the jcr system graph get corrupted although we don't manipulate those nodes in the application logic (and I think that Modeshape does not allow to modify those node directly). So I hopped that there where some kinds of general advices / best practices to prevent these cases. It looks like that an upgrade to Modeshape 5 is required in our case.