You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Thomas Mueller (JIRA)" <ji...@apache.org> on 2010/01/07 17:06:54 UTC

[jira] Created: (JCR-2456) Repository is corrupt after concurrent changes with the same session

Repository is corrupt after concurrent changes with the same session
--------------------------------------------------------------------

                 Key: JCR-2456
                 URL: https://issues.apache.org/jira/browse/JCR-2456
             Project: Jackrabbit Content Repository
          Issue Type: Bug
            Reporter: Thomas Mueller
         Attachments: TestMultiThread.java

After concurrent write operations using the same session, the repository can get corrupt, meaning a ItemNotFoundException is thrown when trying to remove a node.

Concurrent write operations are not supported, however I believe the persistent state of the repository should not be get corrupt.

One way to solve this problem is to synchronize on the session internally.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Updated: (JCR-2456) Repository is corrupt after concurrent changes with the same session

Posted by Bart van der Schans <b....@onehippo.com>.
I wanted to attach the file, but accidentally changed the status to
"Patch Available" and fix version 1.5.7 with the submit patch option.
I guess that probably should be reverted.

Bart


On Thu, Jan 14, 2010 at 12:29 PM, Bart van der Schans (JIRA)
<ji...@apache.org> wrote:
>
>     [ https://issues.apache.org/jira/browse/JCR-2456?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
>
> Bart van der Schans updated JCR-2456:
> -------------------------------------
>
>    Affects Version/s:     (was: 2.0-beta4)
>                       1.5.7
>               Status: Patch Available  (was: Open)
>
>> Repository is corrupt after concurrent changes with the same session
>> --------------------------------------------------------------------
>>
>>                 Key: JCR-2456
>>                 URL: https://issues.apache.org/jira/browse/JCR-2456
>>             Project: Jackrabbit Content Repository
>>          Issue Type: Bug
>>          Components: jackrabbit-core
>>    Affects Versions: 1.5.7
>>            Reporter: Thomas Mueller
>>         Attachments: patch-2456-1.5.txt, patch-2456.txt, TestMultiThread.java
>>
>>
>> After concurrent write operations using the same session, the repository can get corrupt, meaning a ItemNotFoundException is thrown when trying to remove a node.
>> Concurrent write operations are not supported, however I believe the persistent state of the repository should not be get corrupt.
>> One way to solve this problem is to synchronize on the session internally.
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>



-- 
Hippo B.V.  -  Amsterdam
Oosteinde 11, 1017 WT, Amsterdam, +31(0)20-5224466

Hippo USA Inc.  -  San Francisco
101 H Street, Suite Q, Petaluma CA, 94952-3329, +1 (707) 773-4646
-----------------------------------------------------------------
http://www.onehippo.com   -  info@onehippo.com
-----------------------------------------------------------------

[jira] Commented: (JCR-2456) Repository is corrupt after concurrent changes with the same session

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

Thomas Mueller commented on JCR-2456:
-------------------------------------

Hi Bart

Those exceptions are expected currently. I tlooks like you set IGNORE_ERRORS to false (right?), otherwise you shouldn't see the stack traces (you should only see one line per exception).

The 'real' problem (what this bug is about) is that even after restarting the repository, a node can no longer be deleted. That means the persisted state (the data stored in the persistence manager) of the repository is corrupt: a node refers to a child node that doesn't exist.

I suggest to reset IGNORE_ERRORS (to true) and let the test case run until it's finished (it will take a few minutes). If you don't see a stack trace then everything is fine.


> Repository is corrupt after concurrent changes with the same session
> --------------------------------------------------------------------
>
>                 Key: JCR-2456
>                 URL: https://issues.apache.org/jira/browse/JCR-2456
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.0-beta4
>            Reporter: Thomas Mueller
>         Attachments: patch-2456.txt, TestMultiThread.java
>
>
> After concurrent write operations using the same session, the repository can get corrupt, meaning a ItemNotFoundException is thrown when trying to remove a node.
> Concurrent write operations are not supported, however I believe the persistent state of the repository should not be get corrupt.
> One way to solve this problem is to synchronize on the session internally.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-2456) Repository is corrupt after concurrent changes with the same session

Posted by "Bart van der Schans (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-2456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12802231#action_12802231 ] 

Bart van der Schans commented on JCR-2456:
------------------------------------------

Thanks for the heads up. I will create a new patch for 1.5 based on the patch-2456-b.txt patch. 

