10 Replies Latest reply on Feb 28, 2006 7:40 AM by Lauri

    Memory leak and tons of org.jboss.mq.SpyTopic and org.jboss.

    Lauri Newbie

      Hello people.

      I'm new to JBoss (~month of experience), however i've migrated production installation of project to JBoss from SunApplication server.
      It runs much better, but we're now facing memory leak.
      We're running jboss as application server and some socket daemons as clients for the server.
      Now both (client and server) consumes memory. I've compared "jmap -histo pid" results for client after 12 hours of heavy load.
      It is obivious that amount
      org.jboss.mq.SpyTopic and
      org.jboss.mq.AcknowledgementRequest has grown
      Was (1column is bytes, 2nd - amount of instances, 3d - class name):

      182016 7584 org.jboss.mq.SpyTopic
      181992 7583 org.jboss.mq.AcknowledgementReque

      After 12 hours

      917760 38240 org.jboss.mq.SpyTopic
      917736 38239 org.jboss.mq.AcknowledgementRequest

      The client-server uses JMS communication a lot.
      Client message handler:
      public void onMessage(javax.jms.Message message) {
       try {
       message.acknowledge();
       MapMessage mapMessage = (MapMessage) message;
       //...........actions on message
       } catch (JMSException jmsEx) {
       logger.log(Level.INFO, "Error processing message", jmsEx);
       } catch (ClassCastException cCEx) {
       logger.fine(cCEx.getMessage());
       }
      
       }
      

      Server side (in session and eninty beans) message producer
       private void notifyClientListeners(Integer playerId, String serverId) {
       try {
       TopicSession session = null;
       Topic topic = this.serverTopic; // acquired in ejbCreate from JNDI env.
       TopicConnectionFactory tcf = this.jmsFactory; // acquired in ejbCreate from JNDI env.
       TopicConnection conn = tcf.createTopicConnection(this.jmsUserName, this.jmsUserPassword);
      
       session = conn.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
       conn.start();
      
       TopicPublisher send = session.createPublisher(topic);
      
       MapMessage mapMessage = session.createMapMessage();
       mapMessage.setString(JMSConstants.JMS_MESSAGE_NAME, JMSConstants.JMS_PLAYER_CONNECT);
       mapMessage.setInt(JMSConstants.JMS_PLAYER_ID, playerId.intValue());
       mapMessage.setString(JMSConstants.JMS_SERVER_ID, serverId);
      
       send.publish(mapMessage);
      
       send.close();
       session.close();
       conn.close();
       } catch (Exception ex) {
       logger.log(Level.WARNING, "Unable to notify servers", ex);
       }
       }
      


      JMS connectivity works using mysql. Here we have a error too. Sometimes following error occures:
      06:25:45,394 WARN [LocalManagedConnectionFactory] Destroying connection that is not valid, due to the following exception: com.mysql.jdbc.Connection@3d7ba3
      com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

      ** BEGIN NESTED EXCEPTION **

      java.net.SocketException
      MESSAGE: Connection reset

      STACKTRACE:

      java.net.SocketException: Connection reset
      at java.net.SocketInputStream.read(SocketInputStream.java:113)
      at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:113)

      This error occures in many cases, JMS, entiny beans and so on. But we don't have data loss.