You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Florent Guillaume <fg...@nuxeo.com> on 2006/09/07 18:25:36 UTC

Versioning bug with restore and transactions

I'm posting here because at the moment I can't login to Jira (seems  
my account was reset or something, and "forgotten password" seems to  
send email by pigeon carrier).

I have a versioning bug in the presence of transactions. It's hard to  
reproduce and seems memory-layout dependent.
At the moment I only have a jython testcase, see below. This is with  
a svn checkout from today.
If developers can't mirror that in a pure java testcase I'll try to  
do that myself, but I wanted to get the info out asap.
Basically the program does create a node and subnode and do some  
checkins, checkouts, restore, modifications, in successive transactions.

The program log and stack trace is:

start 1
node a44e6556-728d-4970-a635-5ff7d2a38f2f
commit 1
start 2
commit 2
start 3
commit 3
javax.transaction.xa.XAException
         at org.apache.jackrabbit.core.TransactionContext.prepare 
(TransactionContext.java:138)
         at org.apache.jackrabbit.core.XASessionImpl.commit 
(XASessionImpl.java:313)
         File "debug1.py", line 126, in doit
         File "debug1.py", line 159, in ?
Caused by: org.apache.jackrabbit.core.TransactionException: Unable to  
prepare transaction.
         at  
org.apache.jackrabbit.core.state.XAItemStateManager.prepare 
(XAItemStateManager.java:159)
         at org.apache.jackrabbit.core.TransactionContext.prepare 
(TransactionContext.java:121)
         ... 22 more
Caused by: org.apache.jackrabbit.core.state.StaleItemStateException:  
a44e6556-728d-4970-a635-5ff7d2a38f2f/{http://www.jcp.org/jcr/1.0} 
isCheckedOut has been modified externally
         at org.apache.jackrabbit.core.state.SharedItemStateManager 
$Update.begin(SharedItemStateManager.java:546)
         at  
org.apache.jackrabbit.core.state.SharedItemStateManager.beginUpdate 
(SharedItemStateManager.java:717)
         at  
org.apache.jackrabbit.core.state.XAItemStateManager.prepare 
(XAItemStateManager.java:151)
         ... 23 more
javax.transaction.xa.XAException: javax.transaction.xa.XAException

Note that the mentionned property (here, isCheckedOut) has changed  
when I was cutting down on the program size to get a simpler  
testcase. It's not necessarily a "system" property, and sometimes it  
was property of the subnode created under the main node.

Test program is attached.
I'm using java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-112)
Java HotSpot(TM) Client VM (build 1.5.0_06-64, mixed mode, sharing)

Any feedback welcome.

Florent


Re: Versioning bug with restore and transactions

Posted by Florent Guillaume <fg...@nuxeo.com>.
Florent Guillaume wrote:
> Florent Guillaume wrote:
>> Tobias Bocanegra wrote:
>>> you can't use the xaresource directly
>>
>> Why? I'm using an API that's legitimate and public.
>>
>>> you need to create a user transaction.
>>
>> I'm the sole user of Jackrabbit and the transactions here. Behind the 
>> scene, a user transaction does exactly what I do: xaresource.start() 
>> with the proper arguments, do some work then end() it and commit() it. 
>> Jackrabbit's 
>> test/java/org/apache/jackrabbit/core/UserTransactionImpl.java is 
>> pretty simple.
>>
>>> and you can use the transaction only once.
>>
>> I've updated my code to use different xid instances for each 
>> transaction, and it still crashes. Updated jython code attached.
> 
> Hm ok it may be a problem with how my DummyXid class manages its 
> globalTxId.
> I'll implement a proper one and see what it gives.

Even with cannonical xid management I've still got a crash (even earlier 
than before, on the 3rd transaction).

I've opened http://issues.apache.org/jira/browse/JCR-566 let's keep 
discussing there.

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)   Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   fg@nuxeo.com

Re: Versioning bug with restore and transactions

Posted by Florent Guillaume <fg...@nuxeo.com>.
Florent Guillaume wrote:
> Tobias Bocanegra wrote:
>> you can't use the xaresource directly
> 
> Why? I'm using an API that's legitimate and public.
> 
>> you need to create a user transaction.
> 
> I'm the sole user of Jackrabbit and the transactions here. Behind the 
> scene, a user transaction does exactly what I do: xaresource.start() 
> with the proper arguments, do some work then end() it and commit() it. 
> Jackrabbit's 
> test/java/org/apache/jackrabbit/core/UserTransactionImpl.java is pretty 
> simple.
> 
>> and you can use the transaction only once.
> 
> I've updated my code to use different xid instances for each 
> transaction, and it still crashes. Updated jython code attached.

Hm ok it may be a problem with how my DummyXid class manages its globalTxId.
I'll implement a proper one and see what it gives.

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)   Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   fg@nuxeo.com

Re: Versioning bug with restore and transactions

Posted by Florent Guillaume <fg...@nuxeo.com>.
Tobias Bocanegra wrote:
> you can't use the xaresource directly

Why? I'm using an API that's legitimate and public.

> you need to create a user transaction.

I'm the sole user of Jackrabbit and the transactions here. Behind the scene, 
a user transaction does exactly what I do: xaresource.start() with the 
proper arguments, do some work then end() it and commit() it. Jackrabbit's 
test/java/org/apache/jackrabbit/core/UserTransactionImpl.java is pretty simple.

> and you can use the transaction only once.

I've updated my code to use different xid instances for each transaction, 
and it still crashes. Updated jython code attached.

Thanks for looking into this. I'll open a JIRA issue now that I've received 
my updated password.

Florent


> regards, toby
> 
> On 9/7/06, Florent Guillaume <fg...@nuxeo.com> wrote:
>> I'm posting here because at the moment I can't login to Jira (seems
>> my account was reset or something, and "forgotten password" seems to
>> send email by pigeon carrier).
>>
>> I have a versioning bug in the presence of transactions. It's hard to
>> reproduce and seems memory-layout dependent.
>> At the moment I only have a jython testcase, see below. This is with
>> a svn checkout from today.
>> If developers can't mirror that in a pure java testcase I'll try to
>> do that myself, but I wanted to get the info out asap.
>> Basically the program does create a node and subnode and do some
>> checkins, checkouts, restore, modifications, in successive transactions.
>>
>> The program log and stack trace is:
>>
>> start 1
>> node a44e6556-728d-4970-a635-5ff7d2a38f2f
>> commit 1
>> start 2
>> commit 2
>> start 3
>> commit 3
>> javax.transaction.xa.XAException
>>          at org.apache.jackrabbit.core.TransactionContext.prepare
>> (TransactionContext.java:138)
>>          at org.apache.jackrabbit.core.XASessionImpl.commit
>> (XASessionImpl.java:313)
>>          File "debug1.py", line 126, in doit
>>          File "debug1.py", line 159, in ?
>> Caused by: org.apache.jackrabbit.core.TransactionException: Unable to
>> prepare transaction.
>>          at
>> org.apache.jackrabbit.core.state.XAItemStateManager.prepare
>> (XAItemStateManager.java:159)
>>          at org.apache.jackrabbit.core.TransactionContext.prepare
>> (TransactionContext.java:121)
>>          ... 22 more
>> Caused by: org.apache.jackrabbit.core.state.StaleItemStateException:
>> a44e6556-728d-4970-a635-5ff7d2a38f2f/{http://www.jcp.org/jcr/1.0}
>> isCheckedOut has been modified externally
>>          at org.apache.jackrabbit.core.state.SharedItemStateManager
>> $Update.begin(SharedItemStateManager.java:546)
>>          at
>> org.apache.jackrabbit.core.state.SharedItemStateManager.beginUpdate
>> (SharedItemStateManager.java:717)
>>          at
>> org.apache.jackrabbit.core.state.XAItemStateManager.prepare
>> (XAItemStateManager.java:151)
>>          ... 23 more
>> javax.transaction.xa.XAException: javax.transaction.xa.XAException
>>
>> Note that the mentionned property (here, isCheckedOut) has changed
>> when I was cutting down on the program size to get a simpler
>> testcase. It's not necessarily a "system" property, and sometimes it
>> was property of the subnode created under the main node.
>>
>> Test program is attached.
>> I'm using java version "1.5.0_06"
>> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-112)
>> Java HotSpot(TM) Client VM (build 1.5.0_06-64, mixed mode, sharing)
>>
>> Any feedback welcome.
>>
>> Florent
>>
>>
>>
>>
>> -- 
>> Florent Guillaume, Nuxeo (Paris, France)   Director of R&D
>> +33 1 40 33 71 59   http://nuxeo.com   fg@nuxeo.com
>>
>>
>>
>>
>>
>>
> 
> 


