jenkinsci / jenkinsci/git-plugin
[JENKINS-51673] PollSCM runs again when job on commit takes longer then the trigger
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 694
- Forks
- 1.1k
- Avg merge
- 1h 29m
- Merged PRs (30d)
- 3
Description
When the pollSCM in a declarative pipeline is executed when the jobs on the same commit is queued and did not do a checkout scm the jobs is queued again on the same commit.
A test Jekninsfile:
pipeline {
agent {
node {
label 'local'
}
}
triggers {
pollSCM('H/2 * * * *')
}
stages {
stage('Run') {
steps {
checkout scm
sh 'sleep 1000'
}
}
}
}
If a new commit is pushed within in 1000 seconds and the executors on jenkins are busy jenkins will fire a new job at each pollSCM till 1 job on this commit did do a checkout. In this example this will be 5-6 jobs on the same commit.
When doing this on multiple repositories on a limited number of executors this will explode in 10000+ jobs if your unlucky. (happened to me)
Originally reported by pjvanthof, imported from: PollSCM runs again when job on commit takes longer then the trigger
- status: Open
- priority: Critical
- component(s): git-plugin, pipeline
- resolution: Unresolved
- votes: 0
- watchers: 4
- imported: 2025-12-02
Raw content of original issue
When the pollSCM in a declarative pipeline is executed when the jobs on the same commit is queued and did not do a checkout scm the jobs is queued again on the same commit.
A test Jekninsfile:
pipeline { agent { node { label 'local' } } triggers { pollSCM('H/2 * * * *') } stages { stage('Run') { steps { checkout scm sh 'sleep 1000' } } } }If a new commit is pushed within in 1000 seconds and the executors on jenkins are busy jenkins will fire a new job at each pollSCM till 1 job on this commit did do a checkout. In this example this will be 5-6 jobs on the same commit.
When doing this on multiple repositories on a limited number of executors this will explode in 10000+ jobs if your unlucky. (happened to me)
- environment:
Jenkins 2.125, Ubuntu 14
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the declarative pipeline and PollSCM reproduction in the issue, using the checkout scm step and the long-running sleep as the scenario. Trace how polling queues builds when executors are busy and verify that repeated polls for the same commit no longer create duplicate jobs before a checkout occurs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, java
- Domain
- ci-cd, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100