Skip to content

JMeter Freezing, 100% CPU Usage & CLI Hanging at End

Troubleshoot JMeter GUI freezing, 100% CPU utilization on load generators, and CLI tests hanging at completion with thread dumps and JVM tuning.

Difficulty
intermediate
Guide type
troubleshooting
Estimated read time
7 min read
Last verified version
Verified JMeter 5.6

JMeter Freezing, 100% CPU Usage & CLI Hanging

Section titled “JMeter Freezing, 100% CPU Usage & CLI Hanging”

You encounter one of the following performance bottlenecks on the load generator machine:

  1. JMeter GUI completely freezes / becomes unresponsive: The window grays out or locks up during a test run.
  2. 100% CPU saturation on the load injector: JMeter consumes all CPU cores on the testing host, causing request times to distort and throughput to plateau.
  3. CLI execution hangs at the end of a test: The test duration finishes, but the terminal command prompt never returns, and the process remains stuck indefinitely.
  • GUI Freeze: Running tests with active listeners (e.g. View Results Tree) in GUI mode consumes memory and blocks the Swing event dispatch thread.
  • 100% CPU on Injector: Caused by CPU-intensive JSR223 Groovy parsing (missing cache), catastrophic regex backtracking, full GC loops, or excessive disk logging.
  • CLI Hang: Non-daemon background threads (unclosed DB connections, async listeners, or alive RMI engines) preventing the JVM from exiting.
SymptomPrimary CauseWhy it happens
GUI FreezeListeners in GUIView Results Tree stores full XML/JSON response payloads in RAM, blocking UI threads
100% CPUInefficient RegEx / GroovyComplex regex patterns with catastrophic backtracking, or recompiling Groovy scripts
100% CPUContinuous Garbage CollectionJava Heap nearly full, triggering back-to-back Full GC pauses
CLI HangNon-daemon active threadsCustom plugins, Backend Listeners (InfluxDB/Kafka), or open JDBC pools blocking process exit
CLI HangRemote RMI enginesDistributed testing controller waiting for unresponsive worker nodes

1. Always Run Load Tests in Non-GUI (CLI) Mode

Section titled “1. Always Run Load Tests in Non-GUI (CLI) Mode”

Never use the JMeter GUI for actual load generation. Use GUI strictly for test plan creation and debugging with 1–2 virtual users:

Terminal window
# Standard Non-GUI execution command
jmeter -n -t testplan.jmx -l results.jtl -j jmeter.log

2. Diagnose Active Threads with a JVM Thread Dump

Section titled “2. Diagnose Active Threads with a JVM Thread Dump”

When a CLI test hangs or freezes, take a thread dump to identify the exact blocking thread:

Terminal window
# 1. Find the JMeter process ID
jps -v | grep ApacheJMeter
# 2. Capture the stack trace of all running threads
jstack <PID> > thread_dump.txt

Look for threads in the RUNNABLE or BLOCKED state:

  • BackendListener or InfluxDBRawData: Waiting for remote metrics flush.
  • StandardJMeterEngine: Waiting for lingering worker threads to exit.
  • HikariPool / JDBC: Open database connection pool connections.

3. Force CLI Process Exit on Test Completion

Section titled “3. Force CLI Process Exit on Test Completion”

If a third-party plugin or listener leaves background non-daemon threads open, configure JMeter to force JVM exit when the test finishes:

Add to bin/user.properties or pass via CLI:

# Force JVM exit (System.exit(0)) when engine finishes test
jmeterengine.force.system.exit=true
# Maximum time (in milliseconds) to wait for threads to stop on shutdown
jmeterengine.threadstop.wait=5000
  • Replace complex Regular Expression Extractors with Boundary Extractor (significantly faster, zero CPU regex overhead).
  • Ensure all JSR223 elements use Groovy with “Cache compiled script if available” checked.
  • Never use BeanShell (BeanShell is 10–20x slower and CPU-heavy compared to Groovy).

5. Check Disk I/O Bottlenecks and Log Levels

Section titled “5. Check Disk I/O Bottlenecks and Log Levels”

Writing verbose debug logs during a 1,000 RPS test saturates disk I/O and locks CPU threads:

  1. Ensure jmeter.log level is set to INFO or WARN in bin/log4j2.xml.
  2. Save only required fields in results.jtl:
# Keep JTL output minimal for maximum throughput
jmeter.save.saveservice.output_format=csv
jmeter.save.saveservice.response_data=false
jmeter.save.saveservice.samplerData=false
jmeter.save.saveservice.requestHeaders=false
jmeter.save.saveservice.url=true
jmeter.save.saveservice.response_code=true
ResourceUse when
GUI works, CLI failsDifferences between GUI and CLI execution
OutOfMemoryError heapHeap memory exhaustion troubleshooting
CLI Command BuilderGenerate clean CLI commands with proper flags
Best practicesOfficial tuning guidelines

Why does JMeter hang at the end when using InfluxDB Backend Listener?

Section titled “Why does JMeter hang at the end when using InfluxDB Backend Listener?”

The Backend Listener buffers metrics and attempts to flush remaining data to InfluxDB over HTTP. If the InfluxDB server is slow or unreachable, the listener blocks until timeout. Set summaryOnly=true or lower the client timeout.

How do I stop a hung JMeter CLI test safely?

Section titled “How do I stop a hung JMeter CLI test safely?”

Run ./bin/stoptest.sh (or stoptest.bat on Windows) from a separate terminal. This instructs JMeter to gracefully terminate thread groups. If it remains stuck, use ./bin/shutdown.sh.

On this page