-- 
Florent Guillaume, Nuxeo (Paris, France)   Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   fg@nuxeo.com

Re: Versioning bug with restore and transactions

Posted by Tobias Bocanegra <to...@day.com>.
you can't use the xaresource directly, you need to create a user
transaction. and you can use the transaction only once.

regards, toby

On 9/7/06, Florent Guillaume <fg...@nuxeo.com> wrote:
> I'm posting here because at the moment I can't login to Jira (seems
> my account was reset or something, and "forgotten password" seems to
> send email by pigeon carrier).
>
> I have a versioning bug in the presence of transactions. It's hard to
> reproduce and seems memory-layout dependent.
> At the moment I only have a jython testcase, see below. This is with
> a svn checkout from today.
> If developers can't mirror that in a pure java testcase I'll try to
> do that myself, but I wanted to get the info out asap.
> Basically the program does create a node and subnode and do some
> checkins, checkouts, restore, modifications, in successive transactions.
>
> The program log and stack trace is:
>
> start 1
> node a44e6556-728d-4970-a635-5ff7d2a38f2f
> commit 1
> start 2
> commit 2
> start 3
> commit 3
> javax.transaction.xa.XAException
>          at org.apache.jackrabbit.core.TransactionContext.prepare
> (TransactionContext.java:138)
>          at org.apache.jackrabbit.core.XASessionImpl.commit
> (XASessionImpl.java:313)
>          File "debug1.py", line 126, in doit
>          File "debug1.py", line 159, in ?
> Caused by: org.apache.jackrabbit.core.TransactionException: Unable to
> prepare transaction.
>          at
> org.apache.jackrabbit.core.state.XAItemStateManager.prepare
> (XAItemStateManager.java:159)
>          at org.apache.jackrabbit.core.TransactionContext.prepare
> (TransactionContext.java:121)
>          ... 22 more
> Caused by: org.apache.jackrabbit.core.state.StaleItemStateException:
> a44e6556-728d-4970-a635-5ff7d2a38f2f/{http://www.jcp.org/jcr/1.0}
> isCheckedOut has been modified externally
>          at org.apache.jackrabbit.core.state.SharedItemStateManager
> $Update.begin(SharedItemStateManager.java:546)
>          at
> org.apache.jackrabbit.core.state.SharedItemStateManager.beginUpdate
> (SharedItemStateManager.java:717)
>          at
> org.apache.jackrabbit.core.state.XAItemStateManager.prepare
> (XAItemStateManager.java:151)
>          ... 23 more
> javax.transaction.xa.XAException: javax.transaction.xa.XAException
>
> Note that the mentionned property (here, isCheckedOut) has changed
> when I was cutting down on the program size to get a simpler
> testcase. It's not necessarily a "system" property, and sometimes it
> was property of the subnode created under the main node.
>
> Test program is attached.
> I'm using java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-112)
> Java HotSpot(TM) Client VM (build 1.5.0_06-64, mixed mode, sharing)
>
> Any feedback welcome.
>
> Florent
>
>
>
>
> --
> Florent Guillaume, Nuxeo (Paris, France)   Director of R&D
> +33 1 40 33 71 59   http://nuxeo.com   fg@nuxeo.com
>
>
>
>
>
>


-- 
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---