7 Replies Latest reply: Jul 20, 2012 8:16 AM by Andy Taylor RSS

Connection failure detected

Gerald Weber Newbie

Hi,

 

i use hornetq 2.2.14 final with core only + embedded without any configuration files.

Everything is setup and configured in my java code.

 

 

{code}

try {

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

  map.put("host", "192.168.20.150");

  map.put("port", 8989);

 

  Configuration configuration = new ConfigurationImpl();

  configuration.setPersistenceEnabled(false);

  configuration.setSecurityEnabled(false);

  HashSet<TransportConfiguration> transports = new HashSet<TransportConfiguration>();

  transports.add(new TransportConfiguration(NettyAcceptorFactory.class.getName(),map));

  //transports.add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));

  configuration.setAcceptorConfigurations(transports);           

 

 

  EmbeddedHornetQ embedded = new EmbeddedHornetQ();

  embedded.setConfiguration(configuration);

  embedded.start();

 

  //ServerLocator serverLocator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(InVMConnectorFactory.class.getName()));

  ServerLocator serverLocator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(NettyConnectorFactory.class.getName(),map));

  serverLocator.setConnectionTTL(-1);

  serverLocator.setClientFailureCheckPeriod(-1);

  ClientSessionFactory sf = serverLocator.createSessionFactory();

 

 

  ClientSession coreSession = sf.createSession(false, false, false);

  coreSession.createQueue(queueName, queueName, true);

  coreSession.close();

 

 

  session = sf.createSession();

  producer = session.createProducer(queueName);   

} catch (Exception e) {

e.printStackTrace();

}

{code}

 

After this, i setup my ZeroMQ Subscriber connection and wait for a message in a loop:

 

{code}

while(true) {

byte[] m = sub.recv(0); // blocks here

... handle message here then send it over hornetq

producer.send(message);

{code}

 

Even if no client is connected and with the timeouts disabled i get the error

 

Jul 19, 2012 3:51:14 PM org.hornetq.core.logging.impl.JULLogDelegate warn

Warnung: Connection failure has been detected: Did not receive data from /192.168.20.150:24791. It is likely the client has exited or crashed without closing it

s connection, or the network between the server and client has failed. You also might have configured connection-ttl and client-failure-check-period incorrectly

. Please check user manual for more information. The connection will now be closed. [code=3]

 

 

I dont get this one...why does this happen ?

 

regards,

gw

  • 1. Re: Connection failure detected
    Gerald Weber Newbie

    Hmm...just realized there is a thread with exactly the same problem

    "Server dropping connection"

  • 2. Re: Connection failure detected
    Gerald Weber Newbie

    Seems i have a serious problem with my design and/or my understanding of hornetq.

    i changed my server code to create everything after receiving the message over zmq.

    so my loop looks like this:

    - wait for zmq message

    - create server locator

    - create sessionfactory

    - create session

    - create message

    - send message to queue

    - close everything.

     

    same on clientside.

     

    and i still get a connection failure

     

    sources of server and client are attached,console output from server:

     

    INIT HORNETQ

    Jul 20, 2012 9:54:05 AM org.hornetq.core.logging.impl.JULLogDelegate info

    Information: live server is starting with configuration HornetQ Configuration (clustered=false,backup=false,sharedStore=true,journalDirectory=data/journal,bindi

    ngsDirectory=data/bindings,largeMessagesDirectory=data/largemessages,pagingDirectory=data/paging)

    Jul 20, 2012 9:54:05 AM org.hornetq.core.logging.impl.JULLogDelegate warn

    Warnung: Security risk! It has been detected that the cluster admin user and password have not been changed from the installation default. Please see the Hornet

    Q user guide, cluster chapter, for instructions on how to do this.

    Jul 20, 2012 9:54:05 AM org.hornetq.core.logging.impl.JULLogDelegate info

    Information: Started Netty Acceptor version 3.2.5.Final-a96d88c 192.168.20.150:8989 for CORE protocol

    Jul 20, 2012 9:54:05 AM org.hornetq.core.logging.impl.JULLogDelegate info

    Information: Server is now live

    Jul 20, 2012 9:54:05 AM org.hornetq.core.logging.impl.JULLogDelegate info

    Information: HornetQ Server version 2.2.14.Final (HQ_2_2_14_FINAL, 122) [18ad2d0b-d1ba-11e1-89b4-5121b8569e0f]) started

    INIT ZMQ

    EVENT# 1158 , NAME: CUSTOM , TS: 1342770659905391 , AGENT: 70220 , ACTION: agent-status-change

    Jul 20, 2012 9:56:14 AM org.hornetq.core.logging.impl.JULLogDelegate warn

    Warnung: Connection failure has been detected: Did not receive data from /192.168.20.150:30045. It is likely the client has exited or crashed without closing it

    s connection, or the network between the server and client has failed. You also might have configured connection-ttl and client-failure-check-period incorrectly

    . Please check user manual for more information. The connection will now be closed. [code=3]

    Jul 20, 2012 9:56:14 AM org.hornetq.core.logging.impl.JULLogDelegate warn

    Warnung: Client connection failed, clearing up resources for session 1905b671-d240-11e1-95e7-95700f59b1d5

    Jul 20, 2012 9:56:14 AM org.hornetq.core.logging.impl.JULLogDelegate warn

    Warnung: Cleared up resources for session 1905b671-d240-11e1-95e7-95700f59b1d5

     

     

    I have really no clue why this happens, can anyone please tell me whats wrong with my code ?

     

    thanks

  • 3. Re: Connection failure detected
    Andy Taylor Master

    its hard to say, could be network issues, memory problems with the server etc etc, however looking at your code it looks like you are opening a new connection for every message which is a no no, perhaps the OS/server is just running out of sockets or resources

  • 4. Re: Connection failure detected
    Gerald Weber Newbie

    hi,

     

    thanks for your answer.

     

    In my original code (first post), i open only one session and then i try to send / receive the messages in a loop with receive and send only.

    Even there i get the connection failure. Then i started to experiment and the last version is the code i attached. i know it sucks but i'm running out if ideas.

     

    the os is win7 64bit, and i dont think i'm running out of resources, (6gb free)

     

    Both of server and client running on the same machine.

    I also wonder why setconnectionttl and setClientFailureCheckPeriod dont affect the behaviour of the server.

     

    I've uploaded a new version of my testserver, but even sending no messages and no other clients connected i get the connection failure.

    Basically,is my approach correct ?

     

    You say opening a connection for every message is a no no.

    But it doesnt work with opening only one connection either.

     

    thanks,

    gw

  • 5. Re: Connection failure detected
    Andy Taylor Master

    i cant really say whats wrong, do you get the same issue when you use the default ttl etc

  • 6. Re: Connection failure detected
    Gerald Weber Newbie

    seems to work without setting connectionttl and clientfailurecheckperiod

  • 7. Re: Connection failure detected
    Andy Taylor Master

    it could be a bug when setting these both to -1 in this fashion, is there a reason you needed to do this?