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

Jenkins concurrent builds not working when triggered simultaneously

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • core
    • Jenkins ver. 2.55

      Hi Team,

      Facing problem while trying to trigger concurrent executions of a job via Jenkins API.

      Have configured a job to run builds concurrently.

      It works fine when the jobs are triggered after a few minutes. Execute first job run, let it get started and then start the second job run. Both the first and second jobs run concurrently now and we get separate build ids for each job run.

      However, when we try to execute job concurrently at the same time it just triggers one execution of the job and returns its build id.

      Have tested it with both the python-jenkins wrapper and Jenkins python REST API. Please find both the scripts attached.

      Suspect the queue does not take more then one instance of the job at a given time. Can only see one instance of my job on the queue when we trigger simultaneous invocation.

      Tried to change the build parameters as well but still face the same problem.

      Can someone please help.

      Regards,

      Narendra Patel

        1. config.xml
          2 kB
        2. jenkins_rest_api.py
          1 kB
        3. python-jenkins.py
          1 kB

          [JENKINS-44284] Jenkins concurrent builds not working when triggered simultaneously

          Oleg Nenashev added a comment - - edited

          Please check parameters you pass to the job. If the parameters are same, Jenkins Queue merges pending tasks

          Oleg Nenashev added a comment - - edited Please check parameters you pass to the job. If the parameters are same, Jenkins Queue merges pending tasks

          Hi Oleg,

          Have tried it with different parameters as well. Same issue.

          By parameters i mean the values to the parameters, the count/name of parameters is the same.

          You can also have a look at the attached scripts that we are using.
          python-jenkins would require pip install of python-jenkins.
          jenkins_rest_api.py should only require Python 2.7

          Regards,

          Narendra Patel

          Narendra Patel added a comment - Hi Oleg, Have tried it with different parameters as well. Same issue. By parameters i mean the values to the parameters, the count/name of parameters is the same. You can also have a look at the attached scripts that we are using. python-jenkins would require pip install of python-jenkins. jenkins_rest_api.py should only require Python 2.7 Regards, Narendra Patel

          Oleg Nenashev added a comment -

          If the parameters are same, it works as expected. Please provide the job's config.xml just in case there is something inside.

          Oleg Nenashev added a comment - If the parameters are same, it works as expected. Please provide the job's config.xml just in case there is something inside.

          Hi Oleg,

          Please find the config.xml attached to the case.

          Thank you for helping us out here!!

          Regards,

          Narendra Patel

          Narendra Patel added a comment - Hi Oleg, Please find the config.xml attached to the case. Thank you for helping us out here!! Regards, Narendra Patel

          Hi Oleg,

          Did you got a chance to have a look at the configuration file.

          Narendra Patel added a comment - Hi Oleg, Did you got a chance to have a look at the configuration file.

          Hi Oleg,

          Have implemented a workaround for time being.

          Before building a job my code polls the jenkins queue and checks if a previous build/instance of the current job is already in queue. If yes, then it waits for a pre-configured amount of time and periodically polls, in this time interval, the queue again to check if the job is sent of execution and is no more in the queue. If yes, then it initiates my new build else it timeouts and raises my custom exception.

          Regards,

          Narendra Patel

          Narendra Patel added a comment - Hi Oleg, Have implemented a workaround for time being. Before building a job my code polls the jenkins queue and checks if a previous build/instance of the current job is already in queue. If yes, then it waits for a pre-configured amount of time and periodically polls, in this time interval, the queue again to check if the job is sent of execution and is no more in the queue. If yes, then it initiates my new build else it timeouts and raises my custom exception. Regards, Narendra Patel

          Same problem here, however it seems to help if the build job is submitted with quietPeriod: 0

          Petr Zahradník added a comment - Same problem here, however it seems to help if the build job is submitted with quietPeriod: 0

            Unassigned Unassigned
            narendrapatel Narendra Patel
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: