Bug 66270 - TestStateListener implementation should be supported for NoThreadClone elements only
Summary: TestStateListener implementation should be supported for NoThreadClone elemen...
Status: NEW
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: 5.5
Hardware: All All
: P2 normal (vote)
Target Milestone: JMETER_5.5
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-20 11:47 UTC by Vladimir Sitnikov
Modified: 2022-09-20 11:47 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Sitnikov 2022-09-20 11:47:20 UTC
Currently, JMeter notifies TestStateListener from a single thread only, and it collects listeners **before** they are cloned for the execution.

For instance, HTTPSamplerBase is cloned for every thread (because it has execution state fields), so it looks strange to implement TestStateListener. What was the expected outcome? Did HTTPSamplerBase authors expect that JMeter would execute "testEnded" on each cloned HTTPSamplerBase instance? Did HTTPSamplerBase authors expect that "testEnded" would be called for "non-cloned" instance only? Frankly speaking, both options sound strange to me, and I think HTTPSamplerBase should not really implement TestStateListener.

That creates two issues:
1) StandardJMeterEngine keeps the collection (see SearchByClass<>(TestStateListener.class)) of all TestStateListener implementations for the duration of the test.

2) HTTPSamplerBase is cloned into the execution threads, so it is unclear what would be outcome of calling the notifications (testStarted, testEnded) on an element that is not associated with a thread.

I'm inclined we should deprecate TestStateListener for objects cloned into individual execution threads. In other words, it looks like TestStateListeners should be executed for "global-like" services only.

Of course, we could try calling "testStarted" within each execution thread, however, I am not sure what would be the use case for it, and it was not implemented previously.
Comment 1 The ASF infrastructure team 2022-09-24 20:38:23 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/5709