You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@mina.apache.org by Emmanuel Lecharny <el...@apache.org> on 2008/05/01 00:02:50 UTC

Re: java.lang.OutOfMemoryError in Direct buffers or not (following DIRMINA-576)

Prusakova, Jane wrote:
> Lee, 
>
> Thanks for your response. 
>
> I switched to MINA 1.1.7. 
>
> The behavior is the same - seeing "java.lang.OutOfMemoryError: Direct
> buffer memory". 
>   
Q : why do you use direct buffers ?

-- 
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org



RE: java.lang.OutOfMemoryError in Direct buffers or not (following DIRMINA-576)

Posted by "Prusakova, Jane" <Ja...@intuit.com>.
Here's how we create SocketAcceptor: 

IoAcceptor acceptor = new
SocketAcceptor(Runtime.getRuntime().availableProcessors() + 1,
Executors.newCachedThreadPool());

Also:

SocketAcceptorConfig config = new SocketAcceptorConfig();
config.setThreadModel(ThreadModel.MANUAL);
config.getSessionConfig().setReuseAddress( true );
config.setReuseAddress(true);
....


-----Original Message-----
From: trustin@gmail.com [mailto:trustin@gmail.com] 
Sent: Wednesday, April 30, 2008 8:17 PM
To: users@mina.apache.org
Subject: Re: java.lang.OutOfMemoryError in Direct buffers or not
(following DIRMINA-576)

Are you creating SocketAcceptor with the default constructor?  If so,
could you try to use an alternative constructor to specify the Executor
explicitly?  You could take a look at the following document to choose
the correct constructor parameters:

http://mina.apache.org/configuring-thread-model.html

HTH,

Prusakova, Jane wrote:
> Running on Solaris 10:
> SunOS [box]  5.10 Generic_120011-14 sun4v sparc SUNW,Sun-Fire-T200
> 
> #   java -version
> java version "1.5.0_12"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04)
> Java HotSpot(TM) Server VM (build 1.5.0_12-b04, mixed mode)
> 
> The application handles clients' requests to store/retrieve data to
the
> DB. 
> All incoming bytes are quickly processed and discarded. 
> 
> There is plenty of memory available on the Java heap, and on the box.
> It only runs out of the Direct memory. 
>  
> Please see DIRMINA-576 for full description of the situation. 
> https://issues.apache.org/jira/browse/DIRMINA-576
> 
> 
> Sun people recommend increasing -XX:MaxDirectMemorySize setting, but
it
> seems that it will only make our servers crash a bit later. 
> 
> -----Original Message-----
> From: Emmanuel Lecharny [mailto:elecharny@gmail.com] On Behalf Of
> Emmanuel Lecharny
> Sent: Wednesday, April 30, 2008 4:46 PM
> To: users@mina.apache.org
> Subject: Re: java.lang.OutOfMemoryError in Direct buffers or not
> (following DIRMINA-576)
> 
> 
> Seems that Sun JVM use DirectBuffers internally for IO Operation.
Sorry,
> 
> I should have looked at the stack, and your first post , more
carefully
> :/
> 
> Which JVM are you using, on which OS ?
> 
> Now, I don't have any idea of how is your application dealing with
data,
> 
> if you store it in memory or discard it as soon as is has been read,
if 
> you copy the bytes to a in memory data structure, so it's difficult to

> give you some advices.
> 
> It seems though that your application just read as much data as it can

> without being able to process the incoming data fast enough, so you
are 
> getting short in memory.
> 

-- 
Trustin Lee - Principal Software Engineer, JBoss, Red Hat
--
what we call human nature is actually human habit
--
http://gleamynode.net/


Re: java.lang.OutOfMemoryError in Direct buffers or not (following DIRMINA-576)

Posted by 이희승 (Trustin Lee) <t...@gmail.com>.
Are you creating SocketAcceptor with the default constructor?  If so,
could you try to use an alternative constructor to specify the Executor
explicitly?  You could take a look at the following document to choose
the correct constructor parameters:

http://mina.apache.org/configuring-thread-model.html

HTH,

Prusakova, Jane wrote:
> Running on Solaris 10:
> SunOS [box]  5.10 Generic_120011-14 sun4v sparc SUNW,Sun-Fire-T200
> 
> #   java -version
> java version "1.5.0_12"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04)
> Java HotSpot(TM) Server VM (build 1.5.0_12-b04, mixed mode)
> 
> The application handles clients' requests to store/retrieve data to the
> DB. 
> All incoming bytes are quickly processed and discarded. 
> 
> There is plenty of memory available on the Java heap, and on the box.
> It only runs out of the Direct memory. 
>  
> Please see DIRMINA-576 for full description of the situation. 
> https://issues.apache.org/jira/browse/DIRMINA-576
> 
> 
> Sun people recommend increasing -XX:MaxDirectMemorySize setting, but it
> seems that it will only make our servers crash a bit later. 
> 
> -----Original Message-----
> From: Emmanuel Lecharny [mailto:elecharny@gmail.com] On Behalf Of
> Emmanuel Lecharny
> Sent: Wednesday, April 30, 2008 4:46 PM
> To: users@mina.apache.org
> Subject: Re: java.lang.OutOfMemoryError in Direct buffers or not
> (following DIRMINA-576)
> 
> 
> Seems that Sun JVM use DirectBuffers internally for IO Operation. Sorry,
> 
> I should have looked at the stack, and your first post , more carefully
> :/
> 
> Which JVM are you using, on which OS ?
> 
> Now, I don't have any idea of how is your application dealing with data,
> 
> if you store it in memory or discard it as soon as is has been read, if 
> you copy the bytes to a in memory data structure, so it's difficult to 
> give you some advices.
> 
> It seems though that your application just read as much data as it can 
> without being able to process the incoming data fast enough, so you are 
> getting short in memory.
> 

-- 
Trustin Lee - Principal Software Engineer, JBoss, Red Hat
--
what we call human nature is actually human habit
--
http://gleamynode.net/


RE: java.lang.OutOfMemoryError in Direct buffers or not (following DIRMINA-576)

Posted by "Prusakova, Jane" <Ja...@intuit.com>.
Running on Solaris 10:
SunOS [box]  5.10 Generic_120011-14 sun4v sparc SUNW,Sun-Fire-T200

#   java -version
java version "1.5.0_12"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04)
Java HotSpot(TM) Server VM (build 1.5.0_12-b04, mixed mode)

The application handles clients' requests to store/retrieve data to the
DB. 
All incoming bytes are quickly processed and discarded. 

There is plenty of memory available on the Java heap, and on the box.
It only runs out of the Direct memory. 
 
Please see DIRMINA-576 for full description of the situation. 
https://issues.apache.org/jira/browse/DIRMINA-576


Sun people recommend increasing -XX:MaxDirectMemorySize setting, but it
seems that it will only make our servers crash a bit later. 

-----Original Message-----
From: Emmanuel Lecharny [mailto:elecharny@gmail.com] On Behalf Of
Emmanuel Lecharny
Sent: Wednesday, April 30, 2008 4:46 PM
To: users@mina.apache.org
Subject: Re: java.lang.OutOfMemoryError in Direct buffers or not
(following DIRMINA-576)


Seems that Sun JVM use DirectBuffers internally for IO Operation. Sorry,

I should have looked at the stack, and your first post , more carefully
:/

Which JVM are you using, on which OS ?

Now, I don't have any idea of how is your application dealing with data,

if you store it in memory or discard it as soon as is has been read, if 
you copy the bytes to a in memory data structure, so it's difficult to 
give you some advices.

It seems though that your application just read as much data as it can 
without being able to process the incoming data fast enough, so you are 
getting short in memory.


Re: java.lang.OutOfMemoryError in Direct buffers or not (following DIRMINA-576)

Posted by Emmanuel Lecharny <el...@apache.org>.
Prusakova, Jane wrote:
> We don't ask for direct buffers.
>
> As recommended in the FAQ, we set
> 	ByteBuffer.setUseDirectBuffers(false);
> 	ByteBuffer.setAllocator(new SimpleByteBufferAllocator());
>   

Seems that Sun JVM use DirectBuffers internally for IO Operation. Sorry, 
I should have looked at the stack, and your first post , more carefully  :/

Which JVM are you using, on which OS ?

Now, I don't have any idea of how is your application dealing with data, 
if you store it in memory or discard it as soon as is has been read, if 
you copy the bytes to a in memory data structure, so it's difficult to 
give you some advices.

It seems though that your application just read as much data as it can 
without being able to process the incoming data fast enough, so you are 
getting short in memory.

You have options :
- throttling the incoming data so that you don't eat all the memory 
while you process already read bytes
- streaming the data to disk in order to avoid an OOM,
- increase your server memory...

Those are just general directions.


>
> -----Original Message-----
> From: Emmanuel Lecharny [mailto:elecharny@gmail.com] On Behalf Of Emmanuel Lecharny
> Sent: Wednesday, April 30, 2008 3:03 PM
> To: users@mina.apache.org
> Subject: Re: java.lang.OutOfMemoryError in Direct buffers or not (following DIRMINA-576)
>
> Prusakova, Jane wrote:
>   
>> Lee, 
>>
>> Thanks for your response. 
>>
>> I switched to MINA 1.1.7. 
>>
>> The behavior is the same - seeing "java.lang.OutOfMemoryError: Direct
>> buffer memory". 
>>   
>>     
> Q : why do you use direct buffers ?
>
>   


-- 
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org



RE: java.lang.OutOfMemoryError in Direct buffers or not (following DIRMINA-576)

Posted by "Prusakova, Jane" <Ja...@intuit.com>.
We don't ask for direct buffers.

As recommended in the FAQ, we set
	ByteBuffer.setUseDirectBuffers(false);
	ByteBuffer.setAllocator(new SimpleByteBufferAllocator());


-----Original Message-----
From: Emmanuel Lecharny [mailto:elecharny@gmail.com] On Behalf Of Emmanuel Lecharny
Sent: Wednesday, April 30, 2008 3:03 PM
To: users@mina.apache.org
Subject: Re: java.lang.OutOfMemoryError in Direct buffers or not (following DIRMINA-576)

Prusakova, Jane wrote:
> Lee, 
>
> Thanks for your response. 
>
> I switched to MINA 1.1.7. 
>
> The behavior is the same - seeing "java.lang.OutOfMemoryError: Direct
> buffer memory". 
>   
Q : why do you use direct buffers ?

-- 
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org