Friday, October 29, 2021

[SOLVED] Running a JMeter script with nohup giving "No such file or directory"

Issue

Running a load simulation with master slave model, while running the test from command line using nohup giving "No such file or directory".

So I have two azure ubuntu vms (one is master and one is slave) and connected over putty. While executing long run load test I got a power outage and the test got killed. So tried using "nohup" but getting "No such file or directory" error.

The following command I triggered after I goes inside the Jmeter bin directory

Command without "nohup" (working fine till my connection is live)

JVM_ARGS="-Xms1024m -Xmx2048m" && export JVM_ARGS && ./jmeter -n -t /home/performance/LoadTesting/Portal-8HR.jmx -R 192.168.2.32:1099 -GTest_Name=LongDurationLoadTest -GTest_Triggered_By=LoadExecuter -Gtest_Id=200Con_8HR_Test01

Command Tried with "nohup" (not working)

JVM_ARGS="-Xms1024m -Xmx2048m" && export JVM_ARGS && nohup ./jmeter -n -t /home/performance/LoadTesting/Portal-8HR.jmx -R 192.168.2.32:1099 -GTest_Name=LongDurationLoadTest -GTest_Triggered_By=LoadExecuter -Gtest_Id=200Con_8HR_Test01 &

JVM_ARGS="-Xms1024m -Xmx2048m" && export JVM_ARGS && nohup "./jmeter -n -t /home/performance/LoadTesting/Portal-8HR.jmx -R 192.168.2.32:1099 -GTest_Name=LongDurationLoadTest -GTest_Triggered_By=LoadExecuter -Gtest_Id=200Con_8HR_Test01" &

JVM_ARGS="-Xms1024m -Xmx2048m" && export JVM_ARGS && nohup ./jmeter -n -t /home/performance/LoadTesting/Portal-8HR.jmx -R 192.168.2.32:1099 -GTest_Name=LongDurationLoadTest -GTest_Triggered_By=LoadExecuter -Gtest_Id=200Con_8HR_Test01 > /home/performance/RunTest/test2.txt 2>&1 &

Remember these parameters are important as I have a Grafana back-end listener which capture all these data with all the results.

Also I tried with

nohup ./jmeter -n -t /home/performance/LoadTesting/Portal-8HR.jmx -R 192.168.2.32:1099 -GTest_Name=LongDurationLoadTest -GTest_Triggered_By=LoadExecuter -Gtest_Id=200Con_8HR_Test01 </dev/null >nohup.out 2>nohup.err &

But getting,

Creating summariser <summary>
Created the tree successfully using /home/performance/LoadTesting/Portal-8HR.jmx
Configuring remote engine: 192.168.2.32:1099
Starting distributed test with remote engines: [192.168.2.32:1099] @ Wed May 06 12:32:30 UTC 2020 (1588768350878)
Error in rconfigure() method java.rmi.MarshalException: error marshalling arguments; nested exception is:
        java.io.NotSerializableException: org.apache.jmeter.JMeter$ListenToTest
Remote engines have been started:[]
Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4446

Solution

I'm not fully getting what you're trying to achieve, the correct equivalent of your command would be something like:

nohup bash -c "JVM_ARGS=\"-Xms1024m -Xmx2048m\" && export JVM_ARGS && ./jmeter -n -t /home/performance/LoadTesting/Portal-8HR.jmx -R 192.168.2.32:1099 -GTest_Name=LongDurationLoadTest -GTest_Triggered_By=LoadExecuter -Gtest_Id=200Con_8HR_Test01 & ./jmeter -n -t /home/performance/LoadTesting/Portal-8HR.jmx -R 192.168.2.32:1099 -GTest_Name=LongDurationLoadTest -GTest_Triggered_By=LoadExecuter -Gtest_Id=200Con_8HR_Test01 & ./jmeter -n -t /home/performance/LoadTesting/Portal-8HR.jmx -R 192.168.2.32:1099 -GTest_Name=LongDurationLoadTest -GTest_Triggered_By=LoadExecuter -Gtest_Id=200Con_8HR_Test01" 2>&1 &

If the only concern is network connectivity loss between putty, whatever it is, and Linux Azure VM you could use a terminal multiplexer like screen or tmux on the Azure VM side so you can attach to the running session when needed from this or another machine.

There are also a lot of ways to schedule a Linux job starting from simplest cron definitions, systemd timers or you can use a "heavy artillery" like Jenkins which allows flexible scheduling and kicking off jobs on other triggers. If you go for Jenkins you can enjoy the benefits of the Performance Plugin allowing marking builds as failed or unstable depending on test metrics received and plotting performance trend charts



Answered By - Dmitri T