Wendy Pan
Wendy Pan

Reputation: 31

The JVM should have exitted but did not

While executing script using JMeter in non gui mode and remote testing i'm getting error message, how can I fix the problem

summary =      0 in 00:00:00 = ******/s Avg:     0 Min: 9223372036854775807 Max:
 -9223372036854775808 Err:     0 (0.00%)
Tidying up remote @ Sun Jan 07 21:00:11 EST 2018 (1515376811888)
... end of run
The JVM should have exitted but did not.
The following non-daemon threads are still running (DestroyJavaVM is OK):
Thread[Thread-5,5,main], stackTrace:java.net.DualStackPlainSocketImpl#accept0
java.net.DualStackPlainSocketImpl#socketAccept at line:131
java.net.AbstractPlainSocketImpl#accept at line:409
java.net.PlainSocketImpl#accept at line:199
java.net.ServerSocket#implAccept at line:545
java.net.ServerSocket#accept at line:513
bsh.util.Sessiond#run at line:71
java.lang.Thread#run at line:748

Thread[DestroyJavaVM,5,main], stackTrace:
Thread[Thread-3,5,main], stackTrace:java.net.DualStackPlainSocketImpl#accept0
java.net.DualStackPlainSocketImpl#socketAccept at line:131
java.net.AbstractPlainSocketImpl#accept at line:409
java.net.PlainSocketImpl#accept at line:199
java.net.ServerSocket#implAccept at line:545
java.net.ServerSocket#accept at line:513
bsh.util.Httpd#run at line:70
java.lang.Thread#run at line:748

Upvotes: 3

Views: 4274

Answers (5)

weljkodj
weljkodj

Reputation: 11

I have experienced this error in a distributed setup with Bean Shell server running on both master and slave nodes, where all were using same jmeter.properties config per https://jmeter.apache.org/usermanual/best-practices.html#beanshell_server:

beanshell.server.port=9000
beanshell.server.file=../extras/startup.bsh

Error was gone after removing those lines from master node jmeter.properties.

Upvotes: 0

Thiago Ruiz
Thiago Ruiz

Reputation: 61

I've got the same problem right now (I'm on version 4.0 of jmeter) and the solution was disable the beanshell server on jmeter.properties.

just comment beanshell.server.port=9000 in file jmeter.properties

Upvotes: 0

UBIK LOAD PACK
UBIK LOAD PACK

Reputation: 34536

It seems you have either custom code or some plugin that does not handle correctly exit as per this root stack trace:

bsh.util.Httpd#run at line:70

So check this script or report a bug for it.

Upvotes: 1

Dmitri T
Dmitri T

Reputation: 168082

Most likely your JMeter is overloaded, i.e. you are trying to kick off too many threads on a machine having low hardware specifications or you didn't properly tune JMeter for high loads or both.

  1. Make sure you're following JMeter Best Practices
  2. Make sure you're following recommendations from Load Test running User Manual chapter
  3. Set up monitoring of essential OS level health metrics (CPU, RAM, Swap, Disk and Network usage). Modern operating systems normally come with a set of utilities, alternatively you can use JMeter PerfMon Plugin, this way you will be able to correlate main performance metrics with resource utilisation. JMeter must have enough headroom to operate as if JMeter won't be able to send requests fast enough you won't be able to conduct the planned load

Upvotes: -2

timbre timbre
timbre timbre

Reputation: 13980

The exception comes from daemon thread, as described here:

JMeter will exit all the non-daemon threads it starts, but it is possible that some non-daemon threads may still remain; these will prevent the JVM from exiting. To detect this situation, JMeter starts a new daemon thread just before it exits. This daemon thread waits a short while; if it returns from the wait, then clearly the JVM has not been able to exit, and the thread prints a message to say why.

From the exception details it appears that you have some socket connections. Those could be HTTP Samplers, some other samplers that open sockets or custom scripts. By default the daemon thread waits for 2 seconds, so if timeouts on any samplers are longer, it could be that daemon simply needs to wait longer (or you need to make timeouts shorter).

So:

  1. Check your script and figure out what are the timeouts of the samplers. Either set them to numbers < 2 seconds, or change the following setting in jmeter.properties to be higher than the maximum timeout value:

    jmeter.exit.check.pause=...
    

    For example if your sampler is configured to wait for 30 sec., set this value to 32 sec.

  2. If it doesn't help, it's likely that there's some bug in underlying library. In that case you can't really solve it, but you can use a fairly brutal workaround:

    If the property jmeterengine.stopfail.system.exit is set to true (default is false), then JMeter will invoke System.exit(1) if it cannot stop all threads. Normally this is not necessary.

    So set the following property to true as described here:

    jmeterengine.stopfail.system.exit=true
    

    As help says, normally it's not necessary, but if threads are really stuck, there's no much choice.

Upvotes: 3

Related Questions