You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Julian Reschke (JIRA)" <ji...@apache.org> on 2011/07/07 14:42:16 UTC

[jira] [Created] (JCR-3016) inconsistent repository after overlapping node add operations

inconsistent repository after overlapping node add operations
-------------------------------------------------------------

                 Key: JCR-3016
                 URL: https://issues.apache.org/jira/browse/JCR-3016
             Project: Jackrabbit Content Repository
          Issue Type: Bug
          Components: jackrabbit-core
            Reporter: Julian Reschke


It seems I can reproduce a sequence of operations that cause the repository to be inconsistent.

The short version: 2 sessions add a same-named child node to the same parent folder (not allowing same-name-siblings). Session 1's save() succeeds. Session 2's save() fails, but succeeds on retry (!).

After the operation, the child node created by session 1 is still present, but the parent doesn't list it as child node anymore.

(will add test case)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (JCR-3016) inconsistent repository after overlapping node add operations

Posted by "Julian Reschke (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-3016?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Reschke updated JCR-3016:
--------------------------------

    Attachment: OverlappingNodeAddTest.diff

test case

> inconsistent repository after overlapping node add operations
> -------------------------------------------------------------
>
>                 Key: JCR-3016
>                 URL: https://issues.apache.org/jira/browse/JCR-3016
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>            Reporter: Julian Reschke
>         Attachments: OverlappingNodeAddTest.diff
>
>
> It seems I can reproduce a sequence of operations that cause the repository to be inconsistent.
> The short version: 2 sessions add a same-named child node to the same parent folder (not allowing same-name-siblings). Session 1's save() succeeds. Session 2's save() fails, but succeeds on retry (!).
> After the operation, the child node created by session 1 is still present, but the parent doesn't list it as child node anymore.
> (will add test case)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (JCR-3016) inconsistent repository after overlapping node add operations

Posted by "Julian Reschke (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-3016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13061329#comment-13061329 ] 

Julian Reschke commented on JCR-3016:
-------------------------------------

I should have mentioned that enabling the hierarchy checker prevents the problem from happening, and the testtestWithFolderAndFile then yields:

javax.jcr.RepositoryException: Unable to update item: item.save()
	at org.apache.jackrabbit.core.ItemSaveOperation.perform(ItemSaveOperation.java:264)
	at org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:200)
	at org.apache.jackrabbit.core.ItemImpl.perform(ItemImpl.java:91)
	at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:329)
	at org.apache.jackrabbit.core.session.SessionSaveOperation.perform(SessionSaveOperation.java:42)
	at org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:200)
	at org.apache.jackrabbit.core.SessionImpl.perform(SessionImpl.java:355)
	at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:758)
	at org.apache.jackrabbit.core.OverlappingNodeAddTest.testWithFolderAndFile(OverlappingNodeAddTest.java:120)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at org.apache.jackrabbit.test.AbstractJCRTest.run(AbstractJCRTest.java:456)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.apache.jackrabbit.core.state.ItemStateException: Child node entry with id dd97ff41-ee38-4508-aa13-5909e65322dd has been removed, but is not present in the changelog
	at org.apache.jackrabbit.core.state.SharedItemStateManager.validateModified(SharedItemStateManager.java:1371)
	at org.apache.jackrabbit.core.state.SharedItemStateManager.validateHierarchy(SharedItemStateManager.java:1143)
	at org.apache.jackrabbit.core.state.SharedItemStateManager.access$9(SharedItemStateManager.java:1134)
	at org.apache.jackrabbit.core.state.SharedItemStateManager$Update.begin(SharedItemStateManager.java:727)
	at org.apache.jackrabbit.core.state.SharedItemStateManager.beginUpdate(SharedItemStateManager.java:1461)
	at org.apache.jackrabbit.core.state.SharedItemStateManager.update(SharedItemStateManager.java:1491)
	at org.apache.jackrabbit.core.state.LocalItemStateManager.update(LocalItemStateManager.java:351)
	at org.apache.jackrabbit.core.state.XAItemStateManager.update(XAItemStateManager.java:354)
	at org.apache.jackrabbit.core.state.LocalItemStateManager.update(LocalItemStateManager.java:326)
	at org.apache.jackrabbit.core.state.SessionItemStateManager.update(SessionItemStateManager.java:289)
	at org.apache.jackrabbit.core.ItemSaveOperation.perform(ItemSaveOperation.java:258)
	... 25 more

(this is for 2.2.4 source btw)



