Hi, I use mina 2.0.7 as a server to receive message.

Usually after 2 weeks to server stop to run with an exception out of memory
(receive from exceptionCaught in mina handler).

My server open 1 connection and never close it. It's a client establish with
my server and send message. I did some memory monitor and it's look like
something is never clear in mina. If I close the connection the memory is
completely cleared by the CG. 

The memory is loaded with full of byte[].

I use java 1.6 32 bit. And I have 1G available for java.

Some code :

 public boolean connect() throws CommunicationException {
        boolean result = false;
        int port = 0;
        try {
            InetSocketAddress socketInfo = getInetSocketAddress();
            port = socketInfo.getPort();
            getIoAcceptor().bind(socketInfo);
           
            result = getIoAcceptor().isActive();
        } catch (IOException e) {
            throw new CommunicationException("MinaServerComImpl.connect :
MinaServerCom got exception trying to bind to port: " + port, e);
        } catch (MinaSupportConfigurationException e) {
            throw new CommunicationException("MinaServerComImpl.connect :
MinaServerCom got exception trying to convert the port in number: ", e);
        }

        return result;
    }

private InetSocketAddress getInetSocketAddress() throws
MinaSupportConfigurationException {
        if (inetSocketAddress == null) {
            LogTools.getLogger().logMessage("MinaServerComImpl.connect :
MinaServerComImpl get port....");
            int port = getConfigOptions().getPort();
            inetSocketAddress = new InetSocketAddress(port);
        }
        return inetSocketAddress;
    }

    private IoAcceptor getIoAcceptor() {
        if ((acceptor == null) || acceptor.isDisposed()) {
            acceptor = new NioSocketAcceptor();
           
LogTools.getLogger().logTraceMessage("MinaServerComImpl.getIoAcceptor :
protocolCodecFactory is not null : " + (protocolCodecFactory != null));
            acceptor.getFilterChain().addLast("codec", new
ProtocolCodecFilter(protocolCodecFactory));
            acceptor.setHandler(handler);
        }

        return acceptor;
    }


The handler

public void messageReceived(IoSession session, Object message) throws
MinaSupportException {
            //message threatement....
       
    }

Ay idea? Direction I can looking for my problem?

Thanks for your help
 



--
View this message in context: 
http://apache-mina.10907.n7.nabble.com/Mina-2-0-7-Java-Heap-Issue-Out-of-memory-tp43918.html
Sent from the Apache MINA User Forum mailing list archive at Nabble.com.

Reply via email to