You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Martijn Hendriks (JIRA)" <ji...@apache.org> on 2009/06/06 20:54:07 UTC
[jira] Created: (JCR-2129) Prevent data inconsistencies due to
missed merges in the SharedItemStateManager
Prevent data inconsistencies due to missed merges in the SharedItemStateManager
-------------------------------------------------------------------------------
Key: JCR-2129
URL: https://issues.apache.org/jira/browse/JCR-2129
Project: Jackrabbit Content Repository
Issue Type: Bug
Components: jackrabbit-core
Affects Versions: core 1.4.5, 2.0.0
Reporter: Martijn Hendriks
Priority: Critical
The SharedItemStateManager.Update class's begin method tests whether states in the given local ChangeLog are stale. If so, it tries to merge the changes to the new persisted state. It does this by comparing the modCount of state instances for non-transient states. There is a race between two threads that call save such that sometimes this test fails and states are not merged when they should be. As a result, the data in the repository can become corrupt and, for instance, it becomes impossible to start Jackrabbit or remove certain nodes.
Analysis: persisted state information, including modCount, is pushed down from another thread while a local ChangeLog is being constructed. The increased modCount thus appears in the local ChangeLog and the SharedISM falsely assumes that the state in the local ChangeLog needs no merging (isStale test).
Reproduction:
The attached test program contains steps to reproduce the issue (see comments of the testInconsistency1 and testInconsistency2 methods).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (JCR-2129) Prevent data inconsistencies due to
incorrect or missed merges in the ItemStateManagers
Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2129?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12724053#action_12724053 ]
Marcel Reutegger commented on JCR-2129:
---------------------------------------
I'd like to extend the test cases to cover more cases including any combination of add/remove node by one session and move node to/from by another session.
I'll post an updated patch when it is ready....
> Prevent data inconsistencies due to incorrect or missed merges in the ItemStateManagers
> ---------------------------------------------------------------------------------------
>
> Key: JCR-2129
> URL: https://issues.apache.org/jira/browse/JCR-2129
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core
> Affects Versions: core 1.4.5, 2.0.0
> Reporter: Martijn Hendriks
> Assignee: Martijn Hendriks
> Priority: Critical
> Attachments: InconsistencyTest.java, JCR-2129-testcase.patch, JCR-2129.patch, repository.xml
>
>
> There are two places where transient state changes are merged with persisted state: (i) in the SessionISM.stateModified call back method (typically called by a saving thread after it's changes have been saved) and (ii) in the SharedISM.Update.begin method. Sometimes the merge strategy fails in the sense that corrupt data is written to database.
> How to reproduce:
> The attached test program contains steps to reproduce the issue. The testInconsistency1 method concurrently adds a node D to a node A and moves child node B of A to another place. This sometimes results in a situation in which node A still has a child reference to node B whereas B has another parent. In this situation, Jackrabbit cannot be started anymore if the search index is missing:
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.query.OnWorkspaceInconsistency$1 handleMissingChildNode
> SEVERE: Node /A (a7a29e8c-8d13-4fbd-b0ca-4f93f9c0ef42) has missing child 'B' (80aa13c5-1db6-4f62-b576-5e7f626d90c1)
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.RepositoryImpl initStartupWorkspaces
> SEVERE: Failed to initialize workspace 'wm9'
> The testInconsistency2 method concurrently adds a reference property to a node B (the threads do exactly the same). This sometimes results in a situation in which the referenced node can never be removed anymore because there is a "ghost" reference to it which cannot be removed. (It gives a ReferentialIntegrityException).
> Jun 8, 2009 2:19:51 PM org.apache.jackrabbit.core.state.MLRUItemStateCache cache
> WARNING: overwriting cached entry bc28ff87-216d-4ccd-bd73-03e7499ab54e/{}ref to B
> Exception in thread "main" javax.jcr.ReferentialIntegrityException: 9f025634-d3e1-448e-904c-1c285f6b1bf6: the node cannot be removed because it is still being referenced.
> It seems the first problem (the parent-child relation) is caused by an incorrect merge in the NodeStateMerger class. The second problem might also be caused by an incorrect or missed merge, but I am not sure whether that's the real problem.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (JCR-2129) Prevent data inconsistencies due to
incorrect or missed merges in the ItemStateManagers
Posted by "Martijn Hendriks (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martijn Hendriks updated JCR-2129:
----------------------------------
Description:
There are two places where transient state changes are merged with persisted state: (i) in the SessionISM.stateModified call back method (typically called by a saving thread after it's changes have been saved) and (ii) in the SharedISM.Update.begin method. Sometimes the merge strategy fails in the sense that corrupt data is written to database.
How to reproduce:
The attached test program contains steps to reproduce the issue. The testInconsistency1 method concurrently adds a node D to a node A and moves child node B of A to another place. This sometimes results in a situation in which node A still has a child reference to node B whereas B has another parent. In this situation, Jackrabbit cannot be started anymore if the search index is missing:
Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.query.OnWorkspaceInconsistency$1 handleMissingChildNode
SEVERE: Node /A (a7a29e8c-8d13-4fbd-b0ca-4f93f9c0ef42) has missing child 'B' (80aa13c5-1db6-4f62-b576-5e7f626d90c1)
Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.RepositoryImpl initStartupWorkspaces
SEVERE: Failed to initialize workspace 'wm9'
The testInconsistency2 method concurrently adds a reference property to a node B (the threads do exactly the same). This sometimes results in a situation in which the referenced node can never be removed anymore because there is a "ghost" reference to it which cannot be removed. (It gives a ReferentialIntegrityException).
Jun 8, 2009 2:19:51 PM org.apache.jackrabbit.core.state.MLRUItemStateCache cache
WARNING: overwriting cached entry bc28ff87-216d-4ccd-bd73-03e7499ab54e/{}ref to B
Exception in thread "main" javax.jcr.ReferentialIntegrityException: 9f025634-d3e1-448e-904c-1c285f6b1bf6: the node cannot be removed because it is still being referenced.
It seems the first problem (the parent-child relation) is caused by an incorrect merge in the NodeStateMerger class. The second problem might also be caused by an incorrect or missed merge, but I am not sure whether that's the real problem.
was:
The SharedItemStateManager.Update class's begin method tests whether states in the given local ChangeLog are stale. If so, it tries to merge the changes to the new persisted state. It does this by comparing the modCount of state instances for non-transient states. There is a race between threads that call save such that sometimes this test fails and states are not merged when they should be. As a result, the data in the repository can become corrupt and, for instance, it becomes impossible to start Jackrabbit or remove certain nodes.
Analysis: persisted state information, including modCount, is pushed down from another thread while a local ChangeLog is being constructed. The increased modCount thus appears in the local ChangeLog and the SharedISM falsely assumes that the state in the local ChangeLog needs no merging (isStale test).
Reproduction:
The attached test program contains steps to reproduce the issue (see comments of the testInconsistency1 and testInconsistency2 methods).
Summary: Prevent data inconsistencies due to incorrect or missed merges in the ItemStateManagers (was: Prevent data inconsistencies due to missed merges in the SharedItemStateManager)
> Prevent data inconsistencies due to incorrect or missed merges in the ItemStateManagers
> ---------------------------------------------------------------------------------------
>
> Key: JCR-2129
> URL: https://issues.apache.org/jira/browse/JCR-2129
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core
> Affects Versions: core 1.4.5, 2.0.0
> Reporter: Martijn Hendriks
> Priority: Critical
> Attachments: InconsistencyTest.java, repository.xml
>
>
> There are two places where transient state changes are merged with persisted state: (i) in the SessionISM.stateModified call back method (typically called by a saving thread after it's changes have been saved) and (ii) in the SharedISM.Update.begin method. Sometimes the merge strategy fails in the sense that corrupt data is written to database.
> How to reproduce:
> The attached test program contains steps to reproduce the issue. The testInconsistency1 method concurrently adds a node D to a node A and moves child node B of A to another place. This sometimes results in a situation in which node A still has a child reference to node B whereas B has another parent. In this situation, Jackrabbit cannot be started anymore if the search index is missing:
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.query.OnWorkspaceInconsistency$1 handleMissingChildNode
> SEVERE: Node /A (a7a29e8c-8d13-4fbd-b0ca-4f93f9c0ef42) has missing child 'B' (80aa13c5-1db6-4f62-b576-5e7f626d90c1)
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.RepositoryImpl initStartupWorkspaces
> SEVERE: Failed to initialize workspace 'wm9'
> The testInconsistency2 method concurrently adds a reference property to a node B (the threads do exactly the same). This sometimes results in a situation in which the referenced node can never be removed anymore because there is a "ghost" reference to it which cannot be removed. (It gives a ReferentialIntegrityException).
> Jun 8, 2009 2:19:51 PM org.apache.jackrabbit.core.state.MLRUItemStateCache cache
> WARNING: overwriting cached entry bc28ff87-216d-4ccd-bd73-03e7499ab54e/{}ref to B
> Exception in thread "main" javax.jcr.ReferentialIntegrityException: 9f025634-d3e1-448e-904c-1c285f6b1bf6: the node cannot be removed because it is still being referenced.
> It seems the first problem (the parent-child relation) is caused by an incorrect merge in the NodeStateMerger class. The second problem might also be caused by an incorrect or missed merge, but I am not sure whether that's the real problem.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (JCR-2129) Prevent data inconsistencies due to
incorrect or missed merges in the ItemStateManagers
Posted by "Martijn Hendriks (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martijn Hendriks updated JCR-2129:
----------------------------------
Attachment: (was: JCR-2129-testcase.patch)
> Prevent data inconsistencies due to incorrect or missed merges in the ItemStateManagers
> ---------------------------------------------------------------------------------------
>
> Key: JCR-2129
> URL: https://issues.apache.org/jira/browse/JCR-2129
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core
> Affects Versions: core 1.4.5, 2.0.0
> Reporter: Martijn Hendriks
> Priority: Critical
> Attachments: InconsistencyTest.java, JCR-2129-testcase.patch, repository.xml
>
>
> There are two places where transient state changes are merged with persisted state: (i) in the SessionISM.stateModified call back method (typically called by a saving thread after it's changes have been saved) and (ii) in the SharedISM.Update.begin method. Sometimes the merge strategy fails in the sense that corrupt data is written to database.
> How to reproduce:
> The attached test program contains steps to reproduce the issue. The testInconsistency1 method concurrently adds a node D to a node A and moves child node B of A to another place. This sometimes results in a situation in which node A still has a child reference to node B whereas B has another parent. In this situation, Jackrabbit cannot be started anymore if the search index is missing:
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.query.OnWorkspaceInconsistency$1 handleMissingChildNode
> SEVERE: Node /A (a7a29e8c-8d13-4fbd-b0ca-4f93f9c0ef42) has missing child 'B' (80aa13c5-1db6-4f62-b576-5e7f626d90c1)
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.RepositoryImpl initStartupWorkspaces
> SEVERE: Failed to initialize workspace 'wm9'
> The testInconsistency2 method concurrently adds a reference property to a node B (the threads do exactly the same). This sometimes results in a situation in which the referenced node can never be removed anymore because there is a "ghost" reference to it which cannot be removed. (It gives a ReferentialIntegrityException).
> Jun 8, 2009 2:19:51 PM org.apache.jackrabbit.core.state.MLRUItemStateCache cache
> WARNING: overwriting cached entry bc28ff87-216d-4ccd-bd73-03e7499ab54e/{}ref to B
> Exception in thread "main" javax.jcr.ReferentialIntegrityException: 9f025634-d3e1-448e-904c-1c285f6b1bf6: the node cannot be removed because it is still being referenced.
> It seems the first problem (the parent-child relation) is caused by an incorrect merge in the NodeStateMerger class. The second problem might also be caused by an incorrect or missed merge, but I am not sure whether that's the real problem.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (JCR-2129) Prevent data inconsistencies due to
incorrect or missed merges in the ItemStateManagers
Posted by "Martijn Hendriks (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2129?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12718356#action_12718356 ]
Martijn Hendriks commented on JCR-2129:
---------------------------------------
Created a separate issue for the references issue because it seems unrelated to the parent-child thing: JCR-2138.
> Prevent data inconsistencies due to incorrect or missed merges in the ItemStateManagers
> ---------------------------------------------------------------------------------------
>
> Key: JCR-2129
> URL: https://issues.apache.org/jira/browse/JCR-2129
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core
> Affects Versions: core 1.4.5, 2.0.0
> Reporter: Martijn Hendriks
> Priority: Critical
> Attachments: InconsistencyTest.java, JCR-2129-testcase.patch, repository.xml
>
>
> There are two places where transient state changes are merged with persisted state: (i) in the SessionISM.stateModified call back method (typically called by a saving thread after it's changes have been saved) and (ii) in the SharedISM.Update.begin method. Sometimes the merge strategy fails in the sense that corrupt data is written to database.
> How to reproduce:
> The attached test program contains steps to reproduce the issue. The testInconsistency1 method concurrently adds a node D to a node A and moves child node B of A to another place. This sometimes results in a situation in which node A still has a child reference to node B whereas B has another parent. In this situation, Jackrabbit cannot be started anymore if the search index is missing:
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.query.OnWorkspaceInconsistency$1 handleMissingChildNode
> SEVERE: Node /A (a7a29e8c-8d13-4fbd-b0ca-4f93f9c0ef42) has missing child 'B' (80aa13c5-1db6-4f62-b576-5e7f626d90c1)
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.RepositoryImpl initStartupWorkspaces
> SEVERE: Failed to initialize workspace 'wm9'
> The testInconsistency2 method concurrently adds a reference property to a node B (the threads do exactly the same). This sometimes results in a situation in which the referenced node can never be removed anymore because there is a "ghost" reference to it which cannot be removed. (It gives a ReferentialIntegrityException).
> Jun 8, 2009 2:19:51 PM org.apache.jackrabbit.core.state.MLRUItemStateCache cache
> WARNING: overwriting cached entry bc28ff87-216d-4ccd-bd73-03e7499ab54e/{}ref to B
> Exception in thread "main" javax.jcr.ReferentialIntegrityException: 9f025634-d3e1-448e-904c-1c285f6b1bf6: the node cannot be removed because it is still being referenced.
> It seems the first problem (the parent-child relation) is caused by an incorrect merge in the NodeStateMerger class. The second problem might also be caused by an incorrect or missed merge, but I am not sure whether that's the real problem.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (JCR-2129) Prevent data inconsistencies due to
incorrect or missed merges in the ItemStateManagers
Posted by "Martijn Hendriks (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martijn Hendriks reassigned JCR-2129:
-------------------------------------
Assignee: Martijn Hendriks
> Prevent data inconsistencies due to incorrect or missed merges in the ItemStateManagers
> ---------------------------------------------------------------------------------------
>
> Key: JCR-2129
> URL: https://issues.apache.org/jira/browse/JCR-2129
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core
> Affects Versions: core 1.4.5, 2.0.0
> Reporter: Martijn Hendriks
> Assignee: Martijn Hendriks
> Priority: Critical
> Attachments: InconsistencyTest.java, JCR-2129-testcase.patch, JCR-2129.patch, repository.xml
>
>
> There are two places where transient state changes are merged with persisted state: (i) in the SessionISM.stateModified call back method (typically called by a saving thread after it's changes have been saved) and (ii) in the SharedISM.Update.begin method. Sometimes the merge strategy fails in the sense that corrupt data is written to database.
> How to reproduce:
> The attached test program contains steps to reproduce the issue. The testInconsistency1 method concurrently adds a node D to a node A and moves child node B of A to another place. This sometimes results in a situation in which node A still has a child reference to node B whereas B has another parent. In this situation, Jackrabbit cannot be started anymore if the search index is missing:
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.query.OnWorkspaceInconsistency$1 handleMissingChildNode
> SEVERE: Node /A (a7a29e8c-8d13-4fbd-b0ca-4f93f9c0ef42) has missing child 'B' (80aa13c5-1db6-4f62-b576-5e7f626d90c1)
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.RepositoryImpl initStartupWorkspaces
> SEVERE: Failed to initialize workspace 'wm9'
> The testInconsistency2 method concurrently adds a reference property to a node B (the threads do exactly the same). This sometimes results in a situation in which the referenced node can never be removed anymore because there is a "ghost" reference to it which cannot be removed. (It gives a ReferentialIntegrityException).
> Jun 8, 2009 2:19:51 PM org.apache.jackrabbit.core.state.MLRUItemStateCache cache
> WARNING: overwriting cached entry bc28ff87-216d-4ccd-bd73-03e7499ab54e/{}ref to B
> Exception in thread "main" javax.jcr.ReferentialIntegrityException: 9f025634-d3e1-448e-904c-1c285f6b1bf6: the node cannot be removed because it is still being referenced.
> It seems the first problem (the parent-child relation) is caused by an incorrect merge in the NodeStateMerger class. The second problem might also be caused by an incorrect or missed merge, but I am not sure whether that's the real problem.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (JCR-2129) Prevent data inconsistencies due to
incorrect or missed merges in the ItemStateManagers
Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jukka Zitting updated JCR-2129:
-------------------------------
Fix Version/s: core 1.4.12
Merged to the 1.4 branch in revision 948381.
> Prevent data inconsistencies due to incorrect or missed merges in the ItemStateManagers
> ---------------------------------------------------------------------------------------
>
> Key: JCR-2129
> URL: https://issues.apache.org/jira/browse/JCR-2129
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core
> Affects Versions: core 1.4.5
> Reporter: Martijn Hendriks
> Priority: Critical
> Fix For: core 1.4.12, 1.5.7
>
> Attachments: InconsistencyTest.java, JCR-2129-testcase.patch, JCR-2129.patch, JCR-2129.patch, repository.xml
>
>
> There are two places where transient state changes are merged with persisted state: (i) in the SessionISM.stateModified call back method (typically called by a saving thread after it's changes have been saved) and (ii) in the SharedISM.Update.begin method. Sometimes the merge strategy fails in the sense that corrupt data is written to database.
> How to reproduce:
> The attached test program contains steps to reproduce the issue. The testInconsistency1 method concurrently adds a node D to a node A and moves child node B of A to another place. This sometimes results in a situation in which node A still has a child reference to node B whereas B has another parent. In this situation, Jackrabbit cannot be started anymore if the search index is missing:
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.query.OnWorkspaceInconsistency$1 handleMissingChildNode
> SEVERE: Node /A (a7a29e8c-8d13-4fbd-b0ca-4f93f9c0ef42) has missing child 'B' (80aa13c5-1db6-4f62-b576-5e7f626d90c1)
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.RepositoryImpl initStartupWorkspaces
> SEVERE: Failed to initialize workspace 'wm9'
> The testInconsistency2 method concurrently adds a reference property to a node B (the threads do exactly the same). This sometimes results in a situation in which the referenced node can never be removed anymore because there is a "ghost" reference to it which cannot be removed. (It gives a ReferentialIntegrityException).
> Jun 8, 2009 2:19:51 PM org.apache.jackrabbit.core.state.MLRUItemStateCache cache
> WARNING: overwriting cached entry bc28ff87-216d-4ccd-bd73-03e7499ab54e/{}ref to B
> Exception in thread "main" javax.jcr.ReferentialIntegrityException: 9f025634-d3e1-448e-904c-1c285f6b1bf6: the node cannot be removed because it is still being referenced.
> It seems the first problem (the parent-child relation) is caused by an incorrect merge in the NodeStateMerger class. The second problem might also be caused by an incorrect or missed merge, but I am not sure whether that's the real problem.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (JCR-2129) Prevent data inconsistencies due to
incorrect or missed merges in the ItemStateManagers
Posted by "Martijn Hendriks (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2129?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12725102#action_12725102 ]
Martijn Hendriks commented on JCR-2129:
---------------------------------------
Marcel, thanks for extending the test cases and creating a new patch, which works fine for me! I see that you improved the merging strategy which is nicer than throwing an ItemStateException.
> Prevent data inconsistencies due to incorrect or missed merges in the ItemStateManagers
> ---------------------------------------------------------------------------------------
>
> Key: JCR-2129
> URL: https://issues.apache.org/jira/browse/JCR-2129
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core
> Affects Versions: core 1.4.5
> Reporter: Martijn Hendriks
> Priority: Critical
> Attachments: InconsistencyTest.java, JCR-2129-testcase.patch, JCR-2129.patch, JCR-2129.patch, repository.xml
>
>
> There are two places where transient state changes are merged with persisted state: (i) in the SessionISM.stateModified call back method (typically called by a saving thread after it's changes have been saved) and (ii) in the SharedISM.Update.begin method. Sometimes the merge strategy fails in the sense that corrupt data is written to database.
> How to reproduce:
> The attached test program contains steps to reproduce the issue. The testInconsistency1 method concurrently adds a node D to a node A and moves child node B of A to another place. This sometimes results in a situation in which node A still has a child reference to node B whereas B has another parent. In this situation, Jackrabbit cannot be started anymore if the search index is missing:
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.query.OnWorkspaceInconsistency$1 handleMissingChildNode
> SEVERE: Node /A (a7a29e8c-8d13-4fbd-b0ca-4f93f9c0ef42) has missing child 'B' (80aa13c5-1db6-4f62-b576-5e7f626d90c1)
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.RepositoryImpl initStartupWorkspaces
> SEVERE: Failed to initialize workspace 'wm9'
> The testInconsistency2 method concurrently adds a reference property to a node B (the threads do exactly the same). This sometimes results in a situation in which the referenced node can never be removed anymore because there is a "ghost" reference to it which cannot be removed. (It gives a ReferentialIntegrityException).
> Jun 8, 2009 2:19:51 PM org.apache.jackrabbit.core.state.MLRUItemStateCache cache
> WARNING: overwriting cached entry bc28ff87-216d-4ccd-bd73-03e7499ab54e/{}ref to B
> Exception in thread "main" javax.jcr.ReferentialIntegrityException: 9f025634-d3e1-448e-904c-1c285f6b1bf6: the node cannot be removed because it is still being referenced.
> It seems the first problem (the parent-child relation) is caused by an incorrect merge in the NodeStateMerger class. The second problem might also be caused by an incorrect or missed merge, but I am not sure whether that's the real problem.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (JCR-2129) Prevent data inconsistencies due to
incorrect or missed merges in the ItemStateManagers
Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jukka Zitting updated JCR-2129:
-------------------------------
Fix Version/s: (was: 2.0.0)
1.6.0
Merged to the 1.x branch in revision 791842.
> Prevent data inconsistencies due to incorrect or missed merges in the ItemStateManagers
> ---------------------------------------------------------------------------------------
>
> Key: JCR-2129
> URL: https://issues.apache.org/jira/browse/JCR-2129
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core
> Affects Versions: core 1.4.5
> Reporter: Martijn Hendriks
> Priority: Critical
> Fix For: 1.6.0
>
> Attachments: InconsistencyTest.java, JCR-2129-testcase.patch, JCR-2129.patch, JCR-2129.patch, repository.xml
>
>
> There are two places where transient state changes are merged with persisted state: (i) in the SessionISM.stateModified call back method (typically called by a saving thread after it's changes have been saved) and (ii) in the SharedISM.Update.begin method. Sometimes the merge strategy fails in the sense that corrupt data is written to database.
> How to reproduce:
> The attached test program contains steps to reproduce the issue. The testInconsistency1 method concurrently adds a node D to a node A and moves child node B of A to another place. This sometimes results in a situation in which node A still has a child reference to node B whereas B has another parent. In this situation, Jackrabbit cannot be started anymore if the search index is missing:
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.query.OnWorkspaceInconsistency$1 handleMissingChildNode
> SEVERE: Node /A (a7a29e8c-8d13-4fbd-b0ca-4f93f9c0ef42) has missing child 'B' (80aa13c5-1db6-4f62-b576-5e7f626d90c1)
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.RepositoryImpl initStartupWorkspaces
> SEVERE: Failed to initialize workspace 'wm9'
> The testInconsistency2 method concurrently adds a reference property to a node B (the threads do exactly the same). This sometimes results in a situation in which the referenced node can never be removed anymore because there is a "ghost" reference to it which cannot be removed. (It gives a ReferentialIntegrityException).
> Jun 8, 2009 2:19:51 PM org.apache.jackrabbit.core.state.MLRUItemStateCache cache
> WARNING: overwriting cached entry bc28ff87-216d-4ccd-bd73-03e7499ab54e/{}ref to B
> Exception in thread "main" javax.jcr.ReferentialIntegrityException: 9f025634-d3e1-448e-904c-1c285f6b1bf6: the node cannot be removed because it is still being referenced.
> It seems the first problem (the parent-child relation) is caused by an incorrect merge in the NodeStateMerger class. The second problem might also be caused by an incorrect or missed merge, but I am not sure whether that's the real problem.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (JCR-2129) Prevent data inconsistencies due to
incorrect or missed merges in the ItemStateManagers
Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Marcel Reutegger updated JCR-2129:
----------------------------------
Affects Version/s: (was: 2.0.0)
> Prevent data inconsistencies due to incorrect or missed merges in the ItemStateManagers
> ---------------------------------------------------------------------------------------
>
> Key: JCR-2129
> URL: https://issues.apache.org/jira/browse/JCR-2129
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core
> Affects Versions: core 1.4.5
> Reporter: Martijn Hendriks
> Assignee: Martijn Hendriks
> Priority: Critical
> Attachments: InconsistencyTest.java, JCR-2129-testcase.patch, JCR-2129.patch, repository.xml
>
>
> There are two places where transient state changes are merged with persisted state: (i) in the SessionISM.stateModified call back method (typically called by a saving thread after it's changes have been saved) and (ii) in the SharedISM.Update.begin method. Sometimes the merge strategy fails in the sense that corrupt data is written to database.
> How to reproduce:
> The attached test program contains steps to reproduce the issue. The testInconsistency1 method concurrently adds a node D to a node A and moves child node B of A to another place. This sometimes results in a situation in which node A still has a child reference to node B whereas B has another parent. In this situation, Jackrabbit cannot be started anymore if the search index is missing:
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.query.OnWorkspaceInconsistency$1 handleMissingChildNode
> SEVERE: Node /A (a7a29e8c-8d13-4fbd-b0ca-4f93f9c0ef42) has missing child 'B' (80aa13c5-1db6-4f62-b576-5e7f626d90c1)
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.RepositoryImpl initStartupWorkspaces
> SEVERE: Failed to initialize workspace 'wm9'
> The testInconsistency2 method concurrently adds a reference property to a node B (the threads do exactly the same). This sometimes results in a situation in which the referenced node can never be removed anymore because there is a "ghost" reference to it which cannot be removed. (It gives a ReferentialIntegrityException).
> Jun 8, 2009 2:19:51 PM org.apache.jackrabbit.core.state.MLRUItemStateCache cache
> WARNING: overwriting cached entry bc28ff87-216d-4ccd-bd73-03e7499ab54e/{}ref to B
> Exception in thread "main" javax.jcr.ReferentialIntegrityException: 9f025634-d3e1-448e-904c-1c285f6b1bf6: the node cannot be removed because it is still being referenced.
> It seems the first problem (the parent-child relation) is caused by an incorrect merge in the NodeStateMerger class. The second problem might also be caused by an incorrect or missed merge, but I am not sure whether that's the real problem.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (JCR-2129) Prevent data inconsistencies due to
incorrect or missed merges in the ItemStateManagers
Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Marcel Reutegger updated JCR-2129:
----------------------------------
Attachment: JCR-2129.patch
Attached is an extended version of Martijns initial patch. It contains more test cases covering various combinations of modifications as well as previously untested modifications.
I also extended the NodeStateMerger.MergeContext with an additional method that allows the merge to distinguish between an externally added/removed node and a locally moved node.
Martijn, can you please test the patch and report back if it works for you? thanks.
> Prevent data inconsistencies due to incorrect or missed merges in the ItemStateManagers
> ---------------------------------------------------------------------------------------
>
> Key: JCR-2129
> URL: https://issues.apache.org/jira/browse/JCR-2129
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core
> Affects Versions: core 1.4.5
> Reporter: Martijn Hendriks
> Assignee: Martijn Hendriks
> Priority: Critical
> Attachments: InconsistencyTest.java, JCR-2129-testcase.patch, JCR-2129.patch, JCR-2129.patch, repository.xml
>
>
> There are two places where transient state changes are merged with persisted state: (i) in the SessionISM.stateModified call back method (typically called by a saving thread after it's changes have been saved) and (ii) in the SharedISM.Update.begin method. Sometimes the merge strategy fails in the sense that corrupt data is written to database.
> How to reproduce:
> The attached test program contains steps to reproduce the issue. The testInconsistency1 method concurrently adds a node D to a node A and moves child node B of A to another place. This sometimes results in a situation in which node A still has a child reference to node B whereas B has another parent. In this situation, Jackrabbit cannot be started anymore if the search index is missing:
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.query.OnWorkspaceInconsistency$1 handleMissingChildNode
> SEVERE: Node /A (a7a29e8c-8d13-4fbd-b0ca-4f93f9c0ef42) has missing child 'B' (80aa13c5-1db6-4f62-b576-5e7f626d90c1)
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.RepositoryImpl initStartupWorkspaces
> SEVERE: Failed to initialize workspace 'wm9'
> The testInconsistency2 method concurrently adds a reference property to a node B (the threads do exactly the same). This sometimes results in a situation in which the referenced node can never be removed anymore because there is a "ghost" reference to it which cannot be removed. (It gives a ReferentialIntegrityException).
> Jun 8, 2009 2:19:51 PM org.apache.jackrabbit.core.state.MLRUItemStateCache cache
> WARNING: overwriting cached entry bc28ff87-216d-4ccd-bd73-03e7499ab54e/{}ref to B
> Exception in thread "main" javax.jcr.ReferentialIntegrityException: 9f025634-d3e1-448e-904c-1c285f6b1bf6: the node cannot be removed because it is still being referenced.
> It seems the first problem (the parent-child relation) is caused by an incorrect merge in the NodeStateMerger class. The second problem might also be caused by an incorrect or missed merge, but I am not sure whether that's the real problem.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (JCR-2129) Prevent data inconsistencies due to
incorrect or missed merges in the ItemStateManagers
Posted by "Martijn Hendriks (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martijn Hendriks reassigned JCR-2129:
-------------------------------------
Assignee: (was: Martijn Hendriks)
> Prevent data inconsistencies due to incorrect or missed merges in the ItemStateManagers
> ---------------------------------------------------------------------------------------
>
> Key: JCR-2129
> URL: https://issues.apache.org/jira/browse/JCR-2129
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core
> Affects Versions: core 1.4.5
> Reporter: Martijn Hendriks
> Priority: Critical
> Attachments: InconsistencyTest.java, JCR-2129-testcase.patch, JCR-2129.patch, JCR-2129.patch, repository.xml
>
>
> There are two places where transient state changes are merged with persisted state: (i) in the SessionISM.stateModified call back method (typically called by a saving thread after it's changes have been saved) and (ii) in the SharedISM.Update.begin method. Sometimes the merge strategy fails in the sense that corrupt data is written to database.
> How to reproduce:
> The attached test program contains steps to reproduce the issue. The testInconsistency1 method concurrently adds a node D to a node A and moves child node B of A to another place. This sometimes results in a situation in which node A still has a child reference to node B whereas B has another parent. In this situation, Jackrabbit cannot be started anymore if the search index is missing:
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.query.OnWorkspaceInconsistency$1 handleMissingChildNode
> SEVERE: Node /A (a7a29e8c-8d13-4fbd-b0ca-4f93f9c0ef42) has missing child 'B' (80aa13c5-1db6-4f62-b576-5e7f626d90c1)
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.RepositoryImpl initStartupWorkspaces
> SEVERE: Failed to initialize workspace 'wm9'
> The testInconsistency2 method concurrently adds a reference property to a node B (the threads do exactly the same). This sometimes results in a situation in which the referenced node can never be removed anymore because there is a "ghost" reference to it which cannot be removed. (It gives a ReferentialIntegrityException).
> Jun 8, 2009 2:19:51 PM org.apache.jackrabbit.core.state.MLRUItemStateCache cache
> WARNING: overwriting cached entry bc28ff87-216d-4ccd-bd73-03e7499ab54e/{}ref to B
> Exception in thread "main" javax.jcr.ReferentialIntegrityException: 9f025634-d3e1-448e-904c-1c285f6b1bf6: the node cannot be removed because it is still being referenced.
> It seems the first problem (the parent-child relation) is caused by an incorrect merge in the NodeStateMerger class. The second problem might also be caused by an incorrect or missed merge, but I am not sure whether that's the real problem.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (JCR-2129) Prevent data inconsistencies due to
incorrect or missed merges in the ItemStateManagers
Posted by "Martijn Hendriks (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martijn Hendriks updated JCR-2129:
----------------------------------
Attachment: JCR-2129-testcase.patch
> Prevent data inconsistencies due to incorrect or missed merges in the ItemStateManagers
> ---------------------------------------------------------------------------------------
>
> Key: JCR-2129
> URL: https://issues.apache.org/jira/browse/JCR-2129
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core
> Affects Versions: core 1.4.5, 2.0.0
> Reporter: Martijn Hendriks
> Priority: Critical
> Attachments: InconsistencyTest.java, JCR-2129-testcase.patch, repository.xml
>
>
> There are two places where transient state changes are merged with persisted state: (i) in the SessionISM.stateModified call back method (typically called by a saving thread after it's changes have been saved) and (ii) in the SharedISM.Update.begin method. Sometimes the merge strategy fails in the sense that corrupt data is written to database.
> How to reproduce:
> The attached test program contains steps to reproduce the issue. The testInconsistency1 method concurrently adds a node D to a node A and moves child node B of A to another place. This sometimes results in a situation in which node A still has a child reference to node B whereas B has another parent. In this situation, Jackrabbit cannot be started anymore if the search index is missing:
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.query.OnWorkspaceInconsistency$1 handleMissingChildNode
> SEVERE: Node /A (a7a29e8c-8d13-4fbd-b0ca-4f93f9c0ef42) has missing child 'B' (80aa13c5-1db6-4f62-b576-5e7f626d90c1)
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.RepositoryImpl initStartupWorkspaces
> SEVERE: Failed to initialize workspace 'wm9'
> The testInconsistency2 method concurrently adds a reference property to a node B (the threads do exactly the same). This sometimes results in a situation in which the referenced node can never be removed anymore because there is a "ghost" reference to it which cannot be removed. (It gives a ReferentialIntegrityException).
> Jun 8, 2009 2:19:51 PM org.apache.jackrabbit.core.state.MLRUItemStateCache cache
> WARNING: overwriting cached entry bc28ff87-216d-4ccd-bd73-03e7499ab54e/{}ref to B
> Exception in thread "main" javax.jcr.ReferentialIntegrityException: 9f025634-d3e1-448e-904c-1c285f6b1bf6: the node cannot be removed because it is still being referenced.
> It seems the first problem (the parent-child relation) is caused by an incorrect merge in the NodeStateMerger class. The second problem might also be caused by an incorrect or missed merge, but I am not sure whether that's the real problem.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (JCR-2129) Prevent data inconsistencies due to
incorrect or missed merges in the ItemStateManagers
Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jukka Zitting updated JCR-2129:
-------------------------------
Fix Version/s: (was: 1.6.0)
1.5.7
Merged to the 1.5 branch in revision 794292.
> Prevent data inconsistencies due to incorrect or missed merges in the ItemStateManagers
> ---------------------------------------------------------------------------------------
>
> Key: JCR-2129
> URL: https://issues.apache.org/jira/browse/JCR-2129
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core
> Affects Versions: core 1.4.5
> Reporter: Martijn Hendriks
> Priority: Critical
> Fix For: 1.5.7
>
> Attachments: InconsistencyTest.java, JCR-2129-testcase.patch, JCR-2129.patch, JCR-2129.patch, repository.xml
>
>
> There are two places where transient state changes are merged with persisted state: (i) in the SessionISM.stateModified call back method (typically called by a saving thread after it's changes have been saved) and (ii) in the SharedISM.Update.begin method. Sometimes the merge strategy fails in the sense that corrupt data is written to database.
> How to reproduce:
> The attached test program contains steps to reproduce the issue. The testInconsistency1 method concurrently adds a node D to a node A and moves child node B of A to another place. This sometimes results in a situation in which node A still has a child reference to node B whereas B has another parent. In this situation, Jackrabbit cannot be started anymore if the search index is missing:
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.query.OnWorkspaceInconsistency$1 handleMissingChildNode
> SEVERE: Node /A (a7a29e8c-8d13-4fbd-b0ca-4f93f9c0ef42) has missing child 'B' (80aa13c5-1db6-4f62-b576-5e7f626d90c1)
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.RepositoryImpl initStartupWorkspaces
> SEVERE: Failed to initialize workspace 'wm9'
> The testInconsistency2 method concurrently adds a reference property to a node B (the threads do exactly the same). This sometimes results in a situation in which the referenced node can never be removed anymore because there is a "ghost" reference to it which cannot be removed. (It gives a ReferentialIntegrityException).
> Jun 8, 2009 2:19:51 PM org.apache.jackrabbit.core.state.MLRUItemStateCache cache
> WARNING: overwriting cached entry bc28ff87-216d-4ccd-bd73-03e7499ab54e/{}ref to B
> Exception in thread "main" javax.jcr.ReferentialIntegrityException: 9f025634-d3e1-448e-904c-1c285f6b1bf6: the node cannot be removed because it is still being referenced.
> It seems the first problem (the parent-child relation) is caused by an incorrect merge in the NodeStateMerger class. The second problem might also be caused by an incorrect or missed merge, but I am not sure whether that's the real problem.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (JCR-2129) Prevent data inconsistencies due to
incorrect or missed merges in the ItemStateManagers
Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Marcel Reutegger resolved JCR-2129.
-----------------------------------
Resolution: Fixed
Fix Version/s: 2.0.0
Thank you for the feedback.
Committed my version of the patch in revision: 789279
> Prevent data inconsistencies due to incorrect or missed merges in the ItemStateManagers
> ---------------------------------------------------------------------------------------
>
> Key: JCR-2129
> URL: https://issues.apache.org/jira/browse/JCR-2129
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core
> Affects Versions: core 1.4.5
> Reporter: Martijn Hendriks
> Priority: Critical
> Fix For: 2.0.0
>
> Attachments: InconsistencyTest.java, JCR-2129-testcase.patch, JCR-2129.patch, JCR-2129.patch, repository.xml
>
>
> There are two places where transient state changes are merged with persisted state: (i) in the SessionISM.stateModified call back method (typically called by a saving thread after it's changes have been saved) and (ii) in the SharedISM.Update.begin method. Sometimes the merge strategy fails in the sense that corrupt data is written to database.
> How to reproduce:
> The attached test program contains steps to reproduce the issue. The testInconsistency1 method concurrently adds a node D to a node A and moves child node B of A to another place. This sometimes results in a situation in which node A still has a child reference to node B whereas B has another parent. In this situation, Jackrabbit cannot be started anymore if the search index is missing:
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.query.OnWorkspaceInconsistency$1 handleMissingChildNode
> SEVERE: Node /A (a7a29e8c-8d13-4fbd-b0ca-4f93f9c0ef42) has missing child 'B' (80aa13c5-1db6-4f62-b576-5e7f626d90c1)
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.RepositoryImpl initStartupWorkspaces
> SEVERE: Failed to initialize workspace 'wm9'
> The testInconsistency2 method concurrently adds a reference property to a node B (the threads do exactly the same). This sometimes results in a situation in which the referenced node can never be removed anymore because there is a "ghost" reference to it which cannot be removed. (It gives a ReferentialIntegrityException).
> Jun 8, 2009 2:19:51 PM org.apache.jackrabbit.core.state.MLRUItemStateCache cache
> WARNING: overwriting cached entry bc28ff87-216d-4ccd-bd73-03e7499ab54e/{}ref to B
> Exception in thread "main" javax.jcr.ReferentialIntegrityException: 9f025634-d3e1-448e-904c-1c285f6b1bf6: the node cannot be removed because it is still being referenced.
> It seems the first problem (the parent-child relation) is caused by an incorrect merge in the NodeStateMerger class. The second problem might also be caused by an incorrect or missed merge, but I am not sure whether that's the real problem.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (JCR-2129) Prevent data inconsistencies due to
incorrect or missed merges in the ItemStateManagers
Posted by "Martijn Hendriks (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martijn Hendriks updated JCR-2129:
----------------------------------
Attachment: JCR-2129.patch
Attached a testcase + patch.
The problem seems to be that the NodeStateMerger cannot distinguish externally added child nodes from locally moved child nodes (both show up in the getRemovedChildNodeEntries result).
> Prevent data inconsistencies due to incorrect or missed merges in the ItemStateManagers
> ---------------------------------------------------------------------------------------
>
> Key: JCR-2129
> URL: https://issues.apache.org/jira/browse/JCR-2129
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core
> Affects Versions: core 1.4.5, 2.0.0
> Reporter: Martijn Hendriks
> Priority: Critical
> Attachments: InconsistencyTest.java, JCR-2129-testcase.patch, JCR-2129.patch, repository.xml
>
>
> There are two places where transient state changes are merged with persisted state: (i) in the SessionISM.stateModified call back method (typically called by a saving thread after it's changes have been saved) and (ii) in the SharedISM.Update.begin method. Sometimes the merge strategy fails in the sense that corrupt data is written to database.
> How to reproduce:
> The attached test program contains steps to reproduce the issue. The testInconsistency1 method concurrently adds a node D to a node A and moves child node B of A to another place. This sometimes results in a situation in which node A still has a child reference to node B whereas B has another parent. In this situation, Jackrabbit cannot be started anymore if the search index is missing:
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.query.OnWorkspaceInconsistency$1 handleMissingChildNode
> SEVERE: Node /A (a7a29e8c-8d13-4fbd-b0ca-4f93f9c0ef42) has missing child 'B' (80aa13c5-1db6-4f62-b576-5e7f626d90c1)
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.RepositoryImpl initStartupWorkspaces
> SEVERE: Failed to initialize workspace 'wm9'
> The testInconsistency2 method concurrently adds a reference property to a node B (the threads do exactly the same). This sometimes results in a situation in which the referenced node can never be removed anymore because there is a "ghost" reference to it which cannot be removed. (It gives a ReferentialIntegrityException).
> Jun 8, 2009 2:19:51 PM org.apache.jackrabbit.core.state.MLRUItemStateCache cache
> WARNING: overwriting cached entry bc28ff87-216d-4ccd-bd73-03e7499ab54e/{}ref to B
> Exception in thread "main" javax.jcr.ReferentialIntegrityException: 9f025634-d3e1-448e-904c-1c285f6b1bf6: the node cannot be removed because it is still being referenced.
> It seems the first problem (the parent-child relation) is caused by an incorrect merge in the NodeStateMerger class. The second problem might also be caused by an incorrect or missed merge, but I am not sure whether that's the real problem.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (JCR-2129) Prevent data inconsistencies due to
missed merges in the SharedItemStateManager
Posted by "Martijn Hendriks (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martijn Hendriks updated JCR-2129:
----------------------------------
Description:
The SharedItemStateManager.Update class's begin method tests whether states in the given local ChangeLog are stale. If so, it tries to merge the changes to the new persisted state. It does this by comparing the modCount of state instances for non-transient states. There is a race between threads that call save such that sometimes this test fails and states are not merged when they should be. As a result, the data in the repository can become corrupt and, for instance, it becomes impossible to start Jackrabbit or remove certain nodes.
Analysis: persisted state information, including modCount, is pushed down from another thread while a local ChangeLog is being constructed. The increased modCount thus appears in the local ChangeLog and the SharedISM falsely assumes that the state in the local ChangeLog needs no merging (isStale test).
Reproduction:
The attached test program contains steps to reproduce the issue (see comments of the testInconsistency1 and testInconsistency2 methods).
was:
The SharedItemStateManager.Update class's begin method tests whether states in the given local ChangeLog are stale. If so, it tries to merge the changes to the new persisted state. It does this by comparing the modCount of state instances for non-transient states. There is a race between two threads that call save such that sometimes this test fails and states are not merged when they should be. As a result, the data in the repository can become corrupt and, for instance, it becomes impossible to start Jackrabbit or remove certain nodes.
Analysis: persisted state information, including modCount, is pushed down from another thread while a local ChangeLog is being constructed. The increased modCount thus appears in the local ChangeLog and the SharedISM falsely assumes that the state in the local ChangeLog needs no merging (isStale test).
Reproduction:
The attached test program contains steps to reproduce the issue (see comments of the testInconsistency1 and testInconsistency2 methods).
> Prevent data inconsistencies due to missed merges in the SharedItemStateManager
> -------------------------------------------------------------------------------
>
> Key: JCR-2129
> URL: https://issues.apache.org/jira/browse/JCR-2129
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core
> Affects Versions: core 1.4.5, 2.0.0
> Reporter: Martijn Hendriks
> Priority: Critical
> Attachments: InconsistencyTest.java, repository.xml
>
>
> The SharedItemStateManager.Update class's begin method tests whether states in the given local ChangeLog are stale. If so, it tries to merge the changes to the new persisted state. It does this by comparing the modCount of state instances for non-transient states. There is a race between threads that call save such that sometimes this test fails and states are not merged when they should be. As a result, the data in the repository can become corrupt and, for instance, it becomes impossible to start Jackrabbit or remove certain nodes.
> Analysis: persisted state information, including modCount, is pushed down from another thread while a local ChangeLog is being constructed. The increased modCount thus appears in the local ChangeLog and the SharedISM falsely assumes that the state in the local ChangeLog needs no merging (isStale test).
> Reproduction:
> The attached test program contains steps to reproduce the issue (see comments of the testInconsistency1 and testInconsistency2 methods).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (JCR-2129) Prevent data inconsistencies due to
missed merges in the SharedItemStateManager
Posted by "Martijn Hendriks (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martijn Hendriks updated JCR-2129:
----------------------------------
Attachment: repository.xml
InconsistencyTest.java
> Prevent data inconsistencies due to missed merges in the SharedItemStateManager
> -------------------------------------------------------------------------------
>
> Key: JCR-2129
> URL: https://issues.apache.org/jira/browse/JCR-2129
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core
> Affects Versions: core 1.4.5, 2.0.0
> Reporter: Martijn Hendriks
> Priority: Critical
> Attachments: InconsistencyTest.java, repository.xml
>
>
> The SharedItemStateManager.Update class's begin method tests whether states in the given local ChangeLog are stale. If so, it tries to merge the changes to the new persisted state. It does this by comparing the modCount of state instances for non-transient states. There is a race between two threads that call save such that sometimes this test fails and states are not merged when they should be. As a result, the data in the repository can become corrupt and, for instance, it becomes impossible to start Jackrabbit or remove certain nodes.
> Analysis: persisted state information, including modCount, is pushed down from another thread while a local ChangeLog is being constructed. The increased modCount thus appears in the local ChangeLog and the SharedISM falsely assumes that the state in the local ChangeLog needs no merging (isStale test).
> Reproduction:
> The attached test program contains steps to reproduce the issue (see comments of the testInconsistency1 and testInconsistency2 methods).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (JCR-2129) Prevent data inconsistencies due to
incorrect or missed merges in the ItemStateManagers
Posted by "Martijn Hendriks (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martijn Hendriks updated JCR-2129:
----------------------------------
Attachment: JCR-2129-testcase.patch
Attached a patch which contains two single threaded JUnit testcases for the mentioned problems.
> Prevent data inconsistencies due to incorrect or missed merges in the ItemStateManagers
> ---------------------------------------------------------------------------------------
>
> Key: JCR-2129
> URL: https://issues.apache.org/jira/browse/JCR-2129
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core
> Affects Versions: core 1.4.5, 2.0.0
> Reporter: Martijn Hendriks
> Priority: Critical
> Attachments: InconsistencyTest.java, JCR-2129-testcase.patch, repository.xml
>
>
> There are two places where transient state changes are merged with persisted state: (i) in the SessionISM.stateModified call back method (typically called by a saving thread after it's changes have been saved) and (ii) in the SharedISM.Update.begin method. Sometimes the merge strategy fails in the sense that corrupt data is written to database.
> How to reproduce:
> The attached test program contains steps to reproduce the issue. The testInconsistency1 method concurrently adds a node D to a node A and moves child node B of A to another place. This sometimes results in a situation in which node A still has a child reference to node B whereas B has another parent. In this situation, Jackrabbit cannot be started anymore if the search index is missing:
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.query.OnWorkspaceInconsistency$1 handleMissingChildNode
> SEVERE: Node /A (a7a29e8c-8d13-4fbd-b0ca-4f93f9c0ef42) has missing child 'B' (80aa13c5-1db6-4f62-b576-5e7f626d90c1)
> Jun 8, 2009 2:16:23 PM org.apache.jackrabbit.core.RepositoryImpl initStartupWorkspaces
> SEVERE: Failed to initialize workspace 'wm9'
> The testInconsistency2 method concurrently adds a reference property to a node B (the threads do exactly the same). This sometimes results in a situation in which the referenced node can never be removed anymore because there is a "ghost" reference to it which cannot be removed. (It gives a ReferentialIntegrityException).
> Jun 8, 2009 2:19:51 PM org.apache.jackrabbit.core.state.MLRUItemStateCache cache
> WARNING: overwriting cached entry bc28ff87-216d-4ccd-bd73-03e7499ab54e/{}ref to B
> Exception in thread "main" javax.jcr.ReferentialIntegrityException: 9f025634-d3e1-448e-904c-1c285f6b1bf6: the node cannot be removed because it is still being referenced.
> It seems the first problem (the parent-child relation) is caused by an incorrect merge in the NodeStateMerger class. The second problem might also be caused by an incorrect or missed merge, but I am not sure whether that's the real problem.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.