[
https://issues.jboss.org/browse/AS7-5539?page=com.atlassian.jira.plugin.s...
]
Mayank Gupta edited comment on AS7-5539 at 9/17/12 2:28 AM:
------------------------------------------------------------
Hi Stuart,
As suggested I put the code optimistic-locking enabled="true" in
standalone.xml.
But still server hangs at the same point.
Next I changed the transaction attribute of all the session beans in the flow as Required
(from RequiresNew), post which
it started working. But still it was hanging which is not always. This intermitent
behavour I can attribute to JMS thread which could still be using RequiresNew and I have
not touched that flow.
This means optimistic-locking enabled="true" setting is not working on the
entities.
Next I can try with enabling it in jbosscmp-jdbc.xml, but I am not able to understand
which configuration to use as you have shown 6-7 different configuration in git example.
But the global configuration on standalone level is not working.
I cannot change the code as my business scenarios could fail because of transaction
policies and this is legacy code where changing transaction attributes like this could
result in dangerous runtime failures.
One thing I cannot understand is why new transaction is getting the entity created in
first transaction. We know there is no concept of child transactions in EJB. Inner
transaction should get its own Entity. Is it done to ensure that when inner Transaction
completes it might have modified the DB and as a result my entity with T1 transaction
becomes out of sync. and would have stale data?
Klaus Benary also reported the issues with Pessimistic locking in JBOSS7 before
"https://community.jboss.org/message/741026"
was (Author: ion_mayank):
Hi Stuart,
As suggested I put the code optimistic-locking enabled="true" in
standalone.xml.
But still server hangs at the same point.
Next I changed the transaction attribute of all the session beans in the flow as Required
(from RequiresNew), post which
it started working. But still it was hanging which is not always. This intermitent
behavour I can attribute to JMS thread which could still be using RequiresNew and I have
not touched that flow.
This means optimistic-locking enabled="true" setting is not working on the
entities.
Next I can try with enabling it in jbosscmp-jdbc.xml, but I am not able to understand
which configuration to use as you have shown 6-7 different configuration in git example.
But the global configuration on standalone level is not working.
I cannot change the code as my business scenarios could fail because of transaction
policies and this is legacy code where changing transaction attributes like this could
result in dangerous runtime failures.
One thing I cannot understand is why new transaction is getting the entity created in
first transaction. We know there is no concept of child transactions in EJB. Inner
transaction should get its own Entity. Is it done to ensure that when inner Transaction
completes it might have modified the DB and as a result my entity with T1 transaction
becomes out of sync. and would have stale data?
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