8 Replies Latest reply on Sep 6, 2013 10:41 AM by aquee

    Client connection failed after a short time

    Fabrice Oliveira Newbie

      2010-10-15 10:05:57,234 WARN  [org.hornetq.core.protocol.core.impl.RemotingConnectionImpl] (hornetq-failure-check-thread) Connection failure has been detected: Did not receive ping from local:ephemeral. It is likely the client has exited or crashed without closing its connection, or the network between the server and client has failed. The connection will now be closed. [code=3]
      2010-10-15 10:05:57,234 WARN  [org.hornetq.core.server.impl.ServerSessionImpl] (hornetq-failure-check-thread) Client connection failed, clearing up resources for session a252c0f8-d880-11df-b265-001111eb40b6
      2010-10-15 10:05:57,234 WARN  [org.hornetq.core.server.impl.ServerSessionImpl] (hornetq-failure-check-thread) Cleared up resources for session a252c0f8-d880-11df-b265-001111eb40b6

      Hi,

       

      A client (using applet) connect to HornetQ server with servlet transport. In the beginning, connection and message woks fine but after a short time, i have an HornetQException :  HornetQException[errorCode=2 message=Channel disconnected]

       

      On the server, i can see ping failed :

      2010-10-15 10:05:57,234 WARN  [org.hornetq.core.protocol.core.impl.RemotingConnectionImpl] (hornetq-failure-check-thread) Connection failure has been detected: Did not receive ping from local:ephemeral. It is likely the client has exited or crashed without closing its connection, or the network between the server and client has failed. The connection will now be closed. [code=3]

       

      2010-10-15 10:05:57,234 WARN  [org.hornetq.core.server.impl.ServerSessionImpl] (hornetq-failure-check-thread) Client connection failed, clearing up resources for session a252c0f8-d880-11df-b265-001111eb40b6

       

      2010-10-15 10:05:57,234 WARN  [org.hornetq.core.server.impl.ServerSessionImpl] (hornetq-failure-check-thread) Cleared up resources for session a252c0f8-d880-11df-b265-001111eb40b6

       

      Can you help me ?

      Thanks

        • 1. Re: Client connection failed after a short time
          Andy Taylor Master

          looks like the applet iskilling the  connection some how and not closing its resources correctly. its hard to say.

          • 2. Re: Client connection failed after a short time
            Fabrice Oliveira Newbie

            I looked connection ttl, and other parameters but nothing worked.

            The connection failed after 10 seconds... Less than ping period, etc...

             

            Code et my XML configuration can help you?

            • 3. Re: Client connection failed after a short time
              Clebert Suconic Master

              Look at our applet example. You're probably missing some config on TTL.

               

              You can provide a working example if you like, but look at those examples first.

              • 4. Re: Client connection failed after a short time
                Fabrice Oliveira Newbie

                I already looked applet example.

                My configuration :

                hornetq-configuration.xml

                <configuration xmlns="urn:hornetq"

                               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                               xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">

                 

                   <log-delegate-factory-class-name>org.hornetq.integration.logging.Log4jLogDelegateFactory</log-delegate-factory-class-name>

                 

                   <bindings-directory>${jboss.server.data.dir}/hornetq/bindings</bindings-directory>

                 

                   <journal-directory>${jboss.server.data.dir}/hornetq/journal</journal-directory>

                 

                   <!-- Default journal file size is set to 1Mb for faster first boot -->

                   <journal-file-size>${hornetq.journal.file.size:1048576}</journal-file-size>

                 

                   <!-- Default journal min file is 2, increase for higher average msg rates -->

                   <journal-min-files>${hornetq.journal.min.files:2}</journal-min-files>

                 

                 

                   <large-messages-directory>${jboss.server.data.dir}/hornetq/largemessages</large-messages-directory>

                 

                   <paging-directory>${jboss.server.data.dir}/hornetq/paging</paging-directory>

                   <connection-ttl-override>600000</connection-ttl-override>

                   <connectors>

                      <connector name="netty-servlet">

                         <factory-class>

                            org.hornetq.core.remoting.impl.netty.NettyConnectorFactory

                         </factory-class>

                         <param key="host" value="XXX.XX.XXX.XX"/>

                         <param key="port" value="8080"/>

                         <param key="use-servlet" value="true"/>

                         <param key="servlet-path" value="/HornetQServlet/HornetQServlet"/>

                      </connector>           

                 

                      <connector name="netty-throughput">

                         <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>

                         <param key="host"  value="${jboss.bind.address:localhost}"/>

                         <param key="port"  value="${hornetq.remoting.netty.batch.port:5455}"/>

                         <param key="batch-delay" value="50"/>

                      </connector>

                 

                      <connector name="in-vm">

                         <factory-class>org.hornetq.core.remoting.impl.invm.InVMConnectorFactory</factory-class>

                         <param key="server-id" value="${hornetq.server-id:0}"/>

                      </connector>

                 

                   </connectors>

                 

                   <acceptors>  

                     <acceptor name="netty-invm">

                         <factory-class>

                            org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory

                         </factory-class>

                         <param key="use-invm" value="true"/>

                         <param key="host" value="org.hornetq"/>

                      </acceptor>

                 

                      <acceptor name="netty-throughput">

                         <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>

                         <param key="host"  value="${jboss.bind.address:localhost}"/>

                         <param key="port"  value="${hornetq.remoting.netty.batch.port:5455}"/>

                         <param key="batch-delay" value="50"/>

                         <param key="direct-deliver" value="false"/>

                      </acceptor>

                 

                      <acceptor name="in-vm">

                        <factory-class>org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory</factory-class>

                        <param key="server-id" value="0"/>

                      </acceptor>

                 

                   </acceptors>

                 

                   <security-settings>

                      <security-setting match="#">

                         <permission type="createNonDurableQueue" roles="guest"/>

                         <permission type="deleteNonDurableQueue" roles="guest"/>

                         <permission type="createDurableQueue" roles="guest"/>

                         <permission type="deleteDurableQueue" roles="guest"/>

                         <permission type="createTempQueue" roles="guest"/>

                         <permission type="deleteTempQueue" roles="guest"/>

                         <permission type="consume" roles="guest"/>

                         <permission type="send" roles="guest"/>

                      </security-setting>

                   </security-settings>

                 

                <address-settings>

                      <!--default for catch all-->

                      <address-setting match="#">

                         <dead-letter-address>jms.queue.DLQ</dead-letter-address>

                         <expiry-address>jms.queue.ExpiryQueue</expiry-address>

                         <redelivery-delay>0</redelivery-delay>

                         <max-size-bytes>104857600</max-size-bytes>

                         <page-size-bytes>10485760</page-size-bytes>

                         <address-full-policy>PAGE</address-full-policy>       

                         <message-counter-history-day-limit>10</message-counter-history-day-limit>

                      </address-setting>

                   </address-settings>

                </configuration>

                 

                hornetq-jms.xml

                configuration xmlns="urn:hornetq"

                            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                            xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">

                 

                   <connection-factory name="ServletConnectionFactory">

                      <connectors>

                         <connector-ref connector-name="netty-servlet"/>

                      </connectors>

                      <entries>

                         <entry name="/ServletConnectionFactory"/>

                      </entries>

                   </connection-factory>

                 

                   <connection-factory name="NettyThroughputConnectionFactory">

                  <connectors>

                         <connector-ref connector-name="netty-throughput"/>

                  </connectors>

                <entries>

                <entry name="/ThroughputConnectionFactory"/>

                <entry name="/XAThroughputConnectionFactory"/>

                </entries>

                </connection-factory>

                 

                   <connection-factory name="InVMConnectionFactory">

                      <connectors>

                         <connector-ref connector-name="in-vm"/>

                      </connectors>

                      <entries>

                         <entry name="java:/ConnectionFactory"/>

                         <entry name="java:/XAConnectionFactory"/>

                      </entries>

                   </connection-factory>

                 

                   <queue name="DLQ">

                      <entry name="/queue/DLQ"/>

                   </queue>

                 

                   <queue name="ExpiryQueue">

                      <entry name="/queue/ExpiryQueue"/>

                   </queue>

                </configuration>

                 

                Actions on in my Applet

                this.params = new HashMap<String, Object>();
                           this.params.put("host", IP_adress);
                           this.params.put("port", "8080");
                           this.params.put("use-servlet", true);
                           this.params.put("servlet-path", "/HornetQServlet/HornetQServlet");

                params = new HashMap<String, Object>();

                params.put("host", "XXX.XX.XXX.XX);

                params.put("port", "8080");

                params.put("use-servlet", true);

                params.put("servlet-path", "/HornetQServlet/HornetQServlet");


                factory =  HornetQClient.createClientSessionFactory(new TransportConfiguration(NettyConnectorFactory.class.getName(), params));


                try {

                    session = this.factory.createSession();


                    //

                 

                 

                HornetQSessionHandler implements SessionFailureListener

                 

                 

                 

                 

                 

                 

                    session.addFailureListener(new HornetQSessionHandler(this));


                    nomTopicGeneral = "TopicHornetQ";

                              

                     ClientSession.QueueQuery qq = this.session.queueQuery(new SimpleString(this.nomTopicGeneral));

                     if (qq.isExists() == false){

                       

                session.createQueue(this.nomTopicGeneral, this.nomTopicGeneral);

                 

                 

                     }


                     

                producer = session.createProducer(nomTopicGeneral);

                 

                 

                      session.start();


                      consumer = session.createConsumer(this.nomTopicGeneral);

                     

                      //

                HornetQHandler implements MessageHandler

                      consumer.setMessageHandler(new HornetQHandler(this.session));

                 

                 


                 

                 

                     

                 

                 

                ClientMessage message = this.session.createMessage(true);

                 

                 

                 

                 

                      message.getBodyBuffer().writeString(textMessage);


                      producer.send(message);

                 

                 

                }

                 

                 

                catch (HornetQException e)

                {

                   e.printStackTrace();

                }


                • 5. Re: Client connection failed after a short time
                  Fabrice Oliveira Newbie

                  I tested applet example but with servlet transport. When i send messages no problem.

                  But if i don't send message after a period of 15/20 seconds, i have this error :

                   

                  at org.hornetq.jms.client.HornetQSession.checkClosed(HornetQSession.java:1002)
                  at org.hornetq.jms.client.HornetQSession.createTextMessage(HornetQSession.java:194)
                  at asblazeds.ASBlazeDS.actionPerformed(ASBlazeDS.java:229)
                  at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
                  at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
                  at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
                  at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
                  at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
                  at java.awt.Component.processMouseEvent(Unknown Source)
                  at javax.swing.JComponent.processMouseEvent(Unknown Source)
                  at java.awt.Component.processEvent(Unknown Source)
                  at java.awt.Container.processEvent(Unknown Source)
                  at java.awt.Component.dispatchEventImpl(Unknown Source)
                  at java.awt.Container.dispatchEventImpl(Unknown Source)
                  at java.awt.Component.dispatchEvent(Unknown Source)
                  at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
                  at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
                  at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
                  at java.awt.Container.dispatchEventImpl(Unknown Source)
                  at java.awt.Component.dispatchEvent(Unknown Source)
                  at java.awt.EventQueue.dispatchEvent(Unknown Source)
                  at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
                  at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
                  at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
                  at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
                  at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
                  at java.awt.EventDispatchThread.run(Unknown Source)

                  "javax.jms.JMSException: HornetQException[errorCode=2 message=Channel disconnected]

                  javax.jms.IllegalStateException: Session is closed

                  at org.hornetq.jms.client.HornetQSession.checkClosed(HornetQSession.java:1002)

                  at org.hornetq.jms.client.HornetQSession.createTextMessage(HornetQSession.java:194)

                  at asblazeds.ASBlazeDS.actionPerformed(ASBlazeDS.java:229)

                  at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

                  at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

                  at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

                  at javax.swing.DefaultButtonModel.setPressed(Unknown Source)

                  at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)

                  at java.awt.Component.processMouseEvent(Unknown Source)

                  at javax.swing.JComponent.processMouseEvent(Unknown Source)

                  at java.awt.Component.processEvent(Unknown Source)

                  at java.awt.Container.processEvent(Unknown Source)

                  at java.awt.Component.dispatchEventImpl(Unknown Source)

                  at java.awt.Container.dispatchEventImpl(Unknown Source)

                  at java.awt.Component.dispatchEvent(Unknown Source)

                  at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

                  at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

                  at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

                  at java.awt.Container.dispatchEventImpl(Unknown Source)

                  at java.awt.Component.dispatchEvent(Unknown Source)

                  at java.awt.EventQueue.dispatchEvent(Unknown Source)

                  at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

                  at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

                  at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

                  at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

                  at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

                  at java.awt.EventDispatchThread.run(Unknown Source)"

                   

                   

                  PS: I have this warnings before :

                  "21 oct. 2010 11:46:31 org.hornetq.core.logging.impl.JULLogDelegate warn

                  WARNING: Missing privileges to set Thread Context Class Loader on Thread Factory. Using current Thread Context Class Loader

                  21 oct. 2010 11:46:33 org.hornetq.core.logging.impl.JULLogDelegate warn

                  WARNING: Missing privileges to set Thread Context Class Loader on Thread Factory. Using current Thread Context Class Loader

                  21 oct. 2010 11:46:36 org.hornetq.core.logging.impl.JULLogDelegate warn

                  WARNING: Missing privileges to set Thread Context Class Loader on Thread Factory. Using current Thread Context Class Loader"

                  • 6. Re: Client connection failed after a short time
                    Clebert Suconic Master

                    It seems a bug... if you could open a JIRA please

                    • 8. Re: Client connection failed after a short time
                      aquee Newbie

                      Hi Fabrice,

                      I am facing the same issue.

                      have you got solution for this?

                      I visited the JIRA issue you have raised but it is closed.