Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Did

...

you

...

get

...

a

...

JCR

...

error?

...

Add

...

it

...

to

...

the

...

list

...

and

...

provide

...

a

...

resolution

...

if

...

you

...

find

...

one.

...

See

...

also

...

Repository

...

inconsistency

...

.

Symptom

Environment

Cause

Fix

Error when activating nodes:
can't version: update operation failed: failed to write bundle: 1533d777-02e0-4f33-95ab-057e424307bb

...

Mag

...

4.4.8

...

EE

...

Corrupt

...

versions?

...

?

ERROR info.magnolia.cms.core.DefaultContent:

...

Failed

...

to

...

get

...

handle:

...

2dae3093-fde6-488b-bd2f-34785e2c5820:

...

the

...

item

...

does

...

not

...

exist

...

anymore
javax.jcr.InvalidItemStateException:

...

2dae3093-fde6-488b-bd2f-34785e2c5820:

...

the

...

item

...

does

...

not

...

exist

...

anymore

...


at

...

org.apache.jackrabbit.core.ItemImpl.sanityCheck(ItemImpl.java:142)

...


at

...

org.apache.jackrabbit.core.ItemImpl.getPath(ItemImpl.java:1304)

...

Seen

...

on

...

Mag

...

4.4.6

...

CE

...

but

...

could

...

be

...

any

...

version

...

Corrupt

...

search

...

index

...

  1. stop

...

  1. Magnolia

...

  1. go

...

  1. inside

...

  1. your

...

  1. Magnolia

...

  1. web

...

  1. app

...

  1. to

...

  1. repositories/magnolia/workspaces

...

  1. to

...

  1. the

...

  1. workspace

...

  1. folder

...

  1. where

...

  1. you

...

  1. suspect

...

  1. the

...

  1. problem

...

  1. could

...

  1. be

