directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johannes Zillmann <jz8_b...@yahoo.de>
Subject Re: [MINA] OutOfMemoryError on streaming large files
Date Wed, 14 Dec 2005 09:07:35 GMT
ello, i've tested to move splitting and writing file
out of filter:
--------------
FileInputStream inputStream = new
FileInputStream(file);
while (inputStream.available() > 0) {
  byte[] bytes = new byte[(int) (1024 * 4)];
  inputStream.read(bytes);
  session.write(bytes).join();
}

the filter:

if (message instanceof byte[]) {
  byte[] bytes=(byte[]) message;
  ByteBuffer buffer =
ByteBuffer.allocate(bytes.length);
  buffer.put(bytes);
  buffer.flip();
  nextFilter.filterWrite(session, new
WriteRequest(buffer, writeRequest.getFuture()));

-> no change
also i try 'session.write(ByteBuffer).join()'(buffers
of size 4*1024) but nothing changes
 
--------------

i seperate sender and receiver and exception raised on
sender around byte 67108864:

[SocketIoProcessor-0] WARN
org.apache.mina.common.support.DefaultExceptionMonitor
- Unexpected exception.
java.lang.OutOfMemoryError
        at java.nio.Bits.reserveMemory(Bits.java:618)
        at
java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:95)
        at
java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:285)
        at
sun.nio.ch.Util.getTemporaryDirectBuffer(Util.java:54)
        at sun.nio.ch.IOUtil.write(IOUtil.java:69)
        at
sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:300)
        at
org.apache.mina.transport.socket.nio.support.SocketIoProcessor.doFlush(SocketIoProcessor.java:501)
        at
org.apache.mina.transport.socket.nio.support.SocketIoProcessor.doFlush(SocketIoProcessor.java:435)
        at
org.apache.mina.transport.socket.nio.support.SocketIoProcessor.access$5(SocketIoProcessor.java:396)
        at
org.apache.mina.transport.socket.nio.support.SocketIoProcessor$Worker.run(SocketIoProcessor.java:629)
--------------

If i had not said before, the processing is as follow:
an IoHandler gets a FileRequestMessage and then writes
the content of file to the session. 
If tried that without any filter on writing side.

I tried also the messageSent() variant, but without
success...

Any ideas ?

Johannes



	

	
		
___________________________________________________________ 
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de

Mime
View raw message