hg: code-tools/jmh: 7901244: Forceful shutdown of forked VM when there are uncontrollable user threads

Dawid Weiss dawid.weiss at gmail.com
Tue Jan 13 09:50:23 UTC 2015


Two notes about forceful exit in this commit:

> System.exit(0);

When there is user code involved my experience is that a forceful-exit
is better done by Runtime.halt(), which doesn't try to run any
shutdown hooks or finalizers. I've had user code that simply hung in
those, effectively preventing the forceful exit...

A funnier hack might be to tell the JVM to exit itself after a given
deadline... it's my favorite JVM switch ever, after all (and yeah, I
know it's not portable and undocumented, but who cares):

  product(intx, SelfDestructTimer, 0,                                       \
          "Will cause VM to terminate after a given time (in minutes) "     \
          "(0 means off)")                                                  \

Dawid


On Tue, Jan 13, 2015 at 10:32 AM,  <aleksey.shipilev at oracle.com> wrote:
> Changeset: d15ebde32b25
> Author:    shade
> Date:      2015-01-13 12:32 +0300
> URL:       http://hg.openjdk.java.net/code-tools/jmh/rev/d15ebde32b25
>
> 7901244: Forceful shutdown of forked VM when there are uncontrollable user threads
> Summary: Implement a shutdown timeout.
>
> ! jmh-core/src/main/java/org/openjdk/jmh/generators/core/BenchmarkGenerator.java
> ! jmh-core/src/main/java/org/openjdk/jmh/runner/ForkedMain.java
>


More information about the jmh-dev mailing list