Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-36833

Race Condition Populating Multiple Tag Parameters


      I'm observing a minor but somewhat annoying issue with the plugin: if a project has multiple tag parameters, and if at build time the tags need to be fetched, then multiple fetch operations are performed concurrently that may lead to failure due to git file locking. Here's some truncated log:

      Command "git -c core.askpass=true fetch --tags --progress <repo> +refs/heads/master:refs/remotes/origin/master --prune" returned status code 1:
      stderr: remote: Counting objects: 1
      remote: Counting objects: 51, done
      remote: Finding sources:   3% (1/27)
      remote: Finding sources:   7% (2/27)
      remote: Finding sources:  96% (26/27)
      remote: Finding sources: 100% (27/27)
      remote: Total 27 (delta 12), reused 27 (delta 12)
      error: cannot lock ref 'refs/remotes/origin/master': Unable to create '/opt/jenkins_slave/workspace/deploy-production/.git/refs/remotes/origin/master.lock': File exists.
      Another git process seems to be running in this repository, e.g.
      an editor opened by 'git commit'. Please make sure all processes
      are terminated then try again. If it still fails, a git process
      may have crashed in this repository earlier:
      remove the file manually to continue.
      From <repo>
       ! 97af2f9..8a2a820  master     -> origin/master  (unable to update local ref)
       * [new tag]         <tag> -> <tag>
       Pleas look to log!

      It's possible to work around, as I can reload the Build page and tags will populate after the fetch has been done at least once. Our repo has many tags and branches though and fetching can take maybe 30+ seconds, after which having to reload the page can be a minor burden. Eventually the intention here is that engineers outside of our devops / infrastructure team should be able to trigger builds and deploys via Jenkins - these are potentially junior engineers / interns, so I'm trying to make the user experience as easy as possible.

            klimas7 Boguslaw Klimas
            ltdowney Luke Downey
            0 Vote for this issue
            2 Start watching this issue