[JIRA] [git-plugin] (JENKINS-30350) Jobs get triggered twice from polling git scm

4 views
Skip to first unread message

ohad.basan@gmail.com (JIRA)

unread,
Sep 8, 2015, 12:03:02 PM9/8/15
to jenkinsc...@googlegroups.com
Ohad Basan created an issue
 
Jenkins / Bug JENKINS-30350
Jobs get triggered twice from polling git scm
Issue Type: Bug Bug
Assignee: Nicolas De Loof
Components: git-plugin
Created: 08/Sep/15 4:02 PM
Priority: Major Major
Reporter: Ohad Basan

We are seeing a weird problem occasionally on our jenkins setup ver 1.627
git client 1.19
git plugin 2.4 on ubuntu machine.
I have a job configured to poll scm every 5 minutes
sometimes, when there is a change the job gets triggered twice
once with the relevant changes and the second time says "no changes"

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265)
Atlassian logo

mark.earl.waite@gmail.com (JIRA)

unread,
Sep 9, 2015, 11:29:02 PM9/9/15
to jenkinsc...@googlegroups.com
Mark Waite commented on Bug JENKINS-30350
 
Re: Jobs get triggered twice from polling git scm

Can you duplicate the problem with another job? with another repository? with another Jenkins server?

Can you provide steps to configure the job which shows how to duplicate the problem?

jchittum@akamai.com (JIRA)

unread,
Oct 5, 2015, 12:14:01 PM10/5/15
to jenkinsc...@googlegroups.com

I can confirm this on multiple projects on a completely separate system. Info:

Jenkins v. 1.596.2
Git Plugin 2.3.5
Git Client 1.17.0

SCM- Stash 3.11.0

Builds are automatically kicked off using Stash Webhook to Jenkins. Stash logs show a single commit being created, and a single call going out to Jenkins. Builds are then queued at the same time from the single call from Stash Webhook to Jenkins. Both builds are done with the exact same revision ID

This has happened with three separate projects, spaced about a week apart. It happens infrequently, as we have builds running regularly. Today was the first time I saw it happen twice on the same project.

tsondergaard@java.net (JIRA)

unread,
Dec 3, 2015, 5:23:01 PM12/3/15
to jenkinsc...@googlegroups.com

Seeing same behaviour as reported in previous comment, except we are using bitbucket webhooks to "git-notify" jenkins. We are running

jenkins 1.609.2
git client plugin 1.19.0
git plugin 2.4.0

cen.is.imba@gmail.com (JIRA)

unread,
May 5, 2016, 7:44:01 AM5/5/16
to jenkinsc...@googlegroups.com

I can confirm this problem still exists in Jenkins 2.0. I have scm polling turned on every minute and the second builds starts exactly one minute after the first one. Both builds are triggered by the same git revision. This makes me think that there is something fundamentally wrong with the scm polling implementation. It should probably check if build is already in progress when the next interval is invoked and skip the interval. At the moment it seems that polling interval does not care about the ongoing builds but just starts a new one since the checked revision was not built yet. This also explains why similar issues are reported when build only duplicates twice. That is because the first build finishes fast enough not to trigger the third build.

Hopefully this gets fixed soon because it's a major bug. Scm poller is basically wasting resources until the first build finishes.

yuyoonshoo@gmail.com (JIRA)

unread,
Feb 8, 2017, 8:30:03 PM2/8/17
to jenkinsc...@googlegroups.com

Confirm with Jenkins 2.42 and most of plugin is the latest version at this moment.
I agree with Klemen Ferjančič . My scenario is following:

  • Jenkins queue is 5 items.
  • each build takes 2 hours.
  • GIT polling for 15 minutes.

When there is a new git commit, GIT polling will queue a build because all executors is busy.
After 15 minutes, this build still in queue because all executors is still busy. At this moment, GIT polling will check again then it queue a new build because "Last Built Revision" remains.
Result: there are two the same build which are queued, in the the Jenkins queue.

My suggestion:
GIT polling should check whether a similar build is queued.

This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

