[jboss-jira] [JBoss JIRA] (AS7-5539) JBOSS7 server hangs up completely when a EJB2.1 entity bean business method is called in same transaction in a separate thread from the thread which started the transaction

jaikiran pai (JIRA) jira-events at lists.jboss.org
Thu Sep 13 05:09:33 EDT 2012


    [ https://issues.jboss.org/browse/AS7-5539?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12718160#comment-12718160 ] 

jaikiran pai commented on AS7-5539:
-----------------------------------

{quote}
It will take me 4 to 5 hours/a day to create, deploy and test the sample code.
I will do that as soon as I get spare time from my other project activities.
{quote}
Sure, take your time. There's no hurry.

{quote}
However I have put the exact condition in the JIRA where this problem is occurring.
Moreover as we agree that multithreading is not allowed in EJBs and in this code we are trying to associate the same
entity instance with the second thread in same transaction. Can two threads in same transaction get hold of same Entity Bean?{quote}
That's possible, for example, if you have a remote client which controls the transaction. 

Note that I'm not saying that this isn't a bug in the AS7 code and we might have to fix it. All I'm saying is, so far, the use case you have explained doesn't give me an idea as to why this is happening. And without knowing that part and reproducing it there's no way we can really fix this. So I'm not trying to be annoying here but just want to get this reproduced for *your* specific case.

                
> JBOSS7 server hangs up completely when a EJB2.1 entity bean business method is called in same transaction in a separate thread from the thread which started the transaction
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AS7-5539
>                 URL: https://issues.jboss.org/browse/AS7-5539
>             Project: Application Server 7
>          Issue Type: Bug
>          Components: EJB, Transactions
>    Affects Versions: 7.1.1.Final, 7.1.3.Final (EAP), 7.2.0.Alpha1
>            Reporter: Mayank Gupta
>            Assignee: jaikiran pai
>
> JBOSS7 server hangs up completely while trying to access a EJB2.1 entity bean method in a specific scenario.
> I am using a session facade pattern in which I call my EntityBean from a Stateless session bean. For moth the beans I have defined the transaction attribute as REQUIRED.
> On debugging the code I found that if the same Entity bean is accessed from two different threads in same transaction then this issue occurs.
> So for the first time my code enters "EntityBeanSynchronizationInterceptor" code is able to take the lock and assign the requester thread as the lock owner. When second time it comes to access the same entity bean from different thread in SAME TRANSACTION (as 2nd required results in joining the transaction), JBOSS7 server code completely stalls in taking the lock. Moreover this time requester thread is not given the owner status of the transaction. 
> Code snippet where code hangs:
>         final Object lockOwner = getLockOwner(transactionSynchronizationRegistry);
>         lock.pushOwner(lockOwner);
>         try {
>             lock.lock();  //line 80 in EntityBeanSynchronizationInterceptor
> and subsequently in:
>     public void lock() {
>         if (compareAndSetState(0, 1))
>             owner = currentRequestor();
>         else
>             acquire(1); //Here line 86 in OwnableReentrantLock
>     }
> This is a completely blocking issue for migrating my application from JBOSS6 to JBOSS7.
> I get this error in numerous places in my application code.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list