Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On OOME: heap error, kill agent freezes #33

Open
dmikusa opened this issue Aug 8, 2022 · 0 comments
Open

On OOME: heap error, kill agent freezes #33

dmikusa opened this issue Aug 8, 2022 · 0 comments
Labels

Comments

@dmikusa
Copy link

dmikusa commented Aug 8, 2022

In some circumstances, if you fill up the heap and initiate an OOME: Heap error, you will see the memory histogram however the process won't exit. It'll hang at Memory usage:.

The test I used here was https://github.com/dmikusa-pivotal/java-memory-waster with a 1G memory limit & create 200,000 pieces of garbage & retain a reference to them. This happens on 1.16.0 & 1.17.0 (probably older as well). It happened on Java 8 & 11.

This is where we try to get some memory stats from the JVM:

        writeln_paced!(output, "\nMemory usage:");
        let get_memory_mxbean_method_id = jni_env.get_static_method_id(
            mf_class,
            "getMemoryMXBean",
            "()Ljava/lang/management/MemoryMXBean;",
        )?;
        let memory_mxbean =
            jni_env.call_static_object_method(mf_class, get_memory_mxbean_method_id)?;

It is possible that the JVM is not in a state where it can respond to that call, perhaps the heap is too full to make any progress.

At any rate, we should probably put a timeout on method calls after the JVM has gone into an OOME such that we skip metrics but still do everything we can to kill the process. The most important thing is that the process gets killed.

@dmikusa dmikusa added the bug label Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant