Issue Details (XML | Word | Printable)

Key: GLASSFISH-20342
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: marina vatkina
Reporter: sonialiu
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.

[REGRESSION] Remote SFSB.remove fails with IllegalStateException: Transaction exists on current thread.

Created: 17/Apr/13 09:42 PM   Updated: 30/Apr/13 06:39 AM   Resolved: 30/Apr/13 06:39 AM
Component/s: ejb_container
Affects Version/s: 4.0_b84_RC1
Fix Version/s: 4.0_b87_RC3

Time Tracking:
Not Specified



Tags: ian 4_0-approved
Participants:, marina vatkina, shreedhar_ganapathy and sonialiu

 Description  « Hide

build: promoted build84

This is a Regression bug since the same tests passed against build83. I am not sure which component this bug belongs to and I just assign it to JMS module, please feel free to assign it to other component owner if it's not a JMS bug. Thanks.

Steps to reproduce the bug:

1. Install GF4.0, start domain
2. Checkout SQE workspace:
cvs co appserver-sqe/bootstrap.xml
(CVSROOT: :pserver:<your cvs user>
cd appserver-sqe
ant -f bootstrap.xml co-bat
3.set following env. variables
S1AS_HOME <GF install dir>, for example: /export/test/v4/glassfish4/glassfish
SPS_HOME <appserver-sqe>, for example: /export/test/appserver-sqe
ANT_HOME <ant location>, for example: /export/test/ant-1.7.1
JAVA_HOME <java location>, for example: /export/test/jdk1.7.0_11
4. cd <workspace dir>/appserver-sqe/, run "ant startDerby" to start derby database
5. cd <workspace dir>/appserver-sqe/pe/integrated-apps/bank, run "ant all".

3 test cases failed and the following errors displayed in the client side:

[echo] JMS1.1:JMS-P2P,UnifiedAPI:StatefulSession-CMT,ReceiveMap,CallStatefulSession:#8 : FAIL
[echo] Error : RemoteException : java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
[echo] java.rmi.RemoteException: null; nested exception is:
[echo] javax.ejb.EJBException
[echo] Wrong type of message received
[echo] JMS1.1:JMS-PubSub,UnifiedAPI:AppClient-DurableSubscription,ReceiveText:StatefulSession-CMT,SendText:#9 : FAIL
[echo] Error : Did not receive expected message
[echo] - SyncControllerJNDI:Lookup:JMS_Destination:Queue:CreatedWith-j2eeadmin:#6: PASS -
[echo] - SyncControllerJMS1.1:JMS-P2P,UnifiedAPI:StatefulSession-CMT,ReceiveMap,CallStatefulSession:#8: FAIL -
[echo] - SyncControllerJNDI:Lookup:JMS_Destination:Topic:CreatedWith-j2eeadmin:#5: PASS -
[echo] - SyncControllerJNDI:Lookup:SessionBean:Stateful:#2: PASS -
[echo] - SyncControllerJMS1.1:JMS-PubSub,UnifiedAPI:AppClient-DurableSubscription,ReceiveText:StatefulSession-CMT,SendText:#9: FAIL -
[echo] - SyncControllerJMS1.1:JMS-P2P,UnifiedAPI:AppClient-SendMap:StatefulSession-CMT,ReceiveMap:#7: PASS -
[echo] - SyncControllerJNDI:Lookup:SessionBean:Stateful:#1: PASS -
[echo] - SyncControllerCMP2.0:UnpopulateDatabase:#11: PASS -
[echo] - SyncControllerJNDI:Lookup:JMS_ConnectionFactory:Topic:CreatedWith-j2eeadmin:#4: PASS -
[echo] - SyncControllerJMS1.1:JMS-UnifiedAPI:AppClient-CloseJMSConnection:#10: PASS -
[echo] - SyncControllerCMP2.0:PopulateDatabase:#3: PASS -
[echo] -----------------------------------------
[echo] Total PASS: 9
[echo] Total FAIL: 2

----------- ------------------------
6. There are some exceptions in server.log

EJB5184:A system exception occurred during an invocation on EJB ContentControllerEjb, method: null]]

