Created attachment 26671 [details] testplan demonstrating this issue Steps to reproduce: - build up a testplan ass followed (testplan attached) and execute it: / |- Test Plan |- MyThreadGroup |- HttpRequest Sampler 1 |- Beanshell Sampler |- HttpRequest Sampler 2 |- 2ndLevel HttpHeaderManager |- 1stLevel HttpHeaderManager |- WorkBench Expected behavior: - The header sent by 'HttpRequest Sampler 1' contains the values configured in '1stLevel HttpHeaderManager' and '2ndLevel HttpHeaderManager' - The header sent by 'HttpRequest Sampler 2' contains the values configured in '1stLevel HttpHeaderManager' and '2ndLevel HttpHeaderManager' Actual behavior: - The header sent by 'HttpRequest Sampler 1' contains all expected values - The header sent by 'HttpRequest Sampler 2' contains only the values configured in '1stLevel HttpHeaderManager' Notes: - it seems that the used beanshell sampler prevents the '2ndLevel HttpHeaderManager' from setting its header values to all HttpRequest Samplers which are positioned below/after the beanshell sampler. - the log file doesn't show any errors or other abnormalities. - if only one 'http header manager' (it doesn't matter which one in the example mentioned above) is used, the header values are set as expected.
Does not appear to be anything to do with BeanShell - replacing the BSH sampler with a Java request has the same effect. However 3 HTTP samplers in succession do work OK.
This issue is due to the following: JMeterThread#process_sampler calls : SamplePackage pack = compiler.configureSampler(current); This calls : configureWithConfigElements(sampler, pack.getConfigs()); Which ends up calling: mergeIn() This methods iterates over HeaderManager properties and adds them to AbstractTestElement as temporary properties but it adds their reference not a clone. So AbstractTestElement ends up sharing a CollectionProperty with HeaderManager When sampler.recoverRunningVersion() is called in SamplePackage#recoverRunningVersion(), it calls prop.recoverRunningVersion(this being AbstractTestElement) This calls recoverRunningVersionOfSubElements(this being AbstractTestElement) This enters this part of code: if (owner.isTemporary(prop)) { iter.remove(); } And ends up cleaning HeaderManager collection. So I think the issue is due to the fact that A CollectionProperty is shared between HeaderManager and AbstractTestElement. You can see this behaviour by just disabling the 2 HTTP Samplers and keeping only the BeanShellSampler or any other AbstractTestElement except for those who redefined addTestElement (as it's the case for HttpSamplerBase). I attach a patch (not committed) because I need further advice from Sebb regarding the fix and its impacts.
Created attachment 27902 [details] Fix proposal
Test Case: Date: Sun Nov 6 20:18:40 2011 New Revision: 1198547 URL: http://svn.apache.org/viewvc?rev=1198547&view=rev Log: Test Case that will fails until BUG 50799 is fixed. Modified: jmeter/trunk/test/src/org/apache/jmeter/testelement/PackageTest.java
I wait for your further checks sebb to mark it as fixed. Date: Mon Nov 7 21:21:26 2011 New Revision: 1198945 URL: http://svn.apache.org/viewvc?rev=1198945&view=rev Log: Bug 50799 - Having a non-HTTP sampler in a http test plan prevents multiple header managers from working Modified: jmeter/trunk/src/core/org/apache/jmeter/testelement/AbstractTestElement.java jmeter/trunk/test/src/org/apache/jmeter/testelement/PackageTest.java jmeter/trunk/xdocs/changes.xml
Date: Mon Nov 7 22:08:15 2011 New Revision: 1198971 URL: http://svn.apache.org/viewvc?rev=1198971&view=rev Log: Bug 50799 - Having a non-HTTP sampler in a http test plan prevents multiple header managers from working The good fix Modified: jmeter/trunk/src/core/org/apache/jmeter/testelement/AbstractTestElement.java
Fix introduced issue 52187
Date: Tue Nov 15 13:20:20 2011 New Revision: 1202175 URL: http://svn.apache.org/viewvc?rev=1202175&view=rev Log: Bug 50799 - Having a non-HTTP sampler in a http test plan prevents multiple header managers from working Fix ROLLBACK
Date: Thu Apr 5 22:04:43 2012 New Revision: 1310098 URL: http://svn.apache.org/viewvc?rev=1310098&view=rev Log: Bug 50799 - Having a non-HTTP sampler in a http test plan prevents multiple header managers from working Modified: jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/BSFSampler.java jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/BeanShellSampler.java
Fixed by changes done on Bug 53042
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2468