Bug 61198 - Backend Listener does not work properly in main script when included scripts also contain Backend Listener
Summary: Backend Listener does not work properly in main script when included scripts ...
Status: RESOLVED FIXED
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: 3.2
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-19 02:29 UTC by taclayto
Modified: 2017-07-22 13:53 UTC (History)
2 users (show)



Attachments
Example JMeter Scripts (3.55 KB, application/x-zip-compressed)
2017-06-19 02:29 UTC, taclayto
Details

Note You need to log in before you can comment on or make changes to this bug.
Description taclayto 2017-06-19 02:29:31 UTC
Created attachment 35060 [details]
Example JMeter Scripts

***Use Case***
Our testing team makes heavy use of Test Fragments, Include Controllers and Backend Listeners. 

We have a Thread Group in almost every jmx file that we use for testing while developing the Test Fragment. This Thread Group contains a Module Controller and several listeners, one of which is a Backend Listener. 

This Backend Listener in the included jmx file is not a part of the Test Fragment and is scoped only to the Thread Group.

***Defect Description***
Please reference the attached jmx files:
- toBeIncluded.jmx (defines it's samplers in a Test Fragment, has a Thread Group that references the Fragment through a Module Controller) 
- includerScript.jmx (includes toBeIncluded.jmx and defines it's own listeners)

When attempting to run our test from the main .jmx file (either in gui or from cmd line) we see a Null Pointer Exception when the test ends, causing the main process to never stop. 

This is reproducible by running the attached script "includerScript.jmx"

I attempted to trace this behavior through the code and came across the constructor in the BackendListener class.
--------------------------------------------------------
/**
* Create a BackendListener.
*/
public BackendListener() {
  synchronized (LOCK) {
    queuesByTestElementName.clear();
  }
  
  setArguments(new Arguments());
}
--------------------------------------------------------

This constructor is called every time a file is loaded that contains a Backend Listener. I am not familiar enough with the distributed testing feature in JMeter to know why this might be necessary, but looking through the rest of the code, I can't make sense of why this would need to be here.

Commenting out the .clear() command works for the above use case.

***Expected Behavior***
I expect the attached JMeter scripts to work properly. The Backend Listener in the included .jmx file should not affect the main .jmx file's Backend Listener just by virtue of being loaded through JMeter's Save Service.
Comment 1 Philippe Mouawad 2017-07-22 13:52:56 UTC
Author: pmouawad
Date: Sat Jul 22 13:52:34 2017
New Revision: 1802695

URL: http://svn.apache.org/viewvc?rev=1802695&view=rev
Log:
Bug 61198 - Backend Listener does not work properly in main script when included scripts also contain Backend Listener
Bugzilla Id: 61198

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListener.java
    jmeter/trunk/xdocs/changes.xml
Comment 2 Philippe Mouawad 2017-07-22 13:53:41 UTC
Hello,
Thanks for precise report and analysis.

Issue should be fixed in trunk, can you please next nightly build and confirm issue is fixed in both GUI and NON GUI modes ?

Thanks
Regards