jenkinsci / jenkinsci/git-plugin

[JENKINS-51673] PollSCM runs again when job on commit takes longer then the trigger

Open
#3,311 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

component:git-plugin component:pipeline imported-jira-issue priority:critical resolution:unresolved
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.