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

JobDSL Plugin can produce never ending jobs (resource leak)

    Details

    • Similar Issues:

      Description

      It is possible to create a job which will never end by configuring a job like:

      
      job {
      	name "Test"
      	configure { root ->
      	     // Please note I forgot to start with "root"
      		(properties / 'hudson.plugins.disk__usage.DiskUsageProperty').@plugin="disk-usage@0.23"
      	}
      }
      

      I did obviously a mistake in the configuration block since I start with "properties" instead of "root". Neverless it would be good if in this case the job would just fail.

      JobDSL Plugin Version 1.22

        Attachments

          Activity

          Hide
          dkuffner Daniel Kuffner added a comment - - edited

          Just for clarification, the JobDSL Plugin job hangs forever

          Show
          dkuffner Daniel Kuffner added a comment - - edited Just for clarification, the JobDSL Plugin job hangs forever
          Hide
          daspilker Daniel Spilker added a comment -

          The problem is that properties collects all properties of the job object, so all getter methods get called. Unfortunately, also getXml() is called which generates the config XML for the job. And there starts the recursion because to generated the XML, all configure block will be evaluated. And the configure block will try to generated the XML which calls the configure block and so on.

          As a workaround I tried to make the "Process Job DSLs" step abortable by checking the thread's interrupted flag and throwing a InterruptedException. But that didn't work because the exception is caught somewhere and never aborts the build step.

          Another solution would be to rename getXml() and getNode() to createXml() and createNode(). That would change the API, but will break the recursion since properties no longer causes the XML to be generated.

          Show
          daspilker Daniel Spilker added a comment - The problem is that properties collects all properties of the job object, so all getter methods get called. Unfortunately, also getXml() is called which generates the config XML for the job. And there starts the recursion because to generated the XML, all configure block will be evaluated. And the configure block will try to generated the XML which calls the configure block and so on. As a workaround I tried to make the "Process Job DSLs" step abortable by checking the thread's interrupted flag and throwing a InterruptedException. But that didn't work because the exception is caught somewhere and never aborts the build step. Another solution would be to rename getXml() and getNode() to createXml() and createNode() . That would change the API, but will break the recursion since properties no longer causes the XML to be generated.
          Hide
          daspilker Daniel Spilker added a comment -

          Will be fixed in 1.26.

          Show
          daspilker Daniel Spilker added a comment - Will be fixed in 1.26.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Daniel Spilker
          Path:
          docs/Home.md
          http://jenkins-ci.org/commit/job-dsl-plugin/bc55db2f4737cd73ff64815bbd3f455d41ce71fa
          Log:
          mention fix for JENKINS-22708 in release notes

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Spilker Path: docs/Home.md http://jenkins-ci.org/commit/job-dsl-plugin/bc55db2f4737cd73ff64815bbd3f455d41ce71fa Log: mention fix for JENKINS-22708 in release notes

            People

            • Assignee:
              daspilker Daniel Spilker
              Reporter:
              dkuffner Daniel Kuffner
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: