Bug 39792 - ClientJMeterEngine needs synchronization around test tree in 'run'
Summary: ClientJMeterEngine needs synchronization around test tree in 'run'
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.1.1
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
: 28028 35164 (view as bug list)
Depends on:
Reported: 2006-06-12 21:52 UTC by David Winterbourne
Modified: 2011-10-03 11:14 UTC (History)
2 users (show)


Note You need to log in before you can comment on or make changes to this bug.
Description David Winterbourne 2006-06-12 21:52:06 UTC
I was getting null pointer exceptions when executing remote server tests from 
the command line:
	at org.apache.jmeter.engine.ConvertListeners.addNode
	at org.apache.jorphan.collections.HashTree.traverseInto
	at org.apache.jorphan.collections.HashTree.traverse(HashTree.java:962)
	at org.apache.jmeter.engine.ClientJMeterEngine.run
	at java.lang.Thread.run(Thread.java:534)

Upon tracing it through I discovered that the same HashTree created on line 453 
of JMeter.java was being accessed by two different ClientJMeterEngine threads. 
I added synchronization around the tree in the run method of the 
ClientJMeterEngine and this seemed to resolve the issues:

	public void run() {
		log.info("running clientengine run method");
		testListeners = new SearchByClass(TestListener.class);
        HashTree tree = getTestTree();
        //synchronized here to resolve NPE issue
        synchronized (tree) {
		sampleListeners = new ConvertListeners();

		// TODO this is a temporary fix - see bug 23487
		try {
                    //synchronized here to resolve NPE issue
		    synchronized (tree) {
		} catch (IndexOutOfBoundsException e) {
			log.warn("Error replacing sample listeners", e);
Comment 1 Sebb 2006-06-12 22:14:11 UTC
What command-line options did you use?

What was the setting of remote_hosts in jmeter.properties - how many hosts were
Comment 2 Sebb 2007-08-20 05:38:57 UTC
Added synchronisation to both accesses in SVN r567668/r567669

See also bug 23487, which this should also fix.
Comment 3 Sebb 2007-08-20 07:08:10 UTC
Additional testing shows this is now fixed
Comment 4 Sebb 2007-09-01 04:57:46 UTC
*** Bug 28028 has been marked as a duplicate of this bug. ***
Comment 5 Sebb 2007-09-01 05:00:18 UTC
*** Bug 35164 has been marked as a duplicate of this bug. ***