2 Replies Latest reply on Jun 24, 2002 9:07 AM by jaroslaw zimon

    JBoss hangs on findByPrimaryKey

    Daniele Martinoli Newbie

      Hi all,
      it seems JBoss hangs on findByPrimaryKey, when our application is serving more than one client.
      This is our scenario:
      ) CMP EntityBeans deployed on Oracle 8 DB
      ) All ejb-jar.xml have transactions=Required, tuned-updates=true and reentrant=true
      ) GUI Clients access the application through EntityBeans interfaces: at startup time, the client loads most of the Entity Beans to initialize the object tree (not all the EB's: only those at the trees's fist level)
      ) Periodically (once per day), a special client starts up a long time procedure, let's say LTP, using more times a Stateless Session Bean interface (e.g.: more transactions), which interacts with more Entity Bean within each single call

      When this procedure runs, we cannot start a new GUI client, because the startup procedure cause the LTP to hang on some call.
      We added lots af traces at server-side and it seems the last call of this LTP is a "findByPrimaryKey" on a given bean (always the same). Is there any reason to hang on this call???

      I forgot to tell about the GUI clients: they also hangs on during startup procedure, it seems when iterating on a findAll() to call remote interface of each bean (get methods). We suspect they access the same Bean and, for some strange reason, JBoss has a kind of deadlock.

      Any help will be appreciated.
      Thanks in advance,
      Daniele


        • 1. Re: JBoss hangs on findByPrimaryKey
          Daniele Martinoli Newbie

          I let the AS working after the supposed deadlock.
          This is the stack of the EB's calls:

          javax.transaction.TransactionRolledbackException: Transaction marked for rollback, possibly a timeout; nested exception is:
          java.lang.RuntimeException: Transaction marked for rollback, possibly a timeout
          javax.transaction.TransactionRolledbackException: Transaction marked for rollback, possibly a timeout; nested exception is:
          java.lang.RuntimeException: Transaction marked for rollback, possibly a timeout
          java.lang.RuntimeException: Transaction marked for rollback, possibly a timeout
          at org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.waitForTx(QueuedPessimisticEJBLock.java:291)
          at org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.doSchedule(QueuedPessimisticEJBLock.java:169)
          at org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.schedule(QueuedPessimisticEJBLock.java:137)
          at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:121)
          at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:138)
          at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:347)
          at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:100)
          at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:127)
          at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:170)
          at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:428)
          at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:504)
          at org.jboss.ejb.plugins.jrmp.interfaces.GenericProxy.invokeContainer(GenericProxy.java:335)
          at org.jboss.ejb.plugins.jrmp.interfaces.EntityProxy.invoke(EntityProxy.java:133)
          at $Proxy72.MYFUNCTION(Unknown Source)


          And this is the stack received by the special client starting the long time procedure:

          java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
          java.rmi.ServerException: Container exception. Notify the container developers :-); nested exception is:
          java.lang.IllegalStateException: No transaction.
          java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
          java.rmi.ServerException: Container exception. Notify the container developers :-); nested exception is:
          java.lang.IllegalStateException: No transaction.
          java.rmi.ServerException: Container exception. Notify the container developers :-); nested exception is:
          java.lang.IllegalStateException: No transaction.
          java.lang.IllegalStateException: No transaction.
          at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:240)
          at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:215)
          at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:117)
          at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker_Stub.invoke(Unknown Source)
          at org.jboss.ejb.plugins.jrmp.interfaces.GenericProxy.invokeContainer(GenericProxy.java:357)
          at org.jboss.ejb.plugins.jrmp.interfaces.EntityProxy.invoke(EntityProxy.java:133)
          at $Proxy11.MYFUNCTION()

          Let me know if I should start migration to another AS, please!!
          PS: I'm using JBoss 2.4.4+Tomcat

          Hope to get news ....

          • 2. Re: JBoss hangs on findByPrimaryKey
            jaroslaw zimon Newbie

            I don't know if you call findAll() in th the same transaction context as subsequent bussiness methods
            on EJBs found. If it's true than deadlock might occur
            when you call 2 such procedures simultaneously. findAll() returned collections may have different remote interface order, so you get a deadlock. A solution requires a change in trans-attr to RequiresNew of your Entities.
            Othre way is to process EJBs returned from findAll() in the same order. I can't find in the spec if order of RemoteInterfaces is the same as this of Primary Key objects returned from finder - so you should probably sort RemoteInterfaces on the "caller side".