> Repository is corrupt after concurrent changes with the same session
> --------------------------------------------------------------------
>
>                 Key: JCR-2456
>                 URL: https://issues.apache.org/jira/browse/JCR-2456
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.5.7, 2.0-beta5
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>             Fix For: 2.0-beta6
>
>         Attachments: patch-2456-1.5.txt, patch-2456-b.txt, patch-2456.txt, TestMultiThread.java
>
>
> After concurrent write operations using the same session, the repository can get corrupt, meaning a ItemNotFoundException is thrown when trying to remove a node.
> Concurrent write operations are not supported, however I believe the persistent state of the repository should not be get corrupt.
> One way to solve this problem is to synchronize on the session internally.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-2456) Repository is corrupt after concurrent changes with the same session

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

Thomas Mueller updated JCR-2456:
--------------------------------

    Attachment: patch-2456.txt

This patch verifies the integrity just before saving
(currently it only verifies that added child nodes actually exist).
This ensures the persistent state is not corrupt.

Also, it closes the session if a ConcurrentModificationException occurs.
This should reduce the likelihood of problems after a session was used
by multiple threads (the internal state of the session is anyway corrupt).

> Repository is corrupt after concurrent changes with the same session
> --------------------------------------------------------------------
>
>                 Key: JCR-2456
>                 URL: https://issues.apache.org/jira/browse/JCR-2456
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.0-beta4
>            Reporter: Thomas Mueller
>         Attachments: patch-2456.txt, TestMultiThread.java
>
>
> After concurrent write operations using the same session, the repository can get corrupt, meaning a ItemNotFoundException is thrown when trying to remove a node.
> Concurrent write operations are not supported, however I believe the persistent state of the repository should not be get corrupt.
> One way to solve this problem is to synchronize on the session internally.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-2456) Repository is corrupt after concurrent changes with the same session

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

Marcel Reutegger commented on JCR-2456:
---------------------------------------

I think those are the child node entries that link from each workspace into the version storage.

Tobi might know more about those and if the current list you have in checkAddedChildNode() is complete. 

> Repository is corrupt after concurrent changes with the same session
> --------------------------------------------------------------------
>
>                 Key: JCR-2456
>                 URL: https://issues.apache.org/jira/browse/JCR-2456
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.5.7, 2.0-beta5
>            Reporter: Thomas Mueller
>         Attachments: patch-2456-1.5.txt, patch-2456-b.txt, patch-2456.txt, TestMultiThread.java
>
>
> After concurrent write operations using the same session, the repository can get corrupt, meaning a ItemNotFoundException is thrown when trying to remove a node.
> Concurrent write operations are not supported, however I believe the persistent state of the repository should not be get corrupt.
> One way to solve this problem is to synchronize on the session internally.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-2456) Repository is corrupt after concurrent changes with the same session

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

Bart van der Schans updated JCR-2456:
-------------------------------------

    Attachment: patch-2456-1.5.txt

backport of patch-2456.txt

> Repository is corrupt after concurrent changes with the same session
> --------------------------------------------------------------------
>
>                 Key: JCR-2456
>                 URL: https://issues.apache.org/jira/browse/JCR-2456
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.5.7
>            Reporter: Thomas Mueller
>         Attachments: patch-2456-1.5.txt, patch-2456.txt, TestMultiThread.java
>
>
> After concurrent write operations using the same session, the repository can get corrupt, meaning a ItemNotFoundException is thrown when trying to remove a node.
> Concurrent write operations are not supported, however I believe the persistent state of the repository should not be get corrupt.
> One way to solve this problem is to synchronize on the session internally.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-2456) Repository is corrupt after concurrent changes with the same session

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

Bart van der Schans updated JCR-2456:
-------------------------------------

    Affects Version/s:     (was: 2.0-beta4)
                       1.5.7
               Status: Patch Available  (was: Open)

> Repository is corrupt after concurrent changes with the same session
> --------------------------------------------------------------------
>
>                 Key: JCR-2456
>                 URL: https://issues.apache.org/jira/browse/JCR-2456
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.5.7
>            Reporter: Thomas Mueller
>         Attachments: patch-2456-1.5.txt, patch-2456.txt, TestMultiThread.java
>
>
> After concurrent write operations using the same session, the repository can get corrupt, meaning a ItemNotFoundException is thrown when trying to remove a node.
> Concurrent write operations are not supported, however I believe the persistent state of the repository should not be get corrupt.
> One way to solve this problem is to synchronize on the session internally.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-2456) Repository is corrupt after concurrent changes with the same session