12gonzo12@gmail.com (JIRA)

unread,
Jun 12, 2018, 12:58:01 PM6/12/18
to jenkinsc...@googlegroups.com

I've noticed the issue on multibranch pipelines that use polling. Say a build for a branch takes 10 minutes to run and polling occurs every 2 minutes. If branch A gets committed then branch B gets committed, Jenkins will keep duplicating jobs for branch B every two minutes. This is because Jenkins checks branch B to see if the latest has been built and if not schedules a build, regardless of if one has already been scheduled.

Klemen Ferjančič is correct that Jenkins saves the sha1 when the build is started, but if the build for that branch cannot be started yet because another build is running then multiple builds will keep queuing up. Could the sha1 be saved once the build is queued? Could there be a way to block Jenkins from queuing more than 1 build from the same branch at a time? Is there a better way to prevent duplicate builds from being queued?

This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

mark.earl.waite@gmail.com (JIRA)

unread,
Jun 12, 2018, 1:01:03 PM6/12/18
to jenkinsc...@googlegroups.com
Mark Waite assigned an issue to Unassigned
 
Change By: Mark Waite
Assignee: Nicolas De Loof

martyscheil+jenkins@gmail.com (JIRA)

unread,
Dec 13, 2018, 10:02:04 AM12/13/18
to jenkinsc...@googlegroups.com
Marty S commented on Bug JENKINS-30350
 
Re: Jobs get triggered twice from polling git scm

I'm having the exact same scenario as Christian.

Does anyone have a workaround yet?

This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

12gonzo12@gmail.com (JIRA)

unread,
Dec 13, 2018, 10:08:06 AM12/13/18
to jenkinsc...@googlegroups.com
Christian edited a comment on Bug JENKINS-30350
Unfortunately the only thing that seems to work is either switching to hooks (which we can't do for reasons ) or increase the time between polling. Of course, by increasing the time between polling, your builds will trigger less frequently. We have ours at about 1 hour, which means there could be a delay of up to 1 hour between the time someone commits and the time Jenkins picks it up. I really wish someone would fix this bug, but seeing as it has been around for over 3 years I don't think it will happen.

12gonzo12@gmail.com (JIRA)

unread,
Dec 13, 2018, 10:08:06 AM12/13/18
to jenkinsc...@googlegroups.com

Unfortunately the only thing that seems to work is either switching to hooks (which we can't do) or increase the time between polling. Of course, by increasing the time between polling, your builds will trigger less frequently. We have ours at about 1 hour, which means there could be a delay of up to 1 hour between the time someone commits and the time Jenkins picks it up. I really wish someone would fix this bug, but seeing as it has been around for over 3 years I don't think it will happen.

caratorn@gmail.com (JIRA)

unread,
Feb 22, 2019, 5:49:03 PM2/22/19
to jenkinsc...@googlegroups.com

We were seeing the same problem happen consistently for our project, every time a change would be commited to git, two builds were being triggered with our job setup to poll for new changes every 2 minutes.

But checking out our repository takes more than 4 minutes. So i assume the commit id is being stored right after the checkout has finished, which is why it was only 1 build that was always being queued up.

I would recommend setting the poll schedule to a value that will definitely allow for a full repository checkout before polling again. In our case, 6 minutes seems to be doing the trick.

maheshkumar3459@gmail.com (JIRA)

unread,
Apr 16, 2019, 7:47:02 AM4/16/19
to jenkinsc...@googlegroups.com

Klemen Ferjančič We are also facing the same issue. Upon investigating this can reproducible, When you close the Source branch after the Merge request.

Jenkins triggers multiple builds for the each push

nikhilnanal1@gmail.com (JIRA)

unread,
Nov 7, 2019, 7:29:04 PM11/7/19
to jenkinsc...@googlegroups.com

I am facing this issue as well with Multibranch pipelines on Jenkins 2.164 LTS and exactly as described by Christian above, my polling interval is 2 minutes and builds take longer. when there is pending build it gets retriggerred multiple ( arbitrary number) of times 

This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages