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
Operations

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

[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

Environment:

linux


Tags: ian 4_0-approved
Participants: ethan.wang, 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>@sunsw.us.oracle.com:/m/jws
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]
[echo]
[echo]
[echo] Wrong type of message received
[echo]
[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] [] [javax.enterprise.system.container.ejb.com.sun.ejb.containers] [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(BaseContainer.java:2016)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1979)
at com.sun.ejb.containers.StatefulSessionContainer.removeBean(StatefulSessionContainer.java:1185)
at com.sun.ejb.containers.EJBObjectImpl.remove(EJBObjectImpl.java:198)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invokeEJBObjectMethod(EJBObjectInvocationHandler.java:283)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:170)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:123)
at $Proxy245.remove(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:239)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:150)
at com.sun.corba.ee.impl.presentation.rmi.codegen.CodegenStubBase.invoke(CodegenStubBase.java:226)
at com.sun.ejte.j2ee.bank.contentcontroller.ejb._ContentController_DynamicStub.remove(com/sun/ejte/j2ee/bank/contentcontroller/ejb/_ContentController_DynamicStub.java)
at com.sun.ejte.j2ee.bank.jmsasynccontroller.ejb.DepositMdb.onMessage(DepositMdb.java:91)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1057)
at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1129)
at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:4118)
at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:4675)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:4655)
at org.glassfish.ejb.mdb.MessageBeanContainer.deliverMessage(MessageBeanContainer.java:1197)
at org.glassfish.ejb.mdb.MessageBeanListenerImpl.deliverMessage(MessageBeanListenerImpl.java:81)
at com.sun.enterprise.connectors.inbound.MessageEndpointInvocationHandler.invoke(MessageEndpointInvocationHandler.java:171)
at $Proxy278.onMessage(Unknown Source)
at com.sun.messaging.jms.ra.OnMessageRunner.run(OnMessageRunner.java:283)
at com.sun.enterprise.connectors.work.OneWork.doWork(OneWork.java:107)
at com.sun.corba.ee.impl.threadpool.ThreadPoolImpl$WorkerThread.performWork(ThreadPoolImpl.java:497)
at com.sun.corba.ee.impl.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:540)
Caused by: java.lang.IllegalStateException: Transaction exists on current thread.
at com.sun.enterprise.transaction.JavaEETransactionManagerSimplified.resume(JavaEETransactionManagerSimplified.java:990)
at com.sun.ejb.containers.EJBContainerTransactionManager.postInvokeTx(EJBContainerTransactionManager.java:441)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4475)

at com.sun.ejb.containers.StatefulSessionContainer.postInvokeTx(StatefulSessionContainer.java:1852)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2009)
... 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 glassfish-4.0-b84.zip


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.


ethan.wang 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.


ethan.wang 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.


ethan.wang 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?
    Yes.
  • Does it meet other bug fix criteria (security, performance, etc.)?
    no.
  • What CTS failures are caused by this bug?
    None.
  • 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?
    no.
  • Which tests should QA (re)run to verify the fix did not destabilize GlassFish?
    EJB
  • Which is the targeted build of 4.0 for this fix?
    rc3.
  • 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.
    No.

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/StatefulSessionContainer.java
Transmitting file data .
Committed revision 61741.