Posted by "Bart van der Schans (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-2456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12800162#action_12800162 ] 

Bart van der Schans commented on JCR-2456:
------------------------------------------

Running with 1.5 and 10 threads I do see these kind of errors:


javax.jcr.InvalidItemStateException: Item cannot be saved because it has beenmodified externally: node /
java.util.ConcurrentModificationException

I guess these two are expected. And errors like:

javax.jcr.ItemNotFoundException: failed to determine depth of 1d15a661-ad4a-4550-9264-b632f2739dff/{}p23: 1d15a661-ad4a-4550-9264-b632f2739dff/{}p23: 1d15a661-ad4a-4550-9264-b632f2739dff/{}p23
	at org.apache.jackrabbit.core.HierarchyManagerImpl.getDepth(HierarchyManagerImpl.java:492)
	at org.apache.jackrabbit.core.CachingHierarchyManager.getDepth(CachingHierarchyManager.java:259)
	at org.apache.jackrabbit.core.ItemImpl.getDepth(ItemImpl.java:1286)
	at org.apache.jackrabbit.core.ItemImpl.internalRemove(ItemImpl.java:801)
	at org.apache.jackrabbit.core.ItemImpl.remove(ItemImpl.java:909)
	at org.apache.jackrabbit.core.PropertyImpl.setValue(PropertyImpl.java:559)
	at org.apache.jackrabbit.core.NodeImpl.setProperty(NodeImpl.java:2308)
	at org.apache.jackrabbit.core.MultiThreadTest$1.run(MultiThreadTest.java:54)
	at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.jackrabbit.core.state.NoSuchItemStateException: 1d15a661-ad4a-4550-9264-b632f2739dff/{}p23
	at org.apache.jackrabbit.core.state.SessionItemStateManager.getItemState(SessionItemStateManager.java:185)
	at org.apache.jackrabbit.core.HierarchyManagerImpl.getItemState(HierarchyManagerImpl.java:150)
	at org.apache.jackrabbit.core.HierarchyManagerImpl.getDepth(HierarchyManagerImpl.java:480)
	... 8 more



> Repository is corrupt after concurrent changes with the same session
> --------------------------------------------------------------------
>
>                 Key: JCR-2456
>                 URL: https://issues.apache.org/jira/browse/JCR-2456
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.0-beta4
>            Reporter: Thomas Mueller
>         Attachments: patch-2456.txt, TestMultiThread.java
>
>
> After concurrent write operations using the same session, the repository can get corrupt, meaning a ItemNotFoundException is thrown when trying to remove a node.
> Concurrent write operations are not supported, however I believe the persistent state of the repository should not be get corrupt.
> One way to solve this problem is to synchronize on the session internally.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-2456) Repository is corrupt after concurrent changes with the same session

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

Thomas Mueller updated JCR-2456:
--------------------------------

    Affects Version/s: 1.5.7

> Repository is corrupt after concurrent changes with the same session
> --------------------------------------------------------------------
>
>                 Key: JCR-2456
>                 URL: https://issues.apache.org/jira/browse/JCR-2456
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.5.7, 2.0-beta5
>            Reporter: Thomas Mueller
>         Attachments: patch-2456-1.5.txt, patch-2456.txt, TestMultiThread.java
>
>
> After concurrent write operations using the same session, the repository can get corrupt, meaning a ItemNotFoundException is thrown when trying to remove a node.
> Concurrent write operations are not supported, however I believe the persistent state of the repository should not be get corrupt.
> One way to solve this problem is to synchronize on the session internally.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-2456) Repository is corrupt after concurrent changes with the same session

Posted by "Bart van der Schans (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-2456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12800173#action_12800173 ] 

Bart van der Schans commented on JCR-2456:
------------------------------------------

Hi Thomas,

I ran the test with IGNORE_ERRORS to true, but I added a line to print the stacktraces after the  System.out.println(e); in the IGNORE_ERRORS block. 

I do understand the 'real' problem and we have seen that situation on some production servers. But we also do have some custom code to handle virtual nodes which could results in a same kind of error, so I don't want to blame jackrabbit code unjustified ;-)

