Bug 64499 - Exiting JMeter when "jmeterengine.stopfail.system.exit=true" takes too much time if threads are not stopped
Summary: Exiting JMeter when "jmeterengine.stopfail.system.exit=true" takes too much t...
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: 5.0
Hardware: All All
: P2 normal (vote)
Target Milestone: JMETER_5.4
Assignee: JMeter issues mailing list
Keywords: FixedInTrunk
Depends on:
Reported: 2020-06-05 16:08 UTC by Philippe Mouawad
Modified: 2020-06-06 20:01 UTC (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Mouawad 2020-06-05 16:08:34 UTC
The setting "jmeterengine.stopfail.system.exit=true"  is intended to make JMeter exit when some threads are still not stopped or hanged.

But currently this is what happens when test is stopped (now == true):
The StopTest thread if asked to stop now:

1) Asks threads of threads groups to stop
2) Pauses for 10ms * Number of threads (may be improvable by capping it to a max of 30s), not the main problem
3) verifyThreadsStopped : 
a) The problem is here, the method continues to loop even if one threadGroup.verifyThreadsStopped() returns false => Not optimal, I would suggest to exit on first false
b) ThreadGroup#verifyThreadsStopped has the same problem but worst it waits 5s per thread to join

So by default , if we have 100 threads still hanged , we end up waiting 
- Number of thread hanged * 10ms + Number of thread hanged * 5000 ms 

While if we exit on first false, we would wait :
- Number of thread hanged * 10ms + 5000 ms
Comment 1 Philippe Mouawad 2020-06-06 20:01:06 UTC
pmouawad pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

The following commit(s) were added to refs/heads/master by this push:
     new 0318c50  Bug 64499 - Exiting JMeter when "jmeterengine.stopfail.system.exit=true" takes too much time if threads are not stopped
0318c50 is described below

commit 0318c50a8a55d5be533a9150885e2facf04358a7
Author: pmouawad <p.mouawad@ubik-ingenierie.com>
AuthorDate: Sat Jun 6 21:57:52 2020 +0200

    Bug 64499 - Exiting JMeter when "jmeterengine.stopfail.system.exit=true"
    takes too much time if threads are not stopped
 .../java/org/apache/jmeter/engine/StandardJMeterEngine.java  |  7 ++++---
 .../src/main/java/org/apache/jmeter/threads/ThreadGroup.java | 12 +++++++++---
 xdocs/changes.xml                                            |  1 +
 3 files changed, 14 insertions(+), 6 deletions(-)
Comment 2 The ASF infrastructure team 2022-09-24 20:38:19 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/5329