1 Reply Latest reply on May 23, 2012 12:40 PM by clebert.suconic

    SetupAttempts=-1 and java.net.SocketException: Too many open files

    yves.p

      Hi everyone

       

      On an MDB I have set SetupAttempts to -1 so it try's to connect to the server indefinitely. This is used to be able to boot the HornetQ Server after the client and make the system more robust this way.

      Setup:

      JBoss 5.1 as the client with an MDB that uses a queue that doesn't exist (testQueueX).

      JBoss 7.1.1 as the HornetQ server.

       

      If there's a configuration error on the client like wrong queue name or wrong username/password the client try's to connect forever but never succeeds. Log on the client:

      16:53:35,568 INFO  [HornetQActivation] Attempting to reconnect org.hornetq.ra.inflow.HornetQActivationSpec(ra=org.hornetq.ra.HornetQResourceAdapter@1753bb9 destination=testQueueX destinationType=javax.jms.Queue ack=Auto-acknowledge durable=false clientID=null
      user=null maxSession=4)
      16:53:35,599 INFO  [HornetQActivation] awaiting topic/queue creation testQueueX
      

       

      After a while I get this error on the HornetQ Server:

      10:24:08,274 WARNING [org.jboss.netty.channel.socket.oio.OioServerSocketPipelineSink] (Old I/O server boss ([id: 0x007721e6, /0.0.0.0:5500])) Failed to accept a connection.: java.net.SocketException: Too many open files
              at java.net.PlainSocketImpl.socketAccept(Native Method) [rt.jar:1.7.0_04]
              at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:398) [rt.jar:1.7.0_04]
              at java.net.ServerSocket.implAccept(ServerSocket.java:522) [rt.jar:1.7.0_04]
              at java.net.ServerSocket.accept(ServerSocket.java:490) [rt.jar:1.7.0_04]
              at org.jboss.netty.channel.socket.oio.OioServerSocketPipelineSink$Boss.run(OioServerSocketPipelineSink.java:202)
              at org.jboss.netty.util.VirtualExecutorService$ChildExecutorRunnable.run(VirtualExecutorService.java:181)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_04]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_04]
              at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_04]
      

       

      What is strange is that this only happens if I put the ConnectorClassName and the ConnectionParameters directly into the hornetq-ra.rar like this:

      <connector>
          <resourceadapter>
              <config-property>
               <description>
                  The transport type. Multiple connectors can be configured by using a comma separated list,
                  i.e. org.hornetq.core.remoting.impl.invm.InVMConnectorFactory,org.hornetq.core.remoting.impl.invm.InVMConnectorFactory.
               </description>
               <config-property-name>ConnectorClassName</config-property-name>
               <config-property-type>java.lang.String</config-property-type>
               <config-property-value>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</config-property-value>
              </config-property>
      
      
              <config-property>
               <description>The transport configuration. These values must be in the form of key=val;key=val;,
                  if multiple connectors are used then each set must be separated by a comma i.e. host=host1;port=5445,host=host2;port=5446.
                  Each set of params maps to the connector classname specified.
               </description>
               <config-property-name>ConnectionParameters</config-property-name>
               <config-property-type>java.lang.String</config-property-type>
               <config-property-value>host=jspmessaging01y.uyellow.yellowcorp.test;port=5500;ssl-enabled=true;key-store-path=conf/keys/yellowJspDynWesTrust.jks;key-store-password=123456</config-property-value>
              </config-property>
      

       

      If I configure it in the ejb-jar.xml only one connection to the server gets opened:

      <ejb-jar>
          <enterprise-beans>
              <message-driven>
                  <activation-config>
                      <activation-config-property>
                          <activation-config-property-name>ConnectorClassName</activation-config-property-name>
                          <activation-config-property-value>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</activation-config-property-value>
                      </activation-config-property>
                      <activation-config-property>
                          <activation-config-property-name>ConnectionParameters</activation-config-property-name>
                          <activation-config-property-value>host=jspmessaging01y.uyellow.yellowcorp.test;port=5500;ssl-enabled=true;key-store-path=conf/keys/yellowJspDynWesTrust.jks;key-store-password=123456 
                          </activation-config-property-value>
                      </activation-config-property>
      

       

      Libraries:

      hornetq-ra.rar:

      hornetq-core-client-2.2.13.Final.jar

      hornetq-jms-2.2.13.Final.jar

      hornetq-ra-2.2.13.Final.jar

       

      jboss5/server/default/lib:

      hornetq-core-client-2.2.13.Final.jar

      hornetq-jboss-as-integration-2.2.13.Final.jar

      hornetq-jms-client-2.2.13.Final.jar

      netty-3.2.5.Final.jar

       

      Why does it work differently? Do I have the wrong libraries in the classpath?

       

      Thanks for your help,

      Yves