You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Matthew Phillips (JIRA)" <ji...@apache.org> on 2006/12/03 04:31:21 UTC

[jira] Created: (DIRMINA-320) Unexpected OutOfMemoryError exception in SocketConnectorIoProcessor

Unexpected OutOfMemoryError exception in SocketConnectorIoProcessor
-------------------------------------------------------------------

                 Key: DIRMINA-320
                 URL: http://issues.apache.org/jira/browse/DIRMINA-320
             Project: MINA
          Issue Type: Bug
          Components: Transport
    Affects Versions: 1.0
         Environment: Mac OS X, Java 1.5.0_06
            Reporter: Matthew Phillips


I'm not totally sure that this is a bug, but it's certainly a problem in that the error is partially hidden by being sent to the logger and not the exceptionCaught() method and seems to leave MINA in an unusable state.

The scenario is that I'm running some memory load tests by having a client fire lots of large messages at a server, and I occasionally see the sort of exception below appear on the client's console (the client is also MINA-based). It appears the heap is being blown and not being handled very gracefully. The client that sees this happen does not shut down cleanly, possibly because it's no longer able to send/receive the messages needed by my protocol to close the session.

The main problem is that the client has no idea this has happened and cannot take any action, it just fails ungracefully.

10822 [SocketConnectorIoProcessor-2.0] WARN org.apache.mina.common.support.DefaultExceptionMonitor - Unexpected exception.
java.lang.OutOfMemoryError: Direct buffer memory
	at java.nio.Bits.reserveMemory(Bits.java:633)
	at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:95)
	at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
	at sun.nio.ch.Util.getTemporaryDirectBuffer(Util.java:56)
	at sun.nio.ch.IOUtil.write(IOUtil.java:69)
	at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:302)
	at org.apache.mina.transport.socket.nio.SocketIoProcessor.doFlush(SocketIoProcessor.java:482)
	at org.apache.mina.transport.socket.nio.SocketIoProcessor.doFlush(SocketIoProcessor.java:414)
	at org.apache.mina.transport.socket.nio.SocketIoProcessor.access$600(SocketIoProcessor.java:44)
	at org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProcessor.java:567)
	at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:43)
	at java.lang.Thread.run(Thread.java:613)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Resolved: (DIRMINA-320) Unexpected OutOfMemoryError exception in SocketConnectorIoProcessor

Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/DIRMINA-320?page=all ]

Trustin Lee resolved DIRMINA-320.
---------------------------------

    Resolution: Invalid
      Assignee: Trustin Lee

According to the log message you gave us, the OutOfMemoryError occurred in the I/O worker thread rather than your business logic.  We cannot simply conclude that the session the I/O worker was trying to flush is really the root cause of the OutOfMemoryError.  Other session might have allocated huge memory block and other session might be being affected by its side-effect.  Therefore, you shouldn't rely solely on exceptionCaught() event.  Please try to set idle time and close the session when there's no communication with the remote peer.

> Unexpected OutOfMemoryError exception in SocketConnectorIoProcessor
> -------------------------------------------------------------------
>
>                 Key: DIRMINA-320
>                 URL: http://issues.apache.org/jira/browse/DIRMINA-320
>             Project: MINA
>          Issue Type: Bug
>          Components: Transport
>    Affects Versions: 1.0
>         Environment: Mac OS X, Java 1.5.0_06
>            Reporter: Matthew Phillips
>         Assigned To: Trustin Lee
>
> I'm not totally sure that this is a bug, but it's certainly a problem in that the error is partially hidden by being sent to the logger and not the exceptionCaught() method and seems to leave MINA in an unusable state.
> The scenario is that I'm running some memory load tests by having a client fire lots of large messages at a server, and I occasionally see the sort of exception below appear on the client's console (the client is also MINA-based). It appears the heap is being blown and not being handled very gracefully. The client that sees this happen does not shut down cleanly, possibly because it's no longer able to send/receive the messages needed by my protocol to close the session.
> The main problem is that the client has no idea this has happened and cannot take any action, it just fails ungracefully.
> 10822 [SocketConnectorIoProcessor-2.0] WARN org.apache.mina.common.support.DefaultExceptionMonitor - Unexpected exception.
> java.lang.OutOfMemoryError: Direct buffer memory
> 	at java.nio.Bits.reserveMemory(Bits.java:633)
> 	at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:95)
> 	at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
> 	at sun.nio.ch.Util.getTemporaryDirectBuffer(Util.java:56)
> 	at sun.nio.ch.IOUtil.write(IOUtil.java:69)
> 	at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:302)
> 	at org.apache.mina.transport.socket.nio.SocketIoProcessor.doFlush(SocketIoProcessor.java:482)
> 	at org.apache.mina.transport.socket.nio.SocketIoProcessor.doFlush(SocketIoProcessor.java:414)
> 	at org.apache.mina.transport.socket.nio.SocketIoProcessor.access$600(SocketIoProcessor.java:44)
> 	at org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProcessor.java:567)
> 	at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:43)
> 	at java.lang.Thread.run(Thread.java:613)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira