Fix #6457: Suppress spurious 'Existing CookieManager superseded by' warnings across iterations - #6737
Open
alaahong wants to merge 1 commit into
Open
Conversation
alaahong
force-pushed
the
fix/issue-6457-superseded-warnings
branch
2 times, most recently
from
July 26, 2026 07:37
9e03e1d to
97e5a0b
Compare
…arnings across iterations
HTTPSamplerBase.addTestElement routed CookieManager, CacheManager,
AuthManager and DNSCacheManager through their public setXxxManager methods,
which unconditionally log a warning whenever the existing manager is non-null.
TestCompiler calls addTestElement on every thread-group iteration after
clearTestElementChildren, but clearTestElementChildren only clears the
HeaderManager property, so the replace-mode manager references survive
across iterations and the warning fires N-1 times for N iterations.
Fix:
- addTestElement now routes replace-mode managers through their private
setXxxManagerProperty methods, mirroring the existing KeystoreConfig path
that was already exempted.
- The public setXxxManager methods now suppress the warning when the new
value is the same instance as the existing one (defensive guard for direct
callers). Genuine misuse (attaching a *different* manager of the same type)
still produces the warning, so the diagnostic value is preserved.
Added HttpSamplerManagerWarningsTest with 17 cases covering: addTestElement x5
iterations for each of the 5 managers, same-instance setter call,
different-instance setter call (must still warn), HeaderManager merge path,
and an end-to-end smoke test with all 6 managers across 10 iterations.
Before fix: 17 tests, 10 failed; 62 "superseded by" log lines.
After fix: 17 tests, 0 failed; 5 "superseded by" log lines (expected,
from different-instance setter calls only).
alaahong
force-pushed
the
fix/issue-6457-superseded-warnings
branch
from
July 26, 2026 07:49
97e5a0b to
07a91ec
Compare
Member
Author
|
The batchServerBatchTestLocal failure on macOS/JDK17 is a known pre-existing flaky test tracked by #6674 . The failing test plan BatchTestLocal.jmx uses only JavaSampler/JSR223Sampler and does not touch any HTTP component modified by this PR. The same failure occurs on master and is caused by a thread-group scheduling race in server mode on macOS. All non-macOS matrix jobs pass. |
alaahong
marked this pull request as ready for review
July 26, 2026 08:48
alaahong
force-pushed
the
fix/issue-6457-superseded-warnings
branch
from
July 26, 2026 10:17
09965b4 to
07a91ec
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Fixes #6457
Since 5.6, JMeter logs a flood of
Existing CookieManager ... superseded by ...(and analogousCacheManager,AuthManager,DNSCacheManagerwarnings) on every thread-group iteration after the first one. In a long-running test plan with N iterations and M HTTP Samplers under a Thread Group, the log is filled with(N-1) × Mredundant warning lines per manager type, hiding real issues and alarming users.Root cause
HTTPSamplerBase#addTestElement(TestElement)routedCookieManager,CacheManager,AuthManager, andDNSCacheManagerthrough their publicsetXxxManagermethods. Those public setters unconditionally log a warning whenever the existing manager is non-null.TestCompilercallsaddTestElementon every thread-group iteration afterclearTestElementChildren(), butclearTestElementChildren()only clears theHeaderManagerproperty — the replace-mode manager references survive across iterations. As a result, the warning firesN-1times forNiterations even though the user has attached exactly one manager.KeystoreConfigwas already exempted because itsaddTestElementbranch already called the privatesetKeystoreConfigProperty, which does not warn.Fix
Two complementary changes in
HTTPSamplerBase:addTestElementnow routes replace-mode managers (CookieManager,CacheManager,AuthManager,DNSCacheManager) through their privatesetXxxManagerProperty/setDNSResolverPropertymethods, mirroring the existingKeystoreConfigpath. This is the path used byTestCompilerevery iteration, so the warning no longer fires on legitimate re-application of the same config element.setXxxManagermethods now suppress the warning when the new value is the same instance as the existing one (defensive guard for direct callers). The reference-equality check uses==deliberately and is annotated with@SuppressWarnings("ReferenceEquality"). Genuine misuse — attaching a different manager of the same type — still produces the warning, so the diagnostic value is preserved.Files changed
src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java— rerouteaddTestElementfor the 4 replace-mode managers, add same-instance guard to 5 public setters, extract 2 new private property setters (setAuthManagerProperty,setDNSResolverProperty) mirroring the existing pattern.src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/HttpSamplerManagerWarningsTest.java— new regression test (17 cases) covering: (1)addTestElement× 5 iterations for each of the 5 managers, (2) same-instance setter call, (3) different-instance setter call (must still warn), (4)HeaderManagermerge path, (5) end-to-end smoke test with all 6 managers across 10 iterations.xdocs/changes.xml— bug-fix entry under a newHTTP Samplers and Test Script Recordersubsection.Verification
Before / After evidence
Both runs use the same
HttpSamplerManagerWarningsTest(17 cases). The "before" run is on unpatchedmasterwith the test file checked out from this branch; the "after" run is on this branch.Before (without fix)
addTestElement x5cases for CookieManager/CacheManager/AuthManager/DNSCacheManager + the end-to-end case + the 5 same-instance setter cases all fail)jmeter.logsuperseded bylines: 62 total, broken down as:setXxx(sameInstance)cases) — these should not warnaddTestElement x5iterations across 4 managers (4 spurious warnings × 4 managers; KeystoreConfig already exempted)Sample spurious warnings from the same-instance setter cases (lines 26, 29, 33-35 of
before-superseded-warnings.log):Sample spurious warnings from
addTestElement x5for CookieManager (lines 41-44, 4 spurious warnings for 5 iterations):Sample spurious warnings from the end-to-end test (lines 57-92, 36 lines for 9 iterations × 4 managers):
before-superseded-warnings.log
After (with fix)
jmeter.logsuperseded bylines: 5 total — only the expected warnings from the different-instance setter cases (lines 31-35 ofafter-superseded-warnings.log). Genuine misuse is still detected.after-superseded-warnings.log
Summary
addTestElement x5spurious warnings (4 managers × 4)superseded bylines