5 Replies Latest reply on Jan 19, 2005 2:06 PM by Faith Ildiz

    InstanceAlreadyExistsException: jboss.web:name=JkRequest

    Toshiya Kobayahsi Newbie

      Hi,

      I'm testing a web-application in JBoss4.0.0 with heavy load.
      JBoss is connected to Apache2 by mod_jk2.
      Sometimes I encounter a following Exception.

      2004-11-17 19:22:45,654 ERROR [org.apache.commons.modeler.Registry] Error registering jboss.web:name=JkRequest4,type=RequestProcessor,worker=jk-192.168.1.165-8009
      javax.management.InstanceAlreadyExistsException: jboss.web:name=JkRequest4,type=RequestProcessor,worker=jk-192.168.1.165-8009 already registered.
      at org.jboss.mx.server.registry.BasicMBeanRegistry.add(BasicMBeanRegistry.java:755)
      at org.jboss.mx.server.registry.BasicMBeanRegistry.registerMBean(BasicMBeanRegistry.java:211)
      at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:119)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:131)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:242)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
      at org.jboss.mx.server.MBeanServerImpl$3.run(MBeanServerImpl.java:1397)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:1392)
      at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:359)
      at org.apache.commons.modeler.Registry.registerComponent(Registry.java:871)
      at org.apache.jk.common.ChannelSocket.registerRequest(ChannelSocket.java:436)
      at org.apache.jk.common.HandlerRequest.decodeRequest(HandlerRequest.java:443)
      at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:352)
      at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:743)
      at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:675)
      at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:866)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
      at java.lang.Thread.run(Thread.java:534)
      2004-11-17 19:22:45,661 WARN [org.apache.jk.common.ChannelSocket] Error registering request

      This is reproducible with a simple servlet which does nothing.


      After this exception, I found another error once.

      2004-12-02 20:53:24,563 ERROR [org.jboss.cache.TransactionTable] addLock(): transaction entry not found for (gtx=<192.168.1.164:32910>:7453)
      2004-12-02 20:53:24,563 ERROR [org.jboss.cache.TransactionTable] addLock(): transaction entry not found for (gtx=<192.168.1.164:32910>:7453)
      2004-12-02 20:53:24,565 ERROR [org.jboss.cache.TransactionTable] addUndoOperation(): transaction not found (gtx=<192.168.1.164:32910>:7453)
      2004-12-02 20:53:24,569 ERROR [org.jboss.cache.TransactionTable] addModification(): transaction not found (gtx=<192.168.1.164:32910>:7453)
      2004-12-02 20:53:24,573 ERROR [org.jboss.cache.TreeCache] rollback(): entry for transaction <192.168.1.164:32910>:7453 not found (transaction has possibly already been rolled back)
      2004-12-02 20:53:24,583 ERROR [org.jboss.web.tomcat.tc5.session.JBossCacheManager] processSessionRepl: failed with exception: org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=dl360g3ap1/26801, BranchQual=, localId=26801] status=STATUS_NO_TRANSACTION; - nested throwable: (java.lang.IllegalStateException: cannot find transaction entry for <192.168.1.164:32910>:7453)
      2004-12-02 20:53:39,607 ERROR [org.jboss.cache.lock.IdentityLock] lock could not be acquired after 15000 ms. Lock map ownership Read lock owners: []
      Write lock owner: <192.168.1.164:32910>:7453

      2004-12-02 20:53:54,618 ERROR [org.jboss.cache.lock.IdentityLock] lock could not be acquired after 15000 ms. Lock map ownership Read lock owners: []
      Write lock owner: <192.168.1.164:32910>:7453

      2004-12-02 20:54:09,628 ERROR [org.jboss.cache.lock.IdentityLock] lock could not be acquired after 15000 ms. Lock map ownership Read lock owners: []
      Write lock owner: <192.168.1.164:32910>:7453

      2004-12-02 20:54:09,633 ERROR [org.jboss.web.tomcat.tc5.session.JBossCacheManager] processSessionRepl: failed with exception: java.lang.RuntimeException: JBossCacheService: exception occurred in cache put after retry ...
      2004-12-02 20:54:24,659 ERROR [org.jboss.cache.lock.IdentityLock] lock could not be acquired after 15000 ms. Lock map ownership Read lock owners: []
      Write lock owner: <192.168.1.164:32910>:7453

      2004-12-02 20:54:39,670 ERROR [org.jboss.cache.lock.IdentityLock] lock could not be acquired after 15000 ms. Lock map ownership Read lock owners: []
      Write lock owner: <192.168.1.164:32910>:7453

      2004-12-02 20:54:54,681 ERROR [org.jboss.cache.lock.IdentityLock] lock could not be acquired after 15000 ms. Lock map ownership Read lock owners: []
      Write lock owner: <192.168.1.164:32910>:7453

      My app does HttpSessionReplication and doesn't use TreeCache for other feature.
      This error is found only once, not reproducible.
      I cannot judge this error is derived from InstanceAlreadyExistsException.


      What I want to know is

      What causes this InstanceAlreadyExistsException?
      Is this InstanceAlreadyExistsException negligible for application's performance and correct behavior?

        • 1. Re: InstanceAlreadyExistsException: jboss.web:name=JkRequest
          Toshiya Kobayahsi Newbie

          org.apache.jk.common.HandlerRequest

          static int count = 0;
          
           private int decodeRequest( Msg msg, MsgContext ep, MessageBytes tmpMB )
           throws IOException
           {
           // FORWARD_REQUEST handler
           Request req=(Request)ep.getRequest();
           if( req==null ) {
           req=new Request();
           Response res=new Response();
           req.setResponse(res);
           ep.setRequest( req );
           if( registerRequests ) {
           ep.getSource().registerRequest(req, ep, count++);
           }
           }
          
           ...


          I think this is a synchronization issue.
          To make an unique ObjectName, the variable 'count' should be protected...?(count++ is not atomic)

          • 2. Re: InstanceAlreadyExistsException: jboss.web:name=JkRequest
            Scott Stark Master

            Its not clear that the InstanceAlreadyExistsException is a cause of the replication problem, but clearly this is a problem in the tomcat code. This has been fixed in the 5.5 branch of tomcat, but not the 5.0.x currently used by jboss-4.0.x.

            • 3. Re: InstanceAlreadyExistsException: jboss.web:name=JkRequest
              Toshiya Kobayahsi Newbie

              Thank you for your reply.
              I checked the Tomcat5.5 code.

              Then, the remaining problem is whether the InstanceAlreadyExistsException has any side effect.

              I've searched all JBoss/Tomcat codes for the String "RequestProcessor". And I found the MBean "*:type=RequestProcessor,*" is only used for a Status Servlet. But I am not completely sure.

              • 4. Re: InstanceAlreadyExistsException: jboss.web:name=JkRequest
                Ben Wang Master

                The TreeCache transaction simply rollback because of lock acquisition timeout. I'd say this is probably because of exception thrown that somehow screw up that particular tx. So perhaps that's the side effect. Can't be 100% sure though.

                -Ben

                • 5. Re: InstanceAlreadyExistsException: jboss.web:name=JkRequest
                  Faith Ildiz Newbie

                  Can the following exception I receive be attributed to the same bug?
                  I receive this error if I use AJP conenctor and integrate IIS and Apache-Tomcat (JB3.2.6 Tomcat 5.0).
                  - Fatih

                  11:01:23,997 ERROR [Registry] Error unregistering mbean
                  javax.management.InstanceNotFoundException: jboss.web:type=RequestProcessor,worker=jk-8009,name=JkRequest2998 not registered.
                  at org.jboss.mx.server.registry.BasicMBeanRegistry.remove(BasicMBeanRegistry.java:729)
                  at org.jboss.mx.server.registry.BasicMBeanRegistry.unregisterMBean(BasicMBeanRegistry.java:418)
                  at sun.reflect.GeneratedMethodAccessor130.invoke(Unknown Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                  at java.lang.reflect.Method.invoke(Method.java:324)
                  at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
                  at org.jboss.mx.server.Invocation.dispatch(Invocation.java:62)
                  at org.jboss.mx.server.Invocation.dispatch(Invocation.java:54)
                  at org.jboss.mx.server.Invocation.invoke(Invocation.java:82)
                  at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:197)
                  at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
                  at org.jboss.mx.server.MBeanServerImpl.unregisterMBean(MBeanServerImpl.java:339)
                  at org.apache.commons.modeler.Registry.unregisterComponent(Registry.java:643)
                  at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:706)
                  at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:866)
                  at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
                  at java.lang.Thread.run(Thread.java:534)