10 Replies Latest reply on Jul 31, 2012 9:19 AM by Justin Bertram

    Server dropping connection

    Robert Abnous Newbie

      Hi,

       

      I am using the example code provided within Core HornetQ distribution. I am putting a loop just to process high volume of short message, and after some small activity the connection is dropped by the server.

       

      I am attaching the code, can anyone please review and recommend what I am missing (is there more configuration I need to do for this to work?)

       

      Thanks,

      Robert

        • 1. Re: Server dropping connection
          Andy Taylor Master

          its hard to say,you wil have to give us some more info to be able to comment, versions, client side exceptions, server side exceptions or warnings, what your app is doing, etc etc. please try to be more specific and we can help you

          • 2. Re: Server dropping connection
            Robert Abnous Newbie

            Hi Andy,

             

            Thanks for the response.

             

            Can you please use the lastest stable release which is:  2.2.14.Final

             

            and then use the attached source code and compile it.

             

            All I have done is grabbed the example from the  hornetq-2.2.14.Final/examples/core/embedded/src/org/hornetq/core/example/EmbeddedExample.java

             

            and modified it such that I have an infinite loop of writer and reader, just like the following:

             

                    ClientProducer producer = session.createProducer(queueName);

             

                    // Step 6. Create and send a message

                    ClientMessage message = session.createMessage(false);

             

                    final String propName = "myprop";

             

                    message.putStringProperty(propName, "Hello sent at " + new Date());

             

                    System.out.println("Sending the message.");

                    // Step 7. Create the message consumer and start the connection

             

                    ClientConsumer messageConsumer = session.createConsumer(queueName);

                    session.start();

                       

                              long iS=0;

                              long iR=0;

                    while (true) {

             

                                  for (int i=0;i<2500;i++) {

                           producer.send(message);

                           iS++;

                                  }

                        

                                  for (int i=0;i<2500;i++) {

                           ClientMessage messageReceived = messageConsumer.receive();

                           messageReceived.acknowledge();

                           iR++;

                                  }

                        System.out.println(" messages Sent=" + iS + " Received="+iR);

                     }

             

             

            This works great for a while, then I get the following:

             

             

            Sending the message.

            messages Sent=2500 Received=2500

            messages Sent=5000 Received=5000

            messages Sent=7500 Received=7500

            messages Sent=10000 Received=10000

            messages Sent=12500 Received=12500

            messages Sent=15000 Received=15000

            messages Sent=17500 Received=17500

            messages Sent=20000 Received=20000

            messages Sent=22500 Received=22500

            messages Sent=25000 Received=25000

            messages Sent=27500 Received=27500

            messages Sent=30000 Received=30000

            messages Sent=32500 Received=32500

            messages Sent=35000 Received=35000

            messages Sent=37500 Received=37500

            Jul 18, 2012 2:17:18 PM org.hornetq.core.logging.impl.JULLogDelegate warn

            WARNING: I'm closing a core ClientSession you left open. Please make sure you close all ClientSessions explicitly before letting them go out of scope! 2137169521

            Jul 18, 2012 2:17:18 PM org.hornetq.core.logging.impl.JULLogDelegate warn

            WARNING: The ClientSession you didn't close was created here:

            java.lang.Exception

                      at org.hornetq.core.client.impl.DelegatingSession.<init>(DelegatingSession.java:95)

                      at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:848)

                      at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:326)

                      at EmbeddedExample.main(EmbeddedExample.java:76)

            Jul 18, 2012 2:17:18 PM org.hornetq.core.logging.impl.JULLogDelegate info

            INFO: HornetQ Server version 2.2.14.Final (HQ_2_2_14_FINAL, 122) [9b1bdfbd-cf6f-11e1-ae9a-c59096fe17f9] stopped

            HornetQException[errorCode=102 message=Consumer is closed]

                      at org.hornetq.core.client.impl.ClientConsumerImpl.checkClosed(ClientConsumerImpl.java:922)

                      at org.hornetq.core.client.impl.ClientConsumerImpl.receive(ClientConsumerImpl.java:184)

                      at org.hornetq.core.client.impl.ClientConsumerImpl.receive(ClientConsumerImpl.java:401)

                      at EmbeddedExample.main(EmbeddedExample.java:104)


            • 3. Re: Server dropping connection
              Andy Taylor Master

              its hard to say from that other than the connection has been closed, Is there no other warnings etc in the server or client logs.

              • 4. Re: Server dropping connection
                Robert Abnous Newbie

                I am using the embedded server. I am basically using the example that is provided within Hornetq, just adding a small loop to do a little volume testing.

                 

                Can you try the code that I have attached to this issue? You should be able to compile it very easily, the code is not very complicated.

                 

                You will see the problem running the code for just under 1 minute.

                • 5. Re: Server dropping connection
                  Andy Taylor Master

                  ive sucesfully run this for at least 20 minutes with no issues, are you seeing any other errors. What version are you using? can you try with master?

                  • 6. Re: Server dropping connection
                    Robert Abnous Newbie

                    Thank you for trying Andy.

                     

                    I am using 2.2.14.Final

                     

                    I use the following command line to run it. (I am not giving it any JVM parameters)

                     

                    #######################################

                    export HORNETLIB=/Users/rabnous/DevTools/hornetq-2.2.14.Final/lib

                    export CLASSPATH=$HORNETLIB/hornetq-bootstrap.jar:$HORNETLIB/hornetq-core-client-java5.jar:$HORNETLIB/hornetq-core-client.jar:$HORNETLIB/hornetq-core.jar:$HORNETLIB/hornetq-jboss-as-integration.jar:$HORNETLIB/hornetq-logging.jar:$HORNETLIB/jnp-client.jar:$HORNETLIB/jnpserver.jar:$HORNETLIB/netty.jar:

                     

                    java EmbeddedExample

                    #######################################

                    • 7. Re: Server dropping connection
                      Andy Taylor Master

                      since i cant re create it all i can suggest is you debug the consumer to see what is closing it

                      • 8. Re: Server dropping connection
                        Robert Abnous Newbie

                        Andy,

                         

                        I just tried this on a windows envrionment same problem! Its Embedded Server example:

                         

                        Here is what it outputs on windows:

                         

                         

                        C:\robert>java EmbeddedExample
                        Jul 30, 2012 4:02:58 PM org.hornetq.core.logging.impl.JULLogDelegate info
                        INFO: live server is starting with configuration HornetQ Configuration (clustered=false,backup=false,sharedStore=true,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/largemessages,pagingDirectory=data/paging)
                        Jul 30, 2012 4:02:58 PM org.hornetq.core.logging.impl.JULLogDelegate warn
                        WARNING: Security risk! It has been detected that the cluster admin user and password have not been changed from the installation default. Please see the HornetQ user guide, cluster chapter, for instructions on how to do this.
                        Jul 30, 2012 4:02:58 PM org.hornetq.core.logging.impl.JULLogDelegate info INFO: Server is now live
                        Jul 30, 2012 4:02:58 PM org.hornetq.core.logging.impl.JULLogDelegate info INFO: HornetQ Server version 2.2.14.Final (HQ_2_2_14_FINAL, 122) [7b0ccad7-da9a-11e1-9f7b-15a12c0326c4]) started
                        Sending the message.
                        messages Sent=2500 Received=2500
                        messages Sent=5000 Received=5000
                        messages Sent=7500 Received=7500
                        messages Sent=10000 Received=10000
                        messages Sent=12500 Received=12500
                        messages Sent=15000 Received=15000
                        messages Sent=17500 Received=17500
                        messages Sent=20000 Received=20000
                        messages Sent=22500 Received=22500
                        messages Sent=25000 Received=25000
                        Jul 30, 2012 4:03:00 PM org.hornetq.core.logging.impl.JULLogDelegate warn
                        WARNING: I'm closing a core ClientSession you left open. Please make sure you close all ClientSessions explicitly before letting them go out of scope! 19157736 Jul 30, 2012 4:03:00 PM org.hornetq.core.logging.impl.JULLogDelegate warn
                        WARNING: The ClientSession you didn't close was created here:
                        java.lang.Exception
                                at org.hornetq.core.client.impl.DelegatingSession.<init>(DelegatingSession.java:95)
                                at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:848)
                                at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:326)
                                at EmbeddedExample.main(EmbeddedExample.java:76)
                        Jul 30, 2012 4:03:01 PM org.hornetq.core.logging.impl.JULLogDelegate info
                        INFO: HornetQ Server version 2.2.14.Final (HQ_2_2_14_FINAL, 122) [7b0ccad7-da9a-11e1-9f7b-15a12c0326c4] stopped
                        HornetQException[errorCode=102 message=Consumer is closed]
                                at org.hornetq.core.client.impl.ClientConsumerImpl.checkClosed(ClientConsumerImpl.java:922)
                                at org.hornetq.core.client.impl.ClientConsumerImpl.receive(ClientConsumerImpl.java:184)
                                at org.hornetq.core.client.impl.ClientConsumerImpl.receive(ClientConsumerImpl.java:401)
                                at EmbeddedExample.main(EmbeddedExample.java:104)

                        C:\robert>

                         

                         

                         

                        I don't understand how it works for you. Are you giving more java command line parameteres? (i.e. jvm parameters) Are you using hornetq-2.2.14-Final?

                        • 10. Re: Server dropping connection
                          Justin Bertram Master

                          For posterity's sake can you describe the fix you implemented and the root cause of the problem?