0

I am load testing MQTT connection with JMeter.

The test runs in NON-GUI mode. All listeners were disabled during the test.

Everything was fine until I increased thread number from 2k to 3k. Now, this error occurs when I am running the test:

Uncaught Exception java.lang.OutOfMemoryError: unable to create new native thread. See log file for details.

I tried increasing the HEAP size by editing the executable file "jmeter"enter image description here

Here is how I edited it. I changed it from 512m to 1024m: enter image description here

But it doesn't work. Then I changed to a larger value 2048m, still doesn't work.

I searched for this problem and found out that it might have something to do with the thread stack size. Some pointed out that I may set the thread stack size in the script too. So I tried adding the thread stack size in the executable file.

This is how I did it: enter image description here

I am not sure if it is the correct way. It didn't work too.

Some also says that maybe the HEAP size or the Thread stack size of the JVM should be increased.

Then I came across this tutorial by MKYoung:https://www.mkyong.com/java/how-to-set-java_home-environment-variable-on-mac-os-x/ stating the ways to change the HEAP size and the thread stack size of java.

But for setting to work I have to state a java class file at the end of the command.

java -Xss256k <class name here>

But the Jmeter is unix executable and there doesn't seem to be any java class files there.

I am really running out of ways. Please help.

3
  • "See log file for details." What does the log say?
    – bradimus
    May 10, 2017 at 13:00
  • @bradimus Hi, I don't see anything helpful in the log. There are no errors. But FYI I am looking at log file jmeter.log. I am not sure if that's the log file it's talking about here.
    – JLT
    May 10, 2017 at 13:04
  • @finalstatic Can you please mention the bit (32 or 64) of the Operating System along with the installed JVM as well? And when you say making the Heap to 2048m didn't work, are you referring to the problem or the very allocation of 2048m to JMeter did not work? Also, alternatively, have you tried running your test in a distributed mode? May 23, 2017 at 18:08

1 Answer 1

1

Execute ulimit -u command (shows max user processes) and amend it according to number of threads you are trying to use (and a little bit more so other processes could operate), check out How to change default number of max process per user in linux thread for details.

Apart from this make sure you are following recommendations from 9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure guide.

9
  • Hi, how do I set ulimit -u under Mac. Setting it directly doesn't work. It outputs: -bash: ulimit: max user processes: cannot modify limit: Operation not permitted. I am also not able to see any limits.conf under /etc/security. I read the link you gave, but it still doesn't help.
    – JLT
    May 10, 2017 at 13:18
  • For Mac it will be sudo launchctl limit maxproc and /etc/sysctl.confcorrespondingly
    – Dmitri T
    May 10, 2017 at 13:23
  • Apologies for providing an outdated instruction, try creating /etc/launchd.conf file and add the line like limit maxproc XXXX YYYY there - this way the setting will survive reboots.
    – Dmitri T
    May 11, 2017 at 3:57
  • Hi, what is XXXX and YYYY?
    – JLT
    May 11, 2017 at 4:00
  • Soft and hard limits
    – Dmitri T
    May 11, 2017 at 4:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.