apache / apache/jmeter

HeaderManager in a loop is cleared from header definitions if some specific samplers are executed before

Open
#6,224 2 comments 1 reaction 0 assignees View on GitHub
defect to-triage
Dominant language
Java
Stars
9.5k
Forks
2.3k
Avg merge
1d 22h
Merged PRs (30d)
5

Description

### Expected behavior

Using HTTP Header Manager elements at various levels in the tree (but a single manager per tree level) should result in the header list merge and the result to be used when HTTP Request is sent.

### Actual behavior

Some Samplers (from the default list I found JUnit Request) seem to impact the content of the merged HTTP Header Manager when everything is wrapped in a loop and as a result the correct list of HTTP headers isn't submitted to target endpoint.
The problem seems to be related to where the Header Manager is defined: one level above the HTTP Request sampler but child of a Loop controller OR on same level with the HTTP Request sampler and child of a Loop controller.
I've tried with other samplers but they don't induce same outcome: Debug, JSR223, OS Process, Java request, TCP, LDAP Extended, JDBC.

We've built a dummy custom component that simply prints some text in the JTL (much like a stripped version of a Debug Sampler) and produces same buggy behavior (I cannot share the code). I've tried to replicate with JMeter's default samplers and managed as detailed.

### Steps to reproduce the problem

Attaching sample JMX: [jmeter-6224.zip](https://github.com/apache/jmeter/files/13924638/jmeter-6224.zip)
Ignore the failures at sampler level, they are irrelevant; the only thing to focus is the content of HTTP Headers listed in each Request Headers tab for HTTP Requests (the Request Assertion fails) -> you can see or not see the HTTP Headers defined in the HTTP Header Manager - (not) Local instances.

**Notes**:
1. I've used an Interleave Controller to prove that a Debug/LDAP Extended Sampler doesn't produce the issue.
2. I've used a Loop of 6 to prove that once JUnit sampler is executed then all future requests are plagued by the same outcome.
3. I've used a Module & Test fragment to suggest that issue can be easily buried under some re-used code/external code hence a rule like: 'don't use a HTTP Header Manager like this' can be easily lost from view. One can copy the whole code from the fragment and replace the Module controller and get same results.

### JMeter Version

5.5.1

### Java Version

openjdk version "17.0.9" 2023-10-17 OpenJDK Runtime Environment Temurin-17.0.9+9 (build 17.0.9+9) OpenJDK 64-Bit Server VM Temurin-17.0.9+9 (build 17.0.9+9, mixed mode, sharing)

### OS Version

Windows 11 Pro 22H2

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.