cloudfoundry / jvmkill

Terminate the JVM when resources are exhausted
Apache License 2.0
30 stars 11 forks source link

can't printHeapHistogram dump when OOM heap exhaust happen #5

Closed llv22 closed 7 years ago

llv22 commented 8 years ago

@glyn I build jvmkill-1.1.0.so library from forked repository https://github.com/llv22/jvmkill (without any change), and forked replace-killjava-script-with-jvmkill-agent-114796351 branch from https://github.com/cloudfoundry/java-buildpack into branch jvmkill-agent-114796351 of https://github.com/llv22/java-buildpack. with setting printHeapHistogram=1 in https://github.com/llv22/java-buildpack/blob/jvmkill-agent-114796351/lib/java_buildpack/jre/jvmkill_agent.rb.

Now application onto cloud foundry could get HeapHistogram, when thread overflow happened. However, when heap overflow happened using the following code:

public static void heapOOM() {
    new Thread( () -> {
        final List<JavaOOMTriggerUtil> list = new ArrayList<JavaOOMTriggerUtil>();
        while(true) {
            list.add(new JavaOOMTriggerUtil());
        }
    }).start();
}

in error stream, I can only get information:

{"cc_partition"=>"default", "droplet"=>"c2a99602-08ec-4904-bb3d-3550936bbd68", "version"=>"5374253e-3df8-456f-966e-9740520407e0", "instance"=>"5876495d438d49249b6865b2e6429a46", "index"=>0, "reason"=>"CRASHED", "exit_status"=>255, "exit_description"=>"out of memory", "crash_timestamp"=>1476005982}

without any heap histogram for this case.

could you help us take a look for this? or give me some suggestions for how to get heap histogram or callstack in this case.

glyn commented 8 years ago

The heap histogram should appear in the application logs, so make sure you are tailing those before provoking the OOM.

To make sure your options are being passed through to the agent correctly, try adding an invalid option alongside printHeapHistogram and make sure you get a warning in the application logs.

nebhale commented 7 years ago

Since there's been no response on this issue in a couple of months, I'm going to close it. If you'd like to see it re-opened, please comment on the issue and I'll reopen it.