JMH hangs between benchmarks (unable to kill forked JVM?)

Leszek Bartkowski leszekbartkowski at gmail.com
Thu Feb 27 00:24:31 PST 2014


That's what I suspected, because i observed similar behaviour during my
initial playing with jmh, when I was forgetting to shut down
executorservice.  Altough this time I couldn't believe this, since I was
shutting down everything properly, interrupting all threads.

However jstack proved you are right, and I discovered one thread is left
busy-spinning inside 3rd party code where it did not respond to
interruption due to highly-unlikely scenario that (obviously) eventually
happened. Since I couldn't do much about this I started creating those
threads as deamons to no longer have this issue.

Thanks for your help!


2014-02-19 8:38 GMT+00:00 Aleksey Shipilev <aleksey.shipilev at oracle.com>:

> On 02/19/2014 12:23 PM, Leszek Bartkowski wrote:
> > If I kill forked JVM manually the whole process unblocks. However
> > after finishing next benchmark it gets stuck again... Any ideas why
> > does it happen? And why it does NOT happen when I fire off the same
> > benchmark separately?
>
> We usually experience something like that when you don't close some
> resource preventing forked VM to exit: non-daemon threads, unfinished
> children tasks, etc. Can you replicate this and try to get the jstack on
> the forked VM (it should have ForkedMain as the entry point)?
>
> > Also, is there some timeout option in JMH, so it kills forked process
> > forcefully if normal shutdown takes too long?
>
> There is none, because the reliable "kill" for the forked VM is very
> hard to implement. It would be OK if we could just leave the stuck VM
> alone, and move on, but that is a bad idea for the performance
> measurement. We opted to catch fire and freeze if the forked VM
> misbehaves, pushing users to investigate and fix the workload.
>
> -Aleksey.
>


More information about the jmh-dev mailing list