[2013-04-17T14:09:51.546-0700] [glassfish 4.0] [WARNING] [] [] [tid: _ThreadID=117 _ThreadName=p: thread-pool-1; w: 4] [timeMillis: 1366232991546] [levelValue: 900] [[

javax.ejb.EJBException: java.lang.IllegalStateException: Transaction exists on current thread.
at com.sun.ejb.containers.BaseContainer.postInvoke(
at com.sun.ejb.containers.BaseContainer.postInvoke(
at com.sun.ejb.containers.StatefulSessionContainer.removeBean(
at com.sun.ejb.containers.EJBObjectImpl.remove(
at com.sun.ejb.containers.EJBObjectInvocationHandler.invokeEJBObjectMethod(
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(
at $Proxy245.remove(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(
at com.sun.ejb.containers.BaseContainer.__intercept(
at com.sun.ejb.containers.BaseContainer.intercept(
at org.glassfish.ejb.mdb.MessageBeanContainer.deliverMessage(
at org.glassfish.ejb.mdb.MessageBeanListenerImpl.deliverMessage(
at com.sun.enterprise.connectors.inbound.MessageEndpointInvocationHandler.invoke(
at $Proxy278.onMessage(Unknown Source)
Caused by: java.lang.IllegalStateException: Transaction exists on current thread.
at com.sun.enterprise.transaction.JavaEETransactionManagerSimplified.resume(
at com.sun.ejb.containers.EJBContainerTransactionManager.postInvokeTx(
at com.sun.ejb.containers.BaseContainer.postInvokeTx(

at com.sun.ejb.containers.StatefulSessionContainer.postInvokeTx(
at com.sun.ejb.containers.BaseContainer.postInvoke(
... 33 more

marina vatkina added a comment - 17/Apr/13 09:55 PM

What is the date of build 84? Does this test fail on the latest nightly? A fix for a similar issue was committed on Apr 9th.

sonialiu added a comment - 17/Apr/13 10:00 PM

Promoted build84-RC1 was promoted on 04/10
Apr 10 10:18

sonialiu added a comment - 17/Apr/13 10:26 PM

I just ran the tests against latest nightly build (04/17 nightly) and it also failed. added a comment - 18/Apr/13 09:59 AM

Already reproduced the exception with latest GF build, will look further into it for the cause.

shreedhar_ganapathy added a comment - 19/Apr/13 02:40 PM

Any further update on this bug? Is this to be fixed for 4.0 release?
We need to ensure we have the fixes for 4.0 wrapped up ASAP. added a comment - 24/Apr/13 09:56 PM

By far this looks like a concurrent issue to me. In preInvokeTx() we suspend the tx before invoking removeBean() against a SFSB, I checked and the current tx was set to null as expected. Then in postInvokeTx () we try to resume the tx but we find the current tx is not null anymore, so an IllegalStateException is raised saying "Transaction exists on current thread".

Current tx is saved in a TreadLocal object by TransactionManager and the failed cases are in relevant with JMS asynchronous messagingļ¼Œso it seems like a concurrent issue. I'm looking further into it for the root cause. added a comment - 26/Apr/13 03:22 PM

The root cause is clear now. For SFSB using BMT, when remove() is being called upon it, postInvokeTx() would be invoked twice, the 1st one is for the PreDestroy callback and another is for remove() method itself, so when tx is suspended for remove(), the second attempt of resuming the tx would fail because it's already resumed. I discussed with Marina about this and I'm working on a fix now.

marina vatkina added a comment - 30/Apr/13 04:45 AM
  • What is the impact on the customer of the bug?
    BMT bean remove fails when called in a transaction
  • How likely is it that a customer will see the bug and how serious is the bug?
    BMT bean remove fails when called in a transaction
  • Is it a regression?
  • Does it meet other bug fix criteria (security, performance, etc.)?
  • What CTS failures are caused by this bug?
  • What is the cost/risk of fixing the bug?
    Low so far - testing
  • How risky is the fix? How much work is the fix? Is the fix complicated?
    Minimal so far - testing
  • Is there an impact on documentation or message strings?
  • Which tests should QA (re)run to verify the fix did not destabilize GlassFish?
  • Which is the targeted build of 4.0 for this fix?
  • If this an integration of a new version of a component from another project,
    what are the changes that are being brought in? This might be list of
    Jira issues from that project or a list of revision messages.

marina vatkina added a comment - 30/Apr/13 06:39 AM

Fixed by bypassing tx if it's a BMT SFSB.
Sending ejb-container/src/main/java/com/sun/ejb/containers/
Transmitting file data .
Committed revision 61741.