3 Replies Latest reply on Feb 2, 2007 6:08 PM by Alan Feng

    MDB deployment causes connection timeout error

    Alan Feng Novice

      JBoss 4.0.4GA + Messaging 1.0.1SP2

      I created a simple MDB that listen to a topic. When deployed, it all looks okay. But about 30 seconds later after the deployment, the JBoss console dumps out an warning message followed by error stack trace. It seems that the messaging service is trying to close a connection that it thinks has been out for too long. Then it errors out with a "Failed to obtain lock" when trying to close the connection.

      The output:

      14:58:46,340 INFO server.Server - JBoss (MX MicroKernel) [4.0.4.GA (build: CVSTag=JBoss_4_0_4_GA date=200605151000)] Started in 38s:167ms
      14:59:21,133 WARN connectionmanager.SimpleConnectionManager - A problem has been detected with the connection to remote client 4co2mt-16t2uo-exm8rsfy-1-exm8s4c4-5. It is possible the client has exited without closing its connection(s) or there is a network problem. All connection resources corresponding to that client process will now be removed.
      
       14:59:21,153 ERROR util.ExceptionUtil - ConsumerEndpoint[-2147483628] close [4co2mt-16t2uo-exm8rsfy-1-exm8t0on-h]
       java.lang.RuntimeException: Failed to obtain lock
       at org.jboss.messaging.core.local.PointToMultipointRouter.remove(PointToMultipointRouter.java:166)
       at org.jboss.messaging.core.local.Topic.remove(Topic.java:126)
       at org.jboss.messaging.core.local.CoreSubscription.disconnect(CoreSubscription.java:111)
       at org.jboss.jms.server.endpoint.ServerConsumerEndpoint.close(ServerConsumerEndpoint.java:360)
       at org.jboss.jms.server.endpoint.ServerConsumerEndpoint.remove(ServerConsumerEndpoint.java:543)
       at org.jboss.jms.server.endpoint.ServerSessionEndpoint.close(ServerSessionEndpoint.java:403)
       at org.jboss.jms.server.endpoint.ServerConnectionEndpoint.close(ServerConnectionEndpoint.java:300)
       at org.jboss.jms.server.connectionmanager.SimpleConnectionManager.handleClientFailure(SimpleConnectionManager.java:158)
       at org.jboss.jms.server.connectionmanager.SimpleConnectionManager.handleConnectionException(SimpleConnectionManager.java:208)
       at org.jboss.remoting.ConnectionNotifier.connectionLost(ConnectionNotifier.java:46)
       at org.jboss.remoting.Lease$LeaseTimerTask.execute(Lease.java:133)
       at org.jboss.util.TimerQueue$TimerTaskLoop.run(TimerQueue.java:181)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.InterruptedException
       at EDU.oswego.cs.dl.util.concurrent.WriterPreferenceReadWriteLock$WriterLock.acquire(WriterPreferenceReadWriteLock.java:234)
       at org.jboss.messaging.core.local.PointToMultipointRouter.remove(PointToMultipointRouter.java:161)
       ... 12 more
      14:59:21,153 ERROR util.ExceptionUtil - SessionEndpoint[-2147483629] close [4co2mt-16t2uo-exm8rsfy-1-exm8t0ox-i]
      org.jboss.jms.util.MessagingJMSException: A failure has occurred during processing of the request. Please consult the server logs for more details. ConsumerEndpoint[-2147483628] close [4co2mt-16t2uo-e
      xm8rsfy-1-exm8t0on-h]
       at org.jboss.jms.util.ExceptionUtil.handleJMSInvocation(ExceptionUtil.java:72)
       at org.jboss.jms.server.endpoint.ServerConsumerEndpoint.close(ServerConsumerEndpoint.java:377)
       at org.jboss.jms.server.endpoint.ServerConsumerEndpoint.remove(ServerConsumerEndpoint.java:543)
       at org.jboss.jms.server.endpoint.ServerSessionEndpoint.close(ServerSessionEndpoint.java:403)
       at org.jboss.jms.server.endpoint.ServerConnectionEndpoint.close(ServerConnectionEndpoint.java:300)
       at org.jboss.jms.server.connectionmanager.SimpleConnectionManager.handleClientFailure(SimpleConnectionManager.java:158)
       at org.jboss.jms.server.connectionmanager.SimpleConnectionManager.handleConnectionException(SimpleConnectionManager.java:208)
       at org.jboss.remoting.ConnectionNotifier.connectionLost(ConnectionNotifier.java:46)
       at org.jboss.remoting.Lease$LeaseTimerTask.execute(Lease.java:133)
       at org.jboss.util.TimerQueue$TimerTaskLoop.run(TimerQueue.java:181)
       at java.lang.Thread.run(Thread.java:595)
      


      Note that there is no message delivered published to the topic at all.

      Here is the EJB3 MDB I deployed:
      @MessageDriven(
      name = "NotificationMDB",
      activationConfig = {
       @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
       @ActivationConfigProperty(propertyName = "destination", propertyValue = "topic/Notification"),
       @ActivationConfigProperty(propertyName = "user", propertyValue = "user"),
       @ActivationConfigProperty(propertyName = "password", propertyValue = "pass"),
       @ActivationConfigProperty(propertyName = "noLocal", propertyValue = "true") })
      @ResourceAdapter("jms-ra.rar")
      public class NotificationMDB extends BaseServiceBean implements MessageListener {
      
       public void onMessage(Message message) {
       System.out.println("=========\nMDB message received: " + message.toString() + "\n===========");
       }
      }
      


      I am not doing anything abnormal. It seems that the messaging code is forcing the connections to be closed after about 30 seconds. It should not be doing it as a topic subscriber or queue consumer may connect to the topic / queue for a fairly long time.

      The @ResourceAdaptor annotation I put there does not have any effect on this problem.

      I feel this should be fairly basic. Any one who is deploying a MDB would have probably seen it. Please help if you know anything about this.

      Thank you.

        • 1. Re: MDB deployment causes connection timeout error
          Alan Feng Novice

          It seems that it is actually a lease / renew problem for MDB.

          After look into the source code of JBoss remoting, it seems that the Messaging simply removes the client connection endpoint when it is notified by the jboss remoting.Lease class. The Lease class has a timer that checks if the client has renewed its lease or not. If not, it considers it as a dead connection and notifies the Messaging callback listener:

          private class LeaseTimerTask extends TimerTask
           {
          
           protected boolean running = true;
          
           /**
           * The action to be performed by this timer task.
           */
           public void execute()
           {
           if(running)
           {
           if(leaseUpdated)
           {
           leaseUpdated = false;
           leaseTimer.schedule(this, leaseWindow);
           }
           else
           {
           stopLease();
           notifier.connectionLost(locatorURL, clientSessionId, requestPayload);
           }
           }
           }
           }
          


          My question is then: how to configure Messaging to auto renew its connection lease on a deployed MDB? I looked into the jboss-messaging.sar\remoting-service.xml and there is a leasePeriod setting. I am not sure how to change it, as MDB would require an infinite lease period then.



          • 2. Re: MDB deployment causes connection timeout error
            Tim Fox Master

            JBoss Remoting will fire an event if a ping hasn't been received on the connection for leasePeriod seconds.

            Then JBM will attempt to close the connection. As long as pings are received, the leases are renewed and the connection should not be closed.

            So for some reason, pings aren't getting from the client to the server.

            If you like, you can set leasePeriod to zero to disable pinging altogether.

            • 3. Re: MDB deployment causes connection timeout error
              Alan Feng Novice

              Thank you for the reply!

              Since posting the question, I thought it might help to try the latest stable release of JBoss, so I upgraded from 4.0.4GA to 4.0.5GA and added the messaging as I did on 4.0.4GA. All messaging examples run fine so I deployed my app and it worked!

              I didn't experience any problem I had when I adding messaging with 4.0.4GA, such as "Not a JBossQueue" exception due to classloader resolution.

              I still have the 4.0.4GA on my disk, so I'll run it again with leasePeriod=0 and will post back the result on this thread.