[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
Mayank Gupta (JIRA)
jira-events at lists.jboss.org
Sun Sep 16 14:04:35 EDT 2012
[ https://issues.jboss.org/browse/AS7-5539?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12718945#comment-12718945 ]
Mayank Gupta edited comment on AS7-5539 at 9/16/12 2:03 PM:
------------------------------------------------------------
Hi Stuart/Stephen,
Thanks for the detailed explanation.
I will try to run the code as suggested by you. But for getting my concept right please explain the below point:
1. Till JBOSS6 we were using 'Instance Per transaction policy' which is configured using JBOSS.xml and the policy we have defined in standardjboss.xml. We have not configured anything in jbosscmp-jdbc.xml. So to achieve the above behavour shall I need to add this configuration in jbosscmp-jdbc.xml as standardjboss.xml is not available in JBOSS7?
"For now we are using a completely synchronized approach to entity concurrency. There is at most 1 entity active for a given primary key at any time, and access is synchronized within a transaction." this is the comment on EntityBeanSynchronizationInterceptor
2. As you said there is an inner transaction which is trying to acquire the lock on same entity. But my query is that T1 transaction created an Entity Bean object and it would be suspended when inner transaction starts as it has been started by RequiresNew, then why it will be using the entity created in T1 transaction. It should get its own bean. If not, then what is the default policy configured? And it means that we can never use an object of same Entity bean in inner transaction if it has been used in a transaction starting inner transaction?
3. Is the Entity Bean pooling by default supported in JBOSS 7.1.1? There is configuration available in the XSD of JBOSS EJB, but the default standalone.xml has no such configuration.
Thanks and Regards,
Mayank
was (Author: ion_mayank):
Hi Stuart,
Thanks for the detailed explanation.
I will try to run the code as suggested by you. But for getting my concept right please explain the below point:
1. Till JBOSS6 we were using 'Instance Per transaction policy' which is configured using JBOSS.xml and the policy we have defined in standardjboss.xml. We have not configured anything in jbosscmp-jdbc.xml. So to achieve the above behavour shall I need to add this configuration in jbosscmp-jdbc.xml as standardjboss.xml is not available in JBOSS7?
"For now we are using a completely synchronized approach to entity concurrency. There is at most 1 entity active for a given primary key at any time, and access is synchronized within a transaction." this is the comment on EntityBeanSynchronizationInterceptor
2. As you said there is an inner transaction which is trying to acquire the lock on same entity. But my query is that T1 transaction created an Entity Bean object and it would be suspended when inner transaction starts as it has been started by RequiresNew, then why it will be using the entity created in T1 transaction. It should get its own bean. If not, then what is the default policy configured? And it means that we can never use an object of same Entity bean in inner transaction if it has been used in a transaction starting inner transaction?
3. Is the Entity Bean pooling by default supported in JBOSS 7.1.1? There is configuration available in the XSD of JBOSS EJB, but the default standalone.xml has no such configuration.
Thanks and Regards,
Mayank
> 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