Issue Details (XML | Word | Printable)

Key: JCR-18
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Tobias Bocanegra
Reporter: Felix Meschberger
Votes: 2
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Jackrabbit Content Repository

Multithreading issue with versioning

Created: 10/Nov/04 09:27 PM   Updated: 08/Oct/07 10:47 AM
Return to search
Component/s: versioning
Affects Version/s: 0.9, 1.0, 1.0.1, 1.1, 1.1.1, 1.2.1, 1.2.2, 1.2.3, 1.3, 1.3.1
Fix Version/s: 1.3.3

Time Tracking:
Not Specified

Environment: Jackrabbit SVN Rev. 56918
Issue Links:
Reference

Resolution Date: 26/Jun/07 08:01 AM


 Description  « Hide
In a multithreading environment with two or more threads accessing the same version history, inconsistent state may be encountered. Concretely, the first thread is currently checking in the node to which the version history is attached while the second thread walks this same version history by means of a "self-built" iterator, which just accesses the successors of each version to get the "next" to visit.

At a certain point the second point may encounter an ItemNotFoundException with a stack trace similar to this:

javax.jcr.ItemNotFoundException: c9bd405b-dff4-46ef-845c-d98e073e473a
        at org.apache.jackrabbit.core.ItemManager.createItemInstance(ItemManager.java:354)
        at org.apache.jackrabbit.core.ItemManager.getItem(ItemManager.java:230)
        at org.apache.jackrabbit.core.SessionImpl.getNodeByUUID(SessionImpl.java:494)
        at org.apache.jackrabbit.core.version.VersionImpl.getSuccessors(VersionImpl.java:86)
        ....

It seems that the first thread has already filled the successor of the version, while the node is not yet accessible by the createItemInstance method.

This bug seems to not be enforcible, but it is easily reproducible.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Tobias Bocanegra made changes - 11/Nov/04 02:42 PM
Field Original Value New Value
Assignee Tobias Strasser [ tripod ]
Tobias Bocanegra added a comment - 11/Nov/04 02:44 PM
i must admit that i took no care about multihtreading until now. but of course i will do it now.

Repository Revision Date User Message
ASF #76106 Wed Nov 17 10:00:58 UTC 2004 tripod - JCR-17 Creating and saving a mix:versionable node creates two VersionHistory nodes
- JCR-18 Multithreading issue with versioning
Files Changed
MODIFY /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManager.java
MODIFY /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.xml
MODIFY /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionIteratorImpl.java
MODIFY /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
MODIFY /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/InternalFrozenNode.java
MODIFY /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java
MODIFY /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/PersistentVersionManager.java
MODIFY /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java
MODIFY /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/virtual/DefaultItemStateProvider.java
MODIFY /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/InternalVersionHistory.java

Tobias Bocanegra added a comment - 17/Nov/04 10:02 AM
fixed at revision 76106

Tobias Bocanegra made changes - 17/Nov/04 10:02 AM
Resolution Fixed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
Felix Meschberger added a comment - 19/Nov/04 02:19 PM
Sorry, to say this, but the issue is only partly solved. While it occurrs less frequently than before it still occurrs.

Again, I get the same exception at the same place at a moment where another thread is currently checkin, which modifies the successors of while the referred-to node is not (yet?) accessible.

Here is the stack of the other thread:
   Thread [--some undisclosed name--] (Suspended)
      BDbPersistenceManager.load(NodeReferences) line: 398
      ReferenceManager.get(NodeId) line: 62
      PropertyImpl(ItemImpl).checkReferences(Iterator, Iterator, ReferenceManager) line: 635
      PropertyImpl(ItemImpl).save() line: 1132
      NodeImpl.checkin() line: 2004
      ...

Tobias Bocanegra added a comment - 19/Nov/04 02:46 PM
will investigage

