1 2 Previous Next 20 Replies Latest reply on Apr 26, 2004 9:35 AM by hlavacd Go to original post
      • 15. Re: JMS Ping Timeout

        Hi Adrian

        I don't think this will be the case. Anyway, i am testing it now. It need more than one day to get the result.

        According to the JMS specification, the exceptions delivered to ExceptionListener are those which don't have any other place to be reported (such as network problem). Closing a closed connection MUST NOT throw an exception.

        There is no reason that closeing a closed connection will invoke onExcepiton() again.


        Regards
        yang

        • 16. Re: JMS Ping Timeout

          It is not closed yet, that is the work you are doing.

          All that has happened is that the connection has informed of a potential error,
          what you do is up to you. Closing and recreating the connection is usually the solution.

          Also from the spec:

          JMSException - if the JMS provider fails to close the connection due to some internal error. For example, a failure to release resources or to close a socket connection can cause this exception to be thrown.
          


          I will re-examine whether nulling the ExceptionListener in Connection.close()
          really does cause a deadlock, e.g. you have it on different threads.

          • 17. Re: JMS Ping Timeout

            Hi, Adrian

            The ping timeout happened again after 30 hours' stress testing (routing 120 messages/second).
            But this time, i got more information.

            In the following, i list the output of log.error(...) and System.out.println(...).
            (1) "init() return successfully" is the output of init() method. Once a new connection is established, it is printed.
            (2)Here, you can see there are two "init() return successfully". The first one is printed when i started the stress testing
            and the second one is printed by the init() method which is invoked in the onException() method.
            (3)The disconnection of the old connection is not returned because no information is printed (pls read the disconnection codes).
            (4)On the whole, one new connection is established. so the stress testing can continue. :). But i am not sure whether the
            hang of the disconnection of the old connection will introduce other potential problem.
            (5)This time, you lost the bet :) :). I guess the problem is that the jms provider(JbossMQ) closed the connection before it invoke the onException() method.

            By the way, what is the exact meaning of "ping timeout"? I think the best solution is to find out why "ping timeout" happened?

            Regards
            yang


            -----------------------output of log.error and System.out.println()--------------------
            [java] .init() return successfully
            [java] org.jboss.mq.SpyJMSException: Connection Failed; - nested throwable: (java.io.IOException: ping timeout.)
            [java] onException() is called at Sat Apr 17 06:30:54 SGT 2004
            [java] at org.jboss.mq.Connection.asynchFailure(Connection.java:718)
            [java] at org.jboss.mq.Connection$PingTask.run(Connection.java:1311)
            [java] at EDU.oswego.cs.dl.util.concurrent.ClockDaemon$RunLoop.run(ClockDaemon.java:364)
            [java] at java.lang.Thread.run(Thread.java:534)
            [java] Caused by: java.io.IOException: ping timeout.
            [java] at org.jboss.mq.Connection$PingTask.run(Connection.java:1303)
            [java] ... 2 more
            [java] init() return successfully


            ------------------------onExceptoin() method-----------------------------------------------
            public synchronized void onException(JMSException jmsException) {
            log.error("onException() is called at " + new Date());
            System.out.println("onException() is called at " + new Date());
            jmsException.printStackTrace();
            oldconnection = queueConnection;
            boolean reconnection = false;
            retry : for (int i = 0; i < 10; i++) {
            try {
            C2SConnectorMessageListener.this.init();
            reconnection = true;
            break retry;
            } catch (Exception e2) {
            log.error("reconnection failed");
            System.out.println("reconnection failed");
            try {
            log.error("sleep for 2 seconds and try reconnect again");
            Thread.sleep(2000);
            } catch (InterruptedException e1) {
            e1.printStackTrace();
            }
            }
            }
            if (!reconnection) {
            System.out.println("RECONNECTION FAILED");
            log.error("RECONNECTION FAILED");
            System.exit(1);
            }

            Thread disconnThread = new Thread() {
            public void run() {
            try {
            if (oldconnection != null) {
            oldconnection.close();
            oldconnection = null;
            }
            log.debug("close the old connection success");
            System.out.println("close the old connection success");
            return;
            } catch (Exception e) {
            log.error("disconnect the old connection failed");
            }
            }
            };
            disconnThread.start();
            }

            • 18. Re: JMS Ping Timeout

               

              "yxyang" wrote:


              By the way, what is the exact meaning of "ping timeout"? I think the best solution is to find out why "ping timeout" happened?



              I added it to the FAQ topic, time for you to re-read "READ THIS FIRST",
              particularly the part that begins "If you suspect a hang/deadlock"

              • 19. Re: JMS Ping Timeout

                If you look here in 24 hours time you will a couple of fixes that might be the
                cause of your problem:
                http://cvs.sourceforge.net/viewcvs.py/jboss/jbossmq/src/main/org/jboss/mq/Connection.java

                Sourceforge's anonymous cvs access is upto 24 hours behind the real thing.

                • 20. Re: JMS Ping Timeout
                  hlavacd

                   

                  "alanc_yang" wrote:
                  I encountered the same problem, but wasn't able to see the ExceptionListener's onException gets call when it happened. This was what I did:

                  1) in my MDBean to implement ExceptionListener
                  2) provide onException method
                  3) in the connection to setExceptionListener(this);

                  I must have missed something. Please help!
                  Thanks in advance.

                  Alan


                  I don't understand. You are able to get inside MDB connection to the same Topic from which MDB is consuming messages. Or where do you setExceptionListener(this)?

                  Thanks Dusan.

                  1 2 Previous Next