jenkinsci / jenkinsci/git-plugin

[JENKINS-15803] git polling mechanism can have build in infinite loop

Open
#2,207 4 comments 0 reactions 0 assignees View on GitHub
component:git-plugin imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
694
Forks
1.1k
Avg merge
1h 29m
Merged PRs (30d)
3

Description

We have a problem on the ASF git integration that causes change detection logic to always trigger changes, subsequently running the builds non-stop.

I am quiet sure I have tracked this and will explain it here:

jenkins-core:

https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/AbstractProject.java#L1404

Look at the catch-block surrounding the call to "poll".

https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/GitSCM.java#L678

https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/GitSCM.java#L741

Both of these method calls can produce a "GitException" which is of type RunTimeException. When they hit the "catch" in AbstractProject#poll, they will enter the RuntimeException block.

The root cause seems to be that GitAPI status code detection (GitAPI java line 824) does not distinguish between "IOException" and other kinds of exception. Given that we are unable to distinguish, it probably makes more sense to make the "poll" method wrap any git exception in an IOException, but the optimal would be to determine what status codes git uses for network related failures and throw ioexceptions in those cases.

---
Originally reported by krosenvold, imported from: git polling mechanism can have build in infinite loop


  • status: Open
  • priority: Major
  • component(s): git-plugin
  • resolution: Unresolved
  • votes: 1
  • watchers: 5
  • imported: 2025-12-02

Raw content of original issue

We have a problem on the ASF git integration that causes change detection logic to always trigger changes, subsequently running the builds non-stop.

I am quiet sure I have tracked this and will explain it here:

jenkins-core:

https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/AbstractProject.java#L1404

Look at the catch-block surrounding the call to "poll".

https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/GitSCM.java#L678
https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/GitSCM.java#L741

Both of these method calls can produce a "GitException" which is of type RunTimeException. When they hit the "catch" in AbstractProject#poll, they will enter the RuntimeException block.

The root cause seems to be that GitAPI status code detection (GitAPI java line 824) does not distinguish between "IOException" and other kinds of exception. Given that we are unable to distinguish, it probably makes more sense to make the "poll" method wrap any git exception in an IOException, but the optimal would be to determine what status codes git uses for network related failures and throw ioexceptions in those cases.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.