Bug 44941 - Throughput controllers should not share global counters
Summary: Throughput controllers should not share global counters
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.3.1
Hardware: PC Windows Server 2003
: P2 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
Depends on:
Reported: 2008-05-06 03:47 UTC by Elliott Jones
Modified: 2008-11-08 17:25 UTC (History)
2 users (show)

Test Plan to show bug 44941 (10.15 KB, application/octet-stream)
2008-09-06 12:57 UTC, Milamber

Note You need to log in before you can comment on or make changes to this bug.
Description Elliott Jones 2008-05-06 03:47:04 UTC
Setup the following: 

Thread Group: 2 thread, RU 1, Loop 1 
        -Java sampler logon 
        -Throughput Controller set at 1 for total executions (NOT per user) 
                -Java sampler Browse to folderA 
        -Throughput Controller set at 1 for total executions (NOT per user) 
                -Java sampler Browse to folderB 
        -Aggregate Report 

I would expect to see the samplers for Browse to folderA and folderB to both execute just the once for which ever of the two threads executed it first. 

However, only the second Browse sampler occurs - Browse folder B . 

1) OS is virtualised Windows Server 2003 R2
2) If I set both Throughput Controllers to be per user. I get each Browse completed twice in total, once per user, as expected.
Comment 1 Milamber 2008-09-06 12:55:55 UTC
After analysis, the problem is the element Throughput Controller when there are several in same Thread Group with the option "Per User" unchecked.
==> The problem doesn't exist when option "Per User" is checked.

The analysis of source code indicates that scope of variable globalNumExecutions in class org.apache.jmeter.control.ThroughputController which is the cause of problem.
Indeed, variable globalNumExecutions is compared to getMaxThroughputAsInt() (in method decide() of the same class), but unfortunately, value of globalNumExecutions is shared by all Throughput Controller of Thread Group. When comparing the number of execution is wrong in relation to the current Throughput Controller.

For example, in Test Plan attached, the request "21 HTTP Request" isn't success because the comparison of value of globalNumExecutions is already 1 (because request "11 HTTP Request" is before) and value of Max Throughput is 1 for the current Throughput Controller (1 < 1 = false).

The solution should be (I think):
A variable globalNumExecutions by Throughput Controller and shared by Thread Group.

By cons, I have not (yet) succeeded to correct in the source code Jmeter ... Perhaps this is not possible?
Comment 2 Milamber 2008-09-06 12:57:53 UTC
Created attachment 22534 [details]
Test Plan to show bug 44941
Comment 3 Sebb 2008-11-08 17:25:45 UTC
URL: http://svn.apache.org/viewvc?rev=712458&view=rev
Bug 44941 - Throughput controllers should not share global counters