On 8/7/07, mat <[EMAIL PROTECTED]> wrote:
> In ClientSessionHandler
>
> public void messageReceived(IoSession session, Object message) {
>        // server only sends ResultMessage. otherwise, we will have to
> identify
>        // its type using instanceof operator.
>        ResultMessage rm = (ResultMessage) message;
>        if (rm.isOk()) {
>            // server returned OK code.
>            // if received the result message which has the last sequence
>            // number,
>            if (rm.getSequence() == values.length - 1) {
>                // print the sum and disconnect.
>                //System.out.println("The sum: " + rm.getValue());
>
>                for (int i = 0; i < values.length; i++) {
>                    AddMessage m = new AddMessage();
>                    m.setSequence(i);
>                    m.setValue(values[i]);
>                    session.write(m);
>                }
>
>                try
>    {
>     Thread.sleep(500);
>    } catch (InterruptedException e)
>    {
>     // TODO Auto-generated catch block
>     e.printStackTrace();
>    }
>
>                //session.close();
>                //finished = true;
>            }
>        } else {
>            // seever returned error code because of overflow, etc.
>            SessionLog.warn(session, "Server error, disconnecting...");
>            session.close();
>            finished = true;
>        }
>    }

Are you sure OOM is thrown on the server side?  If so, please provide
HEAP DUMP generated by 'jmap' command.

Your modification will lead to OOM on the client side, because any
received 'RESULT' message will not be processed until the current
messageReceived() event handler method returns.  You write many
messages in messageReceived() and sleep 500 ms.  MINA ExecutorFilter
will queue all received 'RESULT' messages in the internal queue, and
that will lead to OOM.  To avoid this problem, please try to add
ReadThrottleFilter.

If you didn't add any ExecutorFilter and set the thread model to
MANUAL, your client can also throw OOM because of too many write
request items in the internal write queue.  But it's less risky than
when ExecutorFilter is employed.

Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Reply via email to