Hi !

I'm interesting by this problem.
- Have you 1000 CLOSE_WAIT or less ?
- Do you know if these CLOSE_WAIT disappear after a while ? 
- Do you know if these CLOSE_WAIT happen if messages are consumed ?

Eric-AWL


a...@frogl wrote:
> 
> This simple example will show connections accumulating in CLOSE_WAIT on a
> 2.6.31 Linux kernel (Ubuntu) and Solaris10.  This is true for the most
> recent release 5.3.0 and 5.1.X (which I am currently using).   
> 
> I have read the forum entries relating the issues relating to CLOSE_WAIT,
> but there seems to be no conclusive reason why this is actually happening.  
> 
> I have tried a number of configuration options, as suggested by the forum
> - including the use of (not available to 5.1.X)
> 
>       <transportConnectors>
>         <transportConnector name="openwire"
> uri="tcp://localhost:61616?transport.closeAsync=false"/>
>      </transportConnectors>
> 
> but none seem to prevent it from happening.
> 
> As lifted from the most trivial of "hello worlds"
> 
> public static void main(String[] args) throws Exception
>       {
>               int i = 0;      
>               while(i++ < 1000)
>               {
>                       SendTest sendTest = new SendTest();
>                       sendTest.send();
>               }
>       }
>       private void send()
>       {
>                   try {
>                       ActiveMQConnectionFactory connectionFactory = new
> ActiveMQConnectionFactory("tcp://127.0.0.1:61616");
>                       Connection connection =
> connectionFactory.createConnection();
>                       connection.start();
> 
>                       Session session = connection.createSession(false,
> Session.AUTO_ACKNOWLEDGE);
> 
>                       Destination destination =
> session.createQueue("TEST.FOO");
> 
>                       MessageProducer producer =
> session.createProducer(destination);
>                       producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
> 
>                       String text = "Hello world! From: " +
> Thread.currentThread().getName() + " : " + this.hashCode();
>                       TextMessage message = session.createTextMessage(text);
> 
>                       System.out.println("Sent message: "+ message.hashCode() 
> +
> " : " + Thread.currentThread().getName());
>                       producer.send(message);
>                       session.close();
>                       connection.close();
>                   }
>                   catch (Exception e) {
>                       System.out.println("Caught: " + e);
>                       e.printStackTrace();
>                   }
>       }
> 
> Running it results in the following,
> 
> a...@frogl:~/apps/apache-activemq-5.3.0/bin$ netstat -a |grep CLOSE
> tcp6       0      0 localhost:61616         localhost:46831        
> CLOSE_WAIT
> tcp6       0      0 localhost:61616         localhost:46944        
> CLOSE_WAIT
> tcp6       0      0 localhost:61616         localhost:46856        
> CLOSE_WAIT
> tcp6       0      0 localhost:61616         localhost:46978        
> CLOSE_WAIT
> tcp6       0      0 localhost:61616         localhost:46489        
> CLOSE_WAIT
> tcp6       0      0 localhost:61616         localhost:46890        
> CLOSE_WAIT
> tcp6       0      0 localhost:61616         localhost:47257        
> CLOSE_WAIT
> a...@frogl:~/apps/apache-activemq-5.3.0/bin$
> 
> I am well aware that re-using the connection is preferable. Can anybody
> provide any additional insight as to why these connections result in
> CLOSE_WAITs?   Thanks in advance
> 
>     
> 

-- 
View this message in context: 
http://old.nabble.com/Connection-handling-%2B-TCP-CLOSE_WAIT-on-Linux-%2B-Solaris-tp26006364p26925942.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to