I've ported the patch to 1.5 (I guess 1.6 isn't that different for these parts of the code) and I don't see the NoSuchItemStateExceptions any more. It does hit the extra check in the EventStateCollection:

javax.jcr.RepositoryException: Unable to update item: node /: Node 1f273949-2dda-45f3-8f30-916424a4de30 must be changed as well.: Node 1f273949-2dda-45f3-8f30-916424a4de30 must be changed as well.
	at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1119)
	at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:858)
	at org.apache.jackrabbit.core.MultiThreadTest$1.run(MultiThreadTest.java:53)
	at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.jackrabbit.core.state.ItemStateException: Node 1f273949-2dda-45f3-8f30-916424a4de30 must be changed as well.
	at org.apache.jackrabbit.core.observation.EventStateCollection.createEventStates(EventStateCollection.java:388)
	at org.apache.jackrabbit.core.state.SharedItemStateManager$Update.begin(SharedItemStateManager.java:694)
	at org.apache.jackrabbit.core.state.SharedItemStateManager.beginUpdate(SharedItemStateManager.java:1106)
	at org.apache.jackrabbit.core.state.SharedItemStateManager.update(SharedItemStateManager.java:1136)
	at org.apache.jackrabbit.core.state.LocalItemStateManager.update(LocalItemStateManager.java:351)
	at org.apache.jackrabbit.core.state.XAItemStateManager.update(XAItemStateManager.java:356)
	at org.apache.jackrabbit.core.state.LocalItemStateManager.update(LocalItemStateManager.java:326)
	at org.apache.jackrabbit.core.state.SessionItemStateManager.update(SessionItemStateManager.java:313)
	at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1113)
	... 3 more




> Repository is corrupt after concurrent changes with the same session
> --------------------------------------------------------------------
>
>                 Key: JCR-2456
>                 URL: https://issues.apache.org/jira/browse/JCR-2456
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.5.7
>            Reporter: Thomas Mueller
>         Attachments: patch-2456-1.5.txt, patch-2456.txt, TestMultiThread.java
>
>
> After concurrent write operations using the same session, the repository can get corrupt, meaning a ItemNotFoundException is thrown when trying to remove a node.
> Concurrent write operations are not supported, however I believe the persistent state of the repository should not be get corrupt.
> One way to solve this problem is to synchronize on the session internally.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-2456) Repository is corrupt after concurrent changes with the same session

Posted by "Bart van der Schans (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-2456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12861799#action_12861799 ] 

Bart van der Schans commented on JCR-2456:
------------------------------------------

The patch also applies to the 1.5 branch.

> Repository is corrupt after concurrent changes with the same session
> --------------------------------------------------------------------
>
>                 Key: JCR-2456
>                 URL: https://issues.apache.org/jira/browse/JCR-2456
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.5.7, 2.0-beta5
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>             Fix For: 2.0-beta6
>
>         Attachments: patch-2456-1.5.txt, patch-2456-b-1.6.txt, patch-2456-b.txt, patch-2456.txt, TestMultiThread.java
>
>
> After concurrent write operations using the same session, the repository can get corrupt, meaning a ItemNotFoundException is thrown when trying to remove a node.
> Concurrent write operations are not supported, however I believe the persistent state of the repository should not be get corrupt.
> One way to solve this problem is to synchronize on the session internally.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-2456) Repository is corrupt after concurrent changes with the same session

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

Bart van der Schans updated JCR-2456:
-------------------------------------

    Attachment: patch-2456-b-1.6.txt

Backport to 1.6 of the updated patch.

> Repository is corrupt after concurrent changes with the same session
> --------------------------------------------------------------------
>
>                 Key: JCR-2456
>                 URL: https://issues.apache.org/jira/browse/JCR-2456
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.5.7, 2.0-beta5
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>             Fix For: 2.0-beta6
>
>         Attachments: patch-2456-1.5.txt, patch-2456-b-1.6.txt, patch-2456-b.txt, patch-2456.txt, TestMultiThread.java
>
>
> After concurrent write operations using the same session, the repository can get corrupt, meaning a ItemNotFoundException is thrown when trying to remove a node.
> Concurrent write operations are not supported, however I believe the persistent state of the repository should not be get corrupt.
> One way to solve this problem is to synchronize on the session internally.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-2456) Repository is corrupt after concurrent changes with the same session

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

Thomas Mueller updated JCR-2456:
--------------------------------

          Component/s: jackrabbit-core
    Affects Version/s: 2.0-beta4

> Repository is corrupt after concurrent changes with the same session
> --------------------------------------------------------------------
>
>                 Key: JCR-2456
>                 URL: https://issues.apache.org/jira/browse/JCR-2456
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.0-beta4
>            Reporter: Thomas Mueller
>         Attachments: TestMultiThread.java
>
>
> After concurrent write operations using the same session, the repository can get corrupt, meaning a ItemNotFoundException is thrown when trying to remove a node.
> Concurrent write operations are not supported, however I believe the persistent state of the repository should not be get corrupt.
> One way to solve this problem is to synchronize on the session internally.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-2456) Repository is corrupt after concurrent changes with the same session

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

Marcel Reutegger commented on JCR-2456:
---------------------------------------

What's the performance impact of this patch? E.g. how much time does it take to save 1k added nodes with / without this patch?

> Repository is corrupt after concurrent changes with the same session
> --------------------------------------------------------------------
>
>                 Key: JCR-2456
>                 URL: https://issues.apache.org/jira/browse/JCR-2456
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.0-beta4
>            Reporter: Thomas Mueller
>         Attachments: patch-2456.txt, TestMultiThread.java
>
>
> After concurrent write operations using the same session, the repository can get corrupt, meaning a ItemNotFoundException is thrown when trying to remove a node.
> Concurrent write operations are not supported, however I believe the persistent state of the repository should not be get corrupt.
> One way to solve this problem is to synchronize on the session internally.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-2456) Repository is corrupt after concurrent changes with the same session

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

Jukka Zitting updated JCR-2456:
-------------------------------

    Fix Version/s: core 1.4.12
                   1.6.2

I committed the backported patch to the 1.6 branch in revision 948488 and backported/merged the changes further to the 1.4 branch in revision 948495.

> Repository is corrupt after concurrent changes with the same session
> --------------------------------------------------------------------
>
>                 Key: JCR-2456
>                 URL: https://issues.apache.org/jira/browse/JCR-2456
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.5.7, 2.0-beta5
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>             Fix For: core 1.4.12, 1.6.2, 2.0-beta6
>
>         Attachments: patch-2456-1.5.txt, patch-2456-b-1.6.txt, patch-2456-b.txt, patch-2456.txt, TestMultiThread.java
>
>
> After concurrent write operations using the same session, the repository can get corrupt, meaning a ItemNotFoundException is thrown when trying to remove a node.
> Concurrent write operations are not supported, however I believe the persistent state of the repository should not be get corrupt.
> One way to solve this problem is to synchronize on the session internally.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-2456) Repository is corrupt after concurrent changes with the same session

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

Thomas Mueller updated JCR-2456:
--------------------------------

    Attachment: patch-2456-b.txt

My original patch broke some version manager tests (for example org.apache.jackrabbit.test.api.version.ConfigurationsTest.testConfigurationsPath). I just  made the test pass, and didn't try to understand what this test does exactly, and why the VersionManagerImpl does seem to store non-existing child nodes.

Unless somebody objects, I will commit this patch later today.

> Repository is corrupt after concurrent changes with the same session
> --------------------------------------------------------------------
>
>                 Key: JCR-2456
>                 URL: https://issues.apache.org/jira/browse/JCR-2456
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.5.7, 2.0-beta5
>            Reporter: Thomas Mueller
>         Attachments: patch-2456-1.5.txt, patch-2456-b.txt, patch-2456.txt, TestMultiThread.java
>
>
> After concurrent write operations using the same session, the repository can get corrupt, meaning a ItemNotFoundException is thrown when trying to remove a node.
> Concurrent write operations are not supported, however I believe the persistent state of the repository should not be get corrupt.
> One way to solve this problem is to synchronize on the session internally.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-2456) Repository is corrupt after concurrent changes with the same session

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

Thomas Mueller updated JCR-2456:
--------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0-beta6
         Assignee: Thomas Mueller
           Status: Resolved  (was: Patch Available)

According to Tobi, the three nodes (VERSION_STORAGE_NODE_ID, ACTIVITIES_NODE_ID, NODETYPES_NODE_ID) are the only (virtual) child nodes that may exist. So this is fixed.

> Repository is corrupt after concurrent changes with the same session
> --------------------------------------------------------------------
>
>                 Key: JCR-2456
>                 URL: https://issues.apache.org/jira/browse/JCR-2456
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.5.7, 2.0-beta5
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>             Fix For: 2.0-beta6
>
>         Attachments: patch-2456-1.5.txt, patch-2456-b.txt, patch-2456.txt, TestMultiThread.java
>
>
> After concurrent write operations using the same session, the repository can get corrupt, meaning a ItemNotFoundException is thrown when trying to remove a node.
> Concurrent write operations are not supported, however I believe the persistent state of the repository should not be get corrupt.
> One way to solve this problem is to synchronize on the session internally.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-2456) Repository is corrupt after concurrent changes with the same session

Posted by "Bart van der Schans (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-2456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12800153#action_12800153 ] 

Bart van der Schans commented on JCR-2456:
------------------------------------------

Could the same problem also exist in 1.5 and 1.6? We have seen sometimes messages about missing child nodes with the consistencyCheck with 1.5.

> Repository is corrupt after concurrent changes with the same session
> --------------------------------------------------------------------
>
>                 Key: JCR-2456
>                 URL: https://issues.apache.org/jira/browse/JCR-2456
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.0-beta4
>            Reporter: Thomas Mueller
>         Attachments: patch-2456.txt, TestMultiThread.java
>
>
> After concurrent write operations using the same session, the repository can get corrupt, meaning a ItemNotFoundException is thrown when trying to remove a node.
> Concurrent write operations are not supported, however I believe the persistent state of the repository should not be get corrupt.
> One way to solve this problem is to synchronize on the session internally.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-2456) Repository is corrupt after concurrent changes with the same session

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

Thomas Mueller commented on JCR-2456:
-------------------------------------

According to my test, it didn't have a measurable effect.

I have committed a simple benchmark in revision 899102.
(my idea is to extend it in the future, and then to run it as part of the integration test;
but I didn't add it yet because running the test without checking the result doesn't make sense).

The result is:
run: 4; time: 1270 ms; task: addNodes (without patch)
run: 4; time: 1245 ms; task: addNodes (with patch)
(the difference is within the margin of error; sometimes it's faster sometimes slower)

I guess the only part that could measurable affect performance is 
SharedItemStateManager.checkAddedChildNode, specially persistMgr.exists. 
It was never called for my test case (when running in debug mode), because
the added node always was in the cache.


> Repository is corrupt after concurrent changes with the same session
> --------------------------------------------------------------------
>
>                 Key: JCR-2456
>                 URL: https://issues.apache.org/jira/browse/JCR-2456
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.0-beta4
>            Reporter: Thomas Mueller
>         Attachments: patch-2456.txt, TestMultiThread.java
>
>
> After concurrent write operations using the same session, the repository can get corrupt, meaning a ItemNotFoundException is thrown when trying to remove a node.
> Concurrent write operations are not supported, however I believe the persistent state of the repository should not be get corrupt.
> One way to solve this problem is to synchronize on the session internally.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-2456) Repository is corrupt after concurrent changes with the same session

Posted by "Bart van der Schans (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-2456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12800211#action_12800211 ] 

Bart van der Schans commented on JCR-2456:
------------------------------------------

Running with 2 threads with different sessions and the same node I do see the following error with the patch applied to 1.5:

org.apache.jackrabbit.core.state.ItemStateException: Trying to add a non-existing child node: b89abbae-4929-42ec-972e-4d60b51e27d1
	at org.apache.jackrabbit.core.state.SharedItemStateManager$Update.checkAddedChildNode(SharedItemStateManager.java:988)
	at org.apache.jackrabbit.core.state.SharedItemStateManager$Update.checkAddedChildNodes(SharedItemStateManager.java:971)
	at org.apache.jackrabbit.core.state.SharedItemStateManager$Update.begin(SharedItemStateManager.java:575)
	at org.apache.jackrabbit.core.state.SharedItemStateManager.beginUpdate(SharedItemStateManager.java:1106)
	at org.apache.jackrabbit.core.state.SharedItemStateManager.update(SharedItemStateManager.java:1136)
	at org.apache.jackrabbit.core.state.LocalItemStateManager.update(LocalItemStateManager.java:351)
	at org.apache.jackrabbit.core.state.XAItemStateManager.update(XAItemStateManager.java:356)
	at org.apache.jackrabbit.core.state.LocalItemStateManager.update(LocalItemStateManager.java:326)
	at org.apache.jackrabbit.core.state.SessionItemStateManager.update(SessionItemStateManager.java:313)
	at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1113)
	at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:858)
	at org.apache.jackrabbit.core.MultiThreadTest$1.run(MultiThreadTest.java:58)
	at java.lang.Thread.run(Thread.java:619)

So it looks like the patch prevents the persistent state from getting corrupt.



> Repository is corrupt after concurrent changes with the same session
> --------------------------------------------------------------------
>
>                 Key: JCR-2456
>                 URL: https://issues.apache.org/jira/browse/JCR-2456
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.0-beta5
>            Reporter: Thomas Mueller
>         Attachments: patch-2456-1.5.txt, patch-2456.txt, TestMultiThread.java
>
>
> After concurrent write operations using the same session, the repository can get corrupt, meaning a ItemNotFoundException is thrown when trying to remove a node.
> Concurrent write operations are not supported, however I believe the persistent state of the repository should not be get corrupt.
> One way to solve this problem is to synchronize on the session internally.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-2456) Repository is corrupt after concurrent changes with the same session

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

Thomas Mueller updated JCR-2456:
--------------------------------

    Affects Version/s:     (was: 1.5.7)
                       2.0-beta5

> Repository is corrupt after concurrent changes with the same session
> --------------------------------------------------------------------
>
>                 Key: JCR-2456
>                 URL: https://issues.apache.org/jira/browse/JCR-2456
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.0-beta5
>            Reporter: Thomas Mueller
>         Attachments: patch-2456-1.5.txt, patch-2456.txt, TestMultiThread.java
>
>
> After concurrent write operations using the same session, the repository can get corrupt, meaning a ItemNotFoundException is thrown when trying to remove a node.
> Concurrent write operations are not supported, however I believe the persistent state of the repository should not be get corrupt.
> One way to solve this problem is to synchronize on the session internally.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-2456) Repository is corrupt after concurrent changes with the same session

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

Thomas Mueller commented on JCR-2456:
-------------------------------------

The patch for 1.5 (if still needed) is out of date now (it does not deal with the three system nodes).
The ConfigurationsTest should fail if the patch is applied.

> Repository is corrupt after concurrent changes with the same session
> --------------------------------------------------------------------
>
>                 Key: JCR-2456
>                 URL: https://issues.apache.org/jira/browse/JCR-2456
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.5.7, 2.0-beta5
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>             Fix For: 2.0-beta6
>
>         Attachments: patch-2456-1.5.txt, patch-2456-b.txt, patch-2456.txt, TestMultiThread.java
>
>
> After concurrent write operations using the same session, the repository can get corrupt, meaning a ItemNotFoundException is thrown when trying to remove a node.
> Concurrent write operations are not supported, however I believe the persistent state of the repository should not be get corrupt.
> One way to solve this problem is to synchronize on the session internally.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-2456) Repository is corrupt after concurrent changes with the same session

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

Thomas Mueller commented on JCR-2456:
-------------------------------------

To verify what versions are affected, just run the test case with the specific version.
I only ran it with CRX 2.0 so far.

> Repository is corrupt after concurrent changes with the same session
> --------------------------------------------------------------------
>
>                 Key: JCR-2456
>                 URL: https://issues.apache.org/jira/browse/JCR-2456
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.0-beta4
>            Reporter: Thomas Mueller
>         Attachments: patch-2456.txt, TestMultiThread.java
>
>
> After concurrent write operations using the same session, the repository can get corrupt, meaning a ItemNotFoundException is thrown when trying to remove a node.
> Concurrent write operations are not supported, however I believe the persistent state of the repository should not be get corrupt.
> One way to solve this problem is to synchronize on the session internally.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-2456) Repository is corrupt after concurrent changes with the same session

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

Thomas Mueller updated JCR-2456:
--------------------------------

    Attachment: TestMultiThread.java

> Repository is corrupt after concurrent changes with the same session
> --------------------------------------------------------------------
>
>                 Key: JCR-2456
>                 URL: https://issues.apache.org/jira/browse/JCR-2456
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.0-beta4
>            Reporter: Thomas Mueller
>         Attachments: TestMultiThread.java
>
>
> After concurrent write operations using the same session, the repository can get corrupt, meaning a ItemNotFoundException is thrown when trying to remove a node.
> Concurrent write operations are not supported, however I believe the persistent state of the repository should not be get corrupt.
> One way to solve this problem is to synchronize on the session internally.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.