Its hard to know which thread gets killed when you're out of memory.
Typically, its hard to recover from this state gracefully and its best to
restart your process. You could use the following JVM
args -XX:+HeapDumpOnOutOfMemoryError -XX:OnOutOfMemoryError
-XX:HeapDumpPath to take a heap dump and/or to kill the hung process. If
you get a dump, you can analyze it later for leaks or memory hogs. You may
also chose to have a nanny (e.g. monit) to restart the process whenever it
gets killed (or append it to the commend you run on -XX:OnOutOfMemoryError.

See:
https://confluence.atlassian.com/bitbucketserverkb/how-to-debug-out-of-memory-heap-space-779171691.html
for more information.

On Thu, Jul 13, 2017 at 1:37 PM, Steve Kradel <[email protected]> wrote:

> Is Dropwizard trying to create a new thread related to the exception, or
> is your application code?
>
> Can you retrieve Dropwizard's metrics from the admin service, and if so,
> are they informative?
>
> A health check is going to be tricky (things are bound to stop working
> unpredictably on OOM).  Perhaps you would prefer the server to halt so it
> can be restarted, until the cause of excess memory consumption can be
> discovered.
>
>
> On Thursday, July 13, 2017 at 10:47:28 AM UTC-4, [email protected] wrote:
>>
>>  Hi everybody,
>>
>> I ran into a problem where my Dropwizard based application can't create
>> any more native threads (java.lang.OutOfMemoryError: unable to create
>> new native thread), however there's apparently still enough memory to keep
>> the application running. This causes all subsequent requests to hang,
>> making the app unusable. At the same time requests to the admin port are
>> handled correctly, since admin connectors use a separate thread pool (
>> https://github.com/dropwizard/dropwizard/blob/master/
>> dropwizard-core/src/main/java/io/dropwizard/server/
>> DefaultServerFactory.java#L215).
>>
>> My problem is that I'm not sure how to detect this kind of situation.
>> Ideally I'd like to have a healthcheck for that, but it seems that the
>> state of the server/connectors is still set to "STARTED" after the error
>> occurs. Another solution would be to use the same thread pool for app and
>> admin connectors, since I don't know the original rationale of separating
>> them.
>>
>> Has anyone here had a problem like this? Any sugesstions?
>>
>> Thanks
>>
> --
> You received this message because you are subscribed to the Google Groups
> "dropwizard-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to