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

Running scheduleBuild from system groovy script crashes Jenkins

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • core, groovy-plugin
    • None
    • version 1.620

      I am using a system groovy script to launch jenkins jobs as follows:

          def job = hudson.model.Hudson.instance.getJob(jobData['JobName'])
          def params = jobData['Parameters'].collect { key, val -> new hudson.model.StringParameterValue(key, val) }
          def paramsAction = new hudson.model.ParametersAction(params)
          def cause = new hudson.model.Cause.UpstreamCause(build)
          def causeAction = new hudson.model.CauseAction(cause)
          hudson.model.Hudson.instance.queue.schedule(job, 0, causeAction, paramsAction)
      

      This works fine, except if the system groovy script crashes or gets aborted. Then suddenly Jenkins appears to go into a death spiral, with the UI slowing down to a crawl and eventually crashing.

          [JENKINS-30707] Running scheduleBuild from system groovy script crashes Jenkins

          I guess the issue is that if the script launching these jobs is aborted, the threads running those scripts suddenly become orphaned. It might be nice if the groovy excutor could reap those threads in some manner.

          Christian Goetze added a comment - I guess the issue is that if the script launching these jobs is aborted, the threads running those scripts suddenly become orphaned. It might be nice if the groovy excutor could reap those threads in some manner.

            vjuranek vjuranek
            cg Christian Goetze
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: