Created attachment 32959 [details] jstack info Jmeter hang when testing javasampler with num_threads>6000 , because HashMap.put() from multiple threads. As the following,knowing the thread hang at HashMap.put(); look into the process's jstack info(full content attached): 2015-08-05 14:48:48 Full thread dump OpenJDK (Taobao) 64-Bit Server VM (20.0-b12-internal mixed mode): "Attach Listener" daemon prio=10 tid=0x00007f078fd5a000 nid=0x4204 waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE "线??组 1-2788" prio=10 tid=0x00007f07e0111000 nid=0x5fad runnable [0x00007f079d99d000] java.lang.Thread.State: RUNNABLE at java.util.HashMap.put(HashMap.java:374) at java.util.HashSet.add(HashSet.java:200) at org.apache.jmeter.protocol.java.sampler.JavaSampler.createJavaClient(JavaSampler.java:227) at org.apache.jmeter.protocol.java.sampler.JavaSampler.sample(JavaSampler.java:190) at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:431) at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:258) at java.lang.Thread.run(Thread.java:662) "pool-1-thread-1" prio=10 tid=0x00007f0848a90800 nid=0x5c43 waiting on condition [0x00007f07ebca4000] java.lang.Thread.State: TIMED_WAITING (sleeping) at java.lang.Thread.sleep(Native Method) at io.netty.util.HashedWheelTimer$Worker.waitForNextTick(HashedWheelTimer.java:461) at io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:360) at java.lang.Thread.run(Thread.java:662) "线程组 1-1847" prio=10 tid=0x00007f083c96b800 nid=0x5b54 runnable [0x00007f07f9178000 ...
Invoking HashMap.put() from multiple threads casue jmeter hanging I think the solution is: change java file :src/protocol/java/org/apache/jmeter/protocol/java/sampler/JavaSampler.java at line 60 //private static final Set<JavaSampler> TEAR_DOWN_SET = new HashSet<JavaSampler>(); private static final Set<JavaSampler> TEAR_DOWN_SET = Collections.newSetFromMap(new ConcurrentHashMap<JavaSampler,Boolean>());
Thanks very much for the report. The fix has been applied and will be in the next release of JMeter URL: http://svn.apache.org/r1694819 Log: JMeter hang when testing javasampler because HashMap.put() is called from multiple threads without sync. Bugzilla Id: 58209 Modified: jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/JavaSampler.java jmeter/trunk/xdocs/changes.xml
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/3643