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 ...
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
Depends on:
Reported: 2017-06-19 02:29 UTC by taclayto
Modified: 2018-01-26 16:40 UTC (History)
2 users (show)

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

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) {
  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
Bug 61198 - Backend Listener does not work properly in main script when included scripts also contain Backend Listener
Bugzilla Id: 61198

Comment 2 Philippe Mouawad 2017-07-22 13:53:41 UTC
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 ?

Comment 3 taclayto 2018-01-26 16:40:17 UTC
Hi, works for me on JMeter4.0-SNAPSHOT.20180126

Sorry for taking so long to get around to verifying!