jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Köll (JIRA) <j...@apache.org>
Subject [jira] Commented: (JCR-769) Unable to login with two different Credentials to same workspace in one Transaction
Date Wed, 14 Mar 2007 07:13:09 GMT

    [ https://issues.apache.org/jira/browse/JCR-769?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12480674
] 

Claus Köll commented on JCR-769:
--------------------------------

I agree with you that is it not good to acquire a second session through JCA in the AccessManager.
I have already changed my code (without a session in my accessmanager) a few days before and
now i have not anymore problems with the xa transaction.
Although i have tested the behaviour with two sessions in one transaction because i think
the current implemention can not work with two sessions in one transaction
concerning more factors.

The first is that the WorkspaceInfo acquires a exclusiv lock. As you can see on the above
trace that i have only one transactioncontext object involved in the transaction
but this solves not the problem because every session gets prepared and so the workspaceinfo
object will be prepared two times !

The second thing is the XID in combination with the txGlobal Map.
I have read the specification and as you say we can not ignore the branch id. As i understand
the branchid it is used to differentiate the xaresources in one distributed transaction.
In our use case the 2 xasessionimpl's are these branches and so they can not be the same.
So you will never find a TransactionContext Object with the XID as Key in  the txGlobal Map
in a global Transaction.
I have found a good documentation about the use of branches (http://download-west.oracle.com/docs/cd/B10501_01/java.920/a96654/xadistra.htm)
As they write
[When you use XA functionality, the transaction manager uses XA resource instances to prepare
and coordinate each transaction branch and then to commit or roll back all transaction branches
appropriately] 
or
[The "prepare" step is the first step of a two-phase COMMIT operation. The transaction manager
will issue a prepare to each XA resource instance. Once the transaction manager sees that
the operations of each transaction branch have prepared successfully, it will issue a COMMIT
to each XA resource instance to commit all the changes]

The XASessionImpl implements the XAResource so it is a branch or not ?

In the specification under 4.2 is written
[The only requirement is that both gtrid and bqual, taken together, must be globally unique.]

So maybe i am wrong otherwise please tell me how you see that things

> Unable to login with two different Credentials to same workspace in one Transaction
> -----------------------------------------------------------------------------------
>
>                 Key: JCR-769
>                 URL: https://issues.apache.org/jira/browse/JCR-769
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jca
>    Affects Versions: 1.2.1
>         Environment: Websphere 5.1.1 J2C Adapter
>            Reporter: Claus Köll
>         Attachments: patch.txt, stacktrace.txt
>
>
> I'm using the Jackrabbit 1.2.1 JCA adapter and trying to access in a SessionBean-Method
with Container Transaction a Workspace with 2 different Credentials. 
> The Method takes about 400ms to finish but no commit on TransactionContextr occurs (Debugging
..) only the prepare was called 2 times .
> The Container hangs on the PostInvoke Method about 5 seconds and then i get a "javax.transaction.xa.XAException"

> with the Warn Message: Transaction rolled back because timeout expired
> The code ..
> Context ctx = new InitialContext(); 
> Repository repository = (Repository) ctx.lookup("java:comp/env/jackrabbit"); 
> Credentials credentials = new SimpleCredentials("user1", "password1".toCharArray());

> Credentials credentials2 = new SimpleCredentials("user2", "password2".toCharArray());

> Session session1 = repository.login(credentials, "default"); 
> Session session2 = repository.login(credentials2, "default"); 
> Session1 adds a node to the workspace .. and with the session2 i do nothing except the
login !
> If i make no second login the Method works fine.

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


Mime
View raw message