...

  1. (e.g.

...

  1. "

...

  1. data

...

  1. ")

...

  1. delete

...

  1. the

...

  1. index

...

  1. folder

...

  1. in

...

  1. this

...

  1. workspace

...

  1. folder

...


  1. Note:

...

  1. Maybe

...

  1. it's

...

  1. a

...

  1. good

...

  1. idea

...

  1. to

...

  1. move

...

  1. the

...

  1. index

...

  1. folder

...

  1. away

...

  1. instead

...

  1. of

...

  1. deleting

...

  1. it.

...

  1. For

...

  1. some

...

  1. reasons

...

  1. sometimes

...

  1. the

...

  1. repository

...

  1. does

...

  1. not

...

  1. start

...

  1. up

...

  1. again

...

  1. if

...

  1. the

...

  1. index

...

  1. folder

...

  1. has

...

  1. been

...

  1. deleted

...

  1. (again

...

  1. with

...

  1. item

...

  1. does

...

  1. not

...

  1. exist

...

  1. errors).

...

  1. Any

...

  1. explanations

...

  1. for

...

  1. this

...

  1. behavior?

...

  1. startup

...

  1. again

...

Same

...

error

...

as

...

above

...

"

...

Index

...

is

...

fine,

...

but

...

repository

...

is

...

corrupt

...

Tried

...

configuring

...

the

...

persistence

...

manager

...

with

...

all

...

sorts

...

of

...

check

...

and

...

auto

...

repair

...

flags

...

(

...

...

,

...

...

,

...

...

,

...

...

),

...

but

...

nothing

...

helped.

...

Finally

...

I

...

wrote

...

the

...

Groovy

...

script

...

below

...

to

...

remove

...

corrupt

...

ChildNodeEntry records.

What can cause JCR Corruption?

If you have experienced JCR corruption, and can reliably identify the cause, list it here:

Cause

Description

Too many open files.

On linux systems, there is a limit on the number of concurrently open files. When using derby-DB, you have to set this limit high (4096 or more). If you run into the limit during operation, this can cause repo corruption.

OOM exceptions

If your JVM runs out of memory, you can get repository corruption.

JVM crashes

If your JVM segfaults, this can cause the repository to become corrupted, as it is not closed properly and write operations may be interrupted.

This can help other users avoid similar situations in their environment.

Groovy Script to remove invalid child node entries

A JCR node keeps a list of ChildNodeEntries in its State. When you get item does not exist anymore errors and it is not a broken index (see fix above) then chances are, that a node has a ChildNodeEntry with an invalid UUID. The following script walks trough a JCR tree checking the UUID of each ChildNodeEntry removing the ones pointing to nowhere. In order to use it you will need to

  • set the repository
  • and the path to the root know from where on down you would like to examine the tree.
  • Then uncomment the 4 lines once you are sure that it's doing the right thing. (You can let the script run with the two lines commented to see if invalid ChildNodeEntries are found)
Warning
titleUse at your own risk

Script is has been modified before placing it on this page and is therefore untested. Maybe a backup would be a good idea.

Info
titleDependency

Currently this script needs the MagnoliaTools installed. Can someone fix this by adding a method to get the current PersistanceManager without the help of external code?

Code Block
|http://jackrabbit.apache.org/api/1.6/org/apache/jackrabbit/core/state/ChildNodeEntry.html] records.|


h3. What can cause JCR Corruption?

If you have experienced JCR corruption, and can reliably identify the cause, list it here:
|| Cause\\ || Description\\ ||
| Too many open files.\\ | On linux systems, there is a limit on the number of concurrently open files. When using derby-DB, you have to set this limit high (4096 or more). If you run into the limit during operation, this can cause repo corruption. |
| OOM exceptions\\ | If your JVM runs out of memory, you can get repository corruption.\\ |
| JVM crashes\\ | If your JVM segfaults, this can cause the repository to become corrupted, as it is not closed properly and write operations may be interrupted.\\ |
This can help other users avoid similar situations in their environment.

h3. Groovy Script to remove invalid child node entries
A JCR node keeps a list of [ChildNodeEntries|http://jackrabbit.apache.org/api/1.6/org/apache/jackrabbit/core/state/ChildNodeEntry.html] in its [State|http://jackrabbit.apache.org/api/1.6/org/apache/jackrabbit/core/state/NodeState.html]. When you get {{item does not exist anymore}} errors and it is not a broken index (see fix above) then chances are, that a node has a ChildNodeEntry with an invalid UUID. The following script walks trough a JCR tree checking the UUID of each ChildNodeEntry removing the ones pointing to nowhere. In order to use it you will need to
* set the repository
* and the path to the root know from where on down you would like to examine the tree.
* Then uncomment the 4 lines once you are sure that it's doing the right thing. (You can let the script run with the two lines commented to see if invalid ChildNodeEntries are found)

{warning:title=Use at your own risk}
Script is has been modified before placing it on this page and is therefore _untested_. *Maybe a backup would be a good idea.*
{warning}
{info:title=Dependency}
Currently this script needs [the MagnoliaTools|http://documentation.magnolia-cms.com/modules/tools.html] installed. Can someone fix this by adding a method to get the current [PersistanceManager|http://jackrabbit.apache.org/api/1.6/org/apache/jackrabbit/core/persistence/PersistenceManager.html] without the help of external code?
{info}

{code}
import info.magnolia.context.*;
import info.magnolia.*;
import java.util.*;
import info.magnolia.tools.*;
import org.apache.jackrabbit.core.state.*;

// define the repository:
reponame = "data";
hm = MgnlContext.getSystemContext().getHierarchyManager(reponame);

// configure the root node either by uuid or by path:
//node = hm.getContentByUUID("root_node_uuid");
node = hm.getContent("/path/to/root/node");

jcrNode = node.getJCRNode();
// The PersistenceManagerUtil class is part of the MagnoliaTools. Maybe someone can extend the script so that we don't need the class?
pm = PersistenceManagerUtil.getPM(jcrNode);
checkNode(jcrNode,"");

def checkNode(jcrNode, prefix) {
  println(prefix + jcrNode.getName());
  state = pm.load(jcrNode.getNodeId());
  cl = new ChangeLog();
  childNodeEntries = state.getChildNodeEntries();
  for (childNodeEntry in childNodeEntries) {
    childnode = ContentUtil.getContentByUUID(reponame, childNodeEntry.getId().toString());
    if (childnode == null) {
      println("Subnode missing: " +childNodeEntry.getId().toString());
      // uncomment these lines if you want the corrupt child node entries to be deleted
/*      state.removeChildNodeEntry(childNodeEntry.getId());
      state.setStatus(ItemState.STATUS_STALE_MODIFIED);
      cl.modified(state);
      pm.store(cl);*/
    } else {
      // to visualize the hierarchy:
      checkNode(childnode.getJCRNode(),prefix+"....");
    }
  }
}
{code}