How to terminate a test that won't stop

book

Article ID: 186134

calendar_today

Updated On:

Products

BlazeMeter

Issue/Introduction

In rare occasions it may happen that a test does not end, even when its duration has been exceeded by several minutes. 
Pressing the stop button prompts to either do a graceful shutdown or terminate the servers, as explained in this article.
However stopping or even terminating the test may not have the desired effect and the test keeps running.

Cause

Tests run on one or more engines and each engine corresponds with a session ID. The session IDs are listed in the logs tab and generally start with r-v4...
If one or more session IDs fail to stop for whatever reason, the entire test won't stop, even when it has been stopped by pressing the red stop button or by using an API call.
 

Environment

Blazemeter SaaS

Resolution

When the test does not respond to a Stop/Terminate command, it can be stopped by terminating the sessions that haven't yet stopped and which probably won't stop by themselves anymore.
This can be accomplished by following curl command:

curl -X POST https://a.blazemeter.com/api/v4/sessions/<sessionID>/terminate -H "Content-Type: application/json" --user 'ID:Secret' 

where:
<sessionID> designates the sessionID
ID:Secret designates the API key and Secret API key as explained in this article

If a test has many sessions, it may not be easy to manually check which sessions refuse to stop.

To find out the problem sessions that need to be terminated using the above listed curl command, run following command:

curl -X GET https://a.blazemeter.com/api/v4/masters/<masterID>/sessions -H "Content-Type: application/json" --user 'ID:Secret' 

where masterID designates the master to be stopped.

Then check all sessions in the output and find out which ones do not have a status equal to "ENDED". Those need to be terminated.

Additional Information

Every running test needs additional minutes to wrap up, create log files and transferring them to the Blazemeter backend. It is normal for this to take several minutes. The procedure as listed above should only be used if you are certain that the test won't stop on its own anymore. Every session that is stopped will not have log files attached to it to debug afterwards as the termination immediately kills the session without preserving any information.