-
Bug
-
Resolution: Fixed
-
Major
The Jenkins#unlabeledLoad LoadStatistics incorrectly counts labeled jobs from computeQueueLength().
Steps to reproduce:
- Create a job with a label 'foo'
- Run the job and ensure it is the only job in the queue
- Evaluating Jenkins.getInstance().unlabeledLoad.computeQueueLength() will return 1
This causes the Jenkins.unlabeledLoadProvisioner to provision slaves with null labels even though they will not be able to run the labeled jobs.
- links to
Seems the issue exists starting from the first version of UnlabeledLoad: https://github.com/jenkinsci/jenkins/commit/be1f8f91a3dcdcdfd2ed07198659e7eb68abf1f7
Jenkins.getInstance().getQueue().countBuildableItemsFor(null) is misused in the call (BTW the behavior is not documented). This method returns all tasks count if you call it with a null param.
We will need a new method to maintain the backward compatibility