users@grizzly.java.net

Re: Protecting Grizzly from running out of memory

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Mon, 07 Jul 2008 12:05:34 -0400

Salut,

easier way. Add:

-XX:+HeapDumpOnOutOfMemoryError

Thanks

-- Jeanfrancois

Mark Hig wrote:
> Hi,
>
> Is there any way of protecting Grizzly from running out of memory. At the
> moment I am loading my Grizzly server and, as you would expect, eventually
> it runs out of heap space as more and more requests queue up for processing:
>
> 07-Jul-2008 15:17:17 com.sun.grizzly.util.WorkerThreadImpl run
> SEVERE: WorkerThreadImpl unexpected exception:
> java.lang.OutOfMemoryError: Java heap space
> 07-Jul-2008 15:16:49 com.sun.grizzly.http.DefaultProcessorTask parseRequest
> INFO: SocketChannel request linejava.nio.channels.SocketChannel[connected
> local=/127.0.0.1:8000 remote=/127.0.0.1:1834] is: R(
> xmlns:directive="directive")
> 07-Jul-2008 15:17:19 com.sun.grizzly.arp.AsyncProcessorTask doTask
> SEVERE: Java heap space
> java.lang.OutOfMemoryError: Java heap space
> 07-Jul-2008 15:17:18 com.sun.grizzly.http.DefaultProcessorTask parseRequest
> INFO: SocketChannel request linejava.nio.channels.SocketChannel[closed] is:
> R( xmlns:directive="directive")
> 07-Jul-2008 15:17:16 com.sun.grizzly.http.DefaultProcessorTask parseRequest
> INFO: SocketChannel request linejava.nio.channels.SocketChannel[closed] is:
> R( xmlns:directive="directive")
> 07-Jul-2008 15:17:12 com.sun.grizzly.arp.AsyncProcessorTask doTask
> SEVERE: Java heap space
>
> Is there anyway of identifying that this situation is about to occur OR
> after the error has been thrown, to be able to stop the listener, allow
> Grizzly to continue processing to clear its queues and hence free up memory
> and then to re-start the listener to accept more requests?
>
> Thanks in advance for any help.
>
> Mark