> inconsistent repository after overlapping node add operations
> -------------------------------------------------------------
>
>                 Key: JCR-3016
>                 URL: https://issues.apache.org/jira/browse/JCR-3016
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>            Reporter: Julian Reschke
>         Attachments: OverlappingNodeAddTest.diff
>
>
> It seems I can reproduce a sequence of operations that cause the repository to be inconsistent.
> The short version: 2 sessions add a same-named child node to the same parent folder (not allowing same-name-siblings). Session 1's save() succeeds. Session 2's save() fails, but succeeds on retry (!).
> After the operation, the child node created by session 1 is still present, but the parent doesn't list it as child node anymore.
> (will add test case)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (JCR-3016) inconsistent repository after overlapping node add operations

Posted by "Julian Reschke (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-3016?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Reschke updated JCR-3016:
--------------------------------

    Attachment: OverlappingNodeAddTest.java

Enhanced the diagnostics from the test case; it now clearly shows that session 1's "folder" node is disconnected from it's parent, but stays in the repository (as demonstrated using getNodeByIdentifier())

> inconsistent repository after overlapping node add operations
> -------------------------------------------------------------
>
>                 Key: JCR-3016
>                 URL: https://issues.apache.org/jira/browse/JCR-3016
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>            Reporter: Julian Reschke
>         Attachments: OverlappingNodeAddTest.diff, OverlappingNodeAddTest.java
>
>
> It seems I can reproduce a sequence of operations that cause the repository to be inconsistent.
> The short version: 2 sessions add a same-named child node to the same parent folder (not allowing same-name-siblings). Session 1's save() succeeds. Session 2's save() fails, but succeeds on retry (!).
> After the operation, the child node created by session 1 is still present, but the parent doesn't list it as child node anymore.
> (will add test case)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (JCR-3016) inconsistent repository after overlapping node add operations

Posted by "Julian Reschke (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-3016?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Reschke reassigned JCR-3016:
-----------------------------------

    Assignee: Julian Reschke

> inconsistent repository after overlapping node add operations
> -------------------------------------------------------------
>
>                 Key: JCR-3016
>                 URL: https://issues.apache.org/jira/browse/JCR-3016
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>            Reporter: Julian Reschke
>            Assignee: Julian Reschke
>         Attachments: OverlappingNodeAddTest.diff, OverlappingNodeAddTest.java
>
>
> It seems I can reproduce a sequence of operations that cause the repository to be inconsistent.
> The short version: 2 sessions add a same-named child node to the same parent folder (not allowing same-name-siblings). Session 1's save() succeeds. Session 2's save() fails, but succeeds on retry (!).
> After the operation, the child node created by session 1 is still present, but the parent doesn't list it as child node anymore.
> (will add test case)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (JCR-3016) inconsistent repository after overlapping node add operations

Posted by "Stefan Guggisberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-3016?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Guggisberg resolved JCR-3016.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.3.0

fixed in svn revision 1144695

> inconsistent repository after overlapping node add operations
> -------------------------------------------------------------
>
>                 Key: JCR-3016
>                 URL: https://issues.apache.org/jira/browse/JCR-3016
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>            Reporter: Julian Reschke
>            Assignee: Stefan Guggisberg
>             Fix For: 2.3.0
>
>         Attachments: OverlappingNodeAddTest.diff, OverlappingNodeAddTest.java
>
>
> It seems I can reproduce a sequence of operations that cause the repository to be inconsistent.
> The short version: 2 sessions add a same-named child node to the same parent folder (not allowing same-name-siblings). Session 1's save() succeeds. Session 2's save() fails, but succeeds on retry (!).
> After the operation, the child node created by session 1 is still present, but the parent doesn't list it as child node anymore.
> (will add test case)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (JCR-3016) inconsistent repository after overlapping node add operations

Posted by "Julian Reschke (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-3016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13061262#comment-13061262 ] 

Julian Reschke commented on JCR-3016:
-------------------------------------

So it seems the failed save() operation leaves the transient space in a state where it *can* be saved, but the save will cause repository corruption.

Either the second save() operation on Session 2 should fail just like the first one, or alternatively the persisted change from Session 1 would need to be merged in - but I don't believe adding a same-named child node is something that is supposed to be mergeable.

> inconsistent repository after overlapping node add operations
> -------------------------------------------------------------
>
>                 Key: JCR-3016
>                 URL: https://issues.apache.org/jira/browse/JCR-3016
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>            Reporter: Julian Reschke
>         Attachments: OverlappingNodeAddTest.diff
>
>
> It seems I can reproduce a sequence of operations that cause the repository to be inconsistent.
> The short version: 2 sessions add a same-named child node to the same parent folder (not allowing same-name-siblings). Session 1's save() succeeds. Session 2's save() fails, but succeeds on retry (!).
> After the operation, the child node created by session 1 is still present, but the parent doesn't list it as child node anymore.
> (will add test case)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (JCR-3016) inconsistent repository after overlapping node add operations

Posted by "Julian Reschke (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-3016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13061296#comment-13061296 ] 

Julian Reschke commented on JCR-3016:
-------------------------------------

Another variant of the problem:

	public void testWithFolderAndFile() throws Exception {

		String testpath = testfolder.getPath();

		Node f1 = s1.getNode(testpath).addNode("foo", "nt:folder");
		Node c1 = f1.addNode("a", "nt:file");
		Node r1 = c1.addNode("jcr:content", "nt:resource");
		r1.setProperty("jcr:data", "foo");

		Node f2 = s2.getNode(testpath).addNode("foo", "nt:file");
		Node r2 = f2.addNode("jcr:content", "nt:resource");
		r2.setProperty("jcr:data", "bar");

		s1.save();

		try {
			s2.save();
		} catch (InvalidItemStateException ex) {
			// expected

			// retry; adding refresh doesn't change anything here
			try {
				s2.save();

			} catch (InvalidItemStateException ex2) {
				// we would be cool with this
			}
		}

		s1.refresh(false); // we don't have changes in s1, so the keepChanges
							// flag should be irrelevant
		f1 = s1.getNode(testpath + "/foo"); // be nice and get a new Node
												// instance

		assertEquals("nt:folder", f1.getPrimaryNodeType().getName());
	}

Here, session 1 creates a node of type nt:folder, session 2 tries to create an nt:file node. For session 2, the 2nd save() succeeds, and the node created by session 1 disappears,

> inconsistent repository after overlapping node add operations
> -------------------------------------------------------------
>
>                 Key: JCR-3016
>                 URL: https://issues.apache.org/jira/browse/JCR-3016
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>            Reporter: Julian Reschke
>         Attachments: OverlappingNodeAddTest.diff
>
>
> It seems I can reproduce a sequence of operations that cause the repository to be inconsistent.
> The short version: 2 sessions add a same-named child node to the same parent folder (not allowing same-name-siblings). Session 1's save() succeeds. Session 2's save() fails, but succeeds on retry (!).
> After the operation, the child node created by session 1 is still present, but the parent doesn't list it as child node anymore.
> (will add test case)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (JCR-3016) inconsistent repository after overlapping node add operations

Posted by "Julian Reschke (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-3016?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Reschke reassigned JCR-3016:
-----------------------------------

    Assignee: Stefan Guggisberg  (was: Julian Reschke)

assigning to you as discussed earlier on

> inconsistent repository after overlapping node add operations
> -------------------------------------------------------------
>
>                 Key: JCR-3016
>                 URL: https://issues.apache.org/jira/browse/JCR-3016
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>            Reporter: Julian Reschke
>            Assignee: Stefan Guggisberg
>         Attachments: OverlappingNodeAddTest.diff, OverlappingNodeAddTest.java
>
>
> It seems I can reproduce a sequence of operations that cause the repository to be inconsistent.
> The short version: 2 sessions add a same-named child node to the same parent folder (not allowing same-name-siblings). Session 1's save() succeeds. Session 2's save() fails, but succeeds on retry (!).
> After the operation, the child node created by session 1 is still present, but the parent doesn't list it as child node anymore.
> (will add test case)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (JCR-3016) inconsistent repository after overlapping node add operations

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-3016?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting updated JCR-3016:
-------------------------------

    Fix Version/s:     (was: 2.3.0)
                   2.2.8

> inconsistent repository after overlapping node add operations
> -------------------------------------------------------------
>
>                 Key: JCR-3016
>                 URL: https://issues.apache.org/jira/browse/JCR-3016
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>            Reporter: Julian Reschke
>            Assignee: Stefan Guggisberg
>             Fix For: 2.2.8
>
>         Attachments: OverlappingNodeAddTest.diff, OverlappingNodeAddTest.java
>
>
> It seems I can reproduce a sequence of operations that cause the repository to be inconsistent.
> The short version: 2 sessions add a same-named child node to the same parent folder (not allowing same-name-siblings). Session 1's save() succeeds. Session 2's save() fails, but succeeds on retry (!).
> After the operation, the child node created by session 1 is still present, but the parent doesn't list it as child node anymore.
> (will add test case)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira