[jboss-user] [Messaging, JMS & JBossMQ] - Re: OutOfMemory because of too many threads and not sure wha

adrian@jboss.org do-not-reply at jboss.com
Mon Jul 23 06:49:05 EDT 2007


"zooxmusic" wrote : 
  | Is there anyway to detect a broken connection on the server side and kill the threads? 
  | 

The server already does this. It disconnects clients that have stopped pinging
after 2 minutes (See "Read Timeout" in uil2-service.xml).

Most likely you've not closed the connection after you got "client id" error message
so it is still open and pinging the server.

It's one of the common errors, the initialization code should look like this:


  | Connection c = connectionFactory.createConnection(...);
  | try
  | {
  |    c.setClientId(x);
  | }
  | catch (JMSException e)
  | {
  |    // Failed to initialize (close the connection!)
  |    try
  |    {
  |       c.close();
  |    }
  |    catch (JMSException ignored) {}
  |    throw e;
  | }
  | 

Of course, you could wait until the client side VM does a full GC,
but by then you've probably got hundreds of open connections lying around.

It's never a good idea to leave resource intensive objects to be closed by
the garbage collector.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4066595#4066595

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4066595



More information about the jboss-user mailing list