Tobias Bocanegra made changes - 19/Nov/04 02:46 PM
Resolution Fixed [ 1 ]
Status Resolved [ 5 ] Reopened [ 4 ]
Felix Meschberger added a comment - 19/Nov/04 02:53 PM
Sorry again: My previous remark on "less frequently" is completely wrong. It occurrs as often as before :-(

Roy T. Fielding made changes - 13/Mar/05 04:45 AM
Component/s versioning [ 11612 ]
Jukka Zitting made changes - 30/Jun/05 11:10 PM
Description In a multithreading environment with two or more threads accessing the same version history, inconsistent state may be encountered. Concretely, the first thread is currently checking in the node to which the version history is attached while the second thread walks this same version history by means of a "self-built" iterator, which just accesses the successors of each version to get the "next" to visit.

At a certain point the second point may encounter an ItemNotFoundException with a stack trace similar to this:

javax.jcr.ItemNotFoundException: c9bd405b-dff4-46ef-845c-d98e073e473a
        at org.apache.jackrabbit.core.ItemManager.createItemInstance(ItemManager.java:354)
        at org.apache.jackrabbit.core.ItemManager.getItem(ItemManager.java:230)
        at org.apache.jackrabbit.core.SessionImpl.getNodeByUUID(SessionImpl.java:494)
        at org.apache.jackrabbit.core.version.VersionImpl.getSuccessors(VersionImpl.java:86)
        ....

It seems that the first thread has already filled the successor of the version, while the node is not yet accessible by the createItemInstance method.

This bug seems to not be enforcible, but it is easily reproducible.
In a multithreading environment with two or more threads accessing the same version history, inconsistent state may be encountered. Concretely, the first thread is currently checking in the node to which the version history is attached while the second thread walks this same version history by means of a "self-built" iterator, which just accesses the successors of each version to get the "next" to visit.

At a certain point the second point may encounter an ItemNotFoundException with a stack trace similar to this:

javax.jcr.ItemNotFoundException: c9bd405b-dff4-46ef-845c-d98e073e473a
        at org.apache.jackrabbit.core.ItemManager.createItemInstance(ItemManager.java:354)
        at org.apache.jackrabbit.core.ItemManager.getItem(ItemManager.java:230)
        at org.apache.jackrabbit.core.SessionImpl.getNodeByUUID(SessionImpl.java:494)
        at org.apache.jackrabbit.core.version.VersionImpl.getSuccessors(VersionImpl.java:86)
        ....

It seems that the first thread has already filled the successor of the version, while the node is not yet accessible by the createItemInstance method.

This bug seems to not be enforcible, but it is easily reproducible.
Fix Version/s 1.0 [ 12310154 ]
Jukka Zitting made changes - 30/Jun/05 11:14 PM
Link This issue relates to JCR-140 [ JCR-140 ]
Jukka Zitting made changes - 07/Mar/06 03:32 PM
Fix Version/s 1.0 [ 12310154 ]
Fix Version/s 1.1 [ 12310346 ]
Jukka Zitting made changes - 21/Mar/06 06:26 AM
Affects Version/s 1.0 [ 12310154 ]
Affects Version/s 0.9 [ 12310719 ]
Jukka Zitting added a comment - 31/May/06 03:36 PM
Fixing issue JCR-443 seems to have fixed a few other concurrent versioning problems. Is this issue also fixed by JCR-443?

Jukka Zitting made changes - 17/Sep/06 10:04 PM
Fix Version/s 1.1 [ 12310346 ]
Stefan Guggisberg made changes - 21/Feb/07 01:26 PM
Link This issue relates to JCR-754 [ JCR-754 ]
Stefan Guggisberg made changes - 14/Mar/07 12:11 PM
Link This issue is related to JCR-790 [ JCR-790 ]
Bertrand Delacretaz made changes - 05/Jun/07 10:29 AM
Link This issue is related to JCR-962 [ JCR-962 ]
Jukka Zitting made changes - 25/Jun/07 02:36 PM
Comment [ This seems to be related to JCR-18 ]
Repository Revision Date User Message
ASF #550724 Tue Jun 26 07:59:00 UTC 2007 mreutegg JCR-18: Multithreading issue with versioning
- test case
Files Changed
ADD /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ReadVersionsWhileModified.java

Marcel Reutegger added a comment - 26/Jun/07 07:59 AM
Added a test case for this issue:

jackrabbit-core\src\test\java\org\apache\jackrabbit\core\ReadVersionsWhileModified.java

At revision: 550724

Marcel Reutegger added a comment - 26/Jun/07 08:01 AM
The test runs without deadlock or errors. I will therefore set this issue to fixed.

Marcel Reutegger made changes - 26/Jun/07 08:01 AM
Status Reopened [ 4 ] Resolved [ 5 ]
Fix Version/s 1.4 [ 12312447 ]
Resolution Fixed [ 1 ]
Jukka Zitting made changes - 20/Jul/07 09:10 PM
Affects Version/s 1.1.1 [ 12312099 ]
Affects Version/s 1.3.1 [ 12312512 ]
Affects Version/s 1.2.1 [ 12312100 ]
Affects Version/s 1.1 [ 12310346 ]
Affects Version/s 1.2.3 [ 12312329 ]
Affects Version/s 1.3 [ 12312229 ]
Affects Version/s 1.2.2 [ 12312228 ]
Affects Version/s 1.0.1 [ 12310345 ]
Repository Revision Date User Message
ASF #581178 Tue Oct 02 10:03:04 UTC 2007 jukka 1.3: Merged revision 550724 (JCR-18)
Files Changed
ADD /jackrabbit/branches/1.3/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ReadVersionsWhileModified.java (from /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ReadVersionsWhileModified.java)

Jukka Zitting added a comment - 02/Oct/07 10:03 AM
Merged to the 1.3 branch in revision 581178.

Jukka Zitting made changes - 02/Oct/07 10:03 AM
Fix Version/s 1.4 [ 12312447 ]
Fix Version/s 1.3.2 [ 12312770 ]
Jukka Zitting made changes - 08/Oct/07 10:47 AM
Status Resolved [ 5 ] Closed [ 6 ]
Jukka Zitting made changes - 07/Jul/09 01:03 PM
Workflow jira [ 38320 ] no-reopen-closed, patch-avail [ 12468905 ]