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

Unable to add to variable that is set before the build is executed. Produces OOM exception

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Duplicate
    • Component/s: envinject-plugin
    • Labels:
      None
    • Environment:
      Windows XP
    • Similar Issues:

      Description

      I am trying to add to an variable that is already in Jenkins.If i have the following entry in my properties file.
      PATH = C:\PROGRAM\BIN;$PATH

      and i check the injectedEnvVars.txt file i see that PATH is set to this

      PATH=C:\PROGRAM\BIN;C:\PROGRAM\BIN;C:\PROGRAM\BIN;C:\PROGRAM\BIN;C:\PROGRAM\BIN;C:\PROGRAM\BIN;C:\PROGRAM\BIN;C:\PROGRAM\BIN;

      and so on. IT could be 1000 C:\PROGRAM\BIN; printed in the file making the jenkins build run out of memory.

      I had a look at the code and it might be where the file is being read. IT might be looping around. This can happen with any variable just not PATH.

      This will produce the problem also. There is a loop some where that adds the variable to the variable over and over.
      OS=Windows_NT;$OS

      This is the exception that is produced by Jenkins.

      Archiving artifacts
      FATAL: Java heap space
      java.lang.OutOfMemoryError: Java heap space
      at java.util.Arrays.copyOf(Arrays.java:2894)
      at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:117)
      at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:407)
      at java.lang.StringBuilder.append(StringBuilder.java:136)
      at hudson.Util.replaceMacro(Util.java:160)
      at hudson.Util.replaceMacro(Util.java:127)
      at org.jenkinsci.plugins.envinject.service.EnvInjectEnvVars.resolveVars(EnvInjectEnvVars.java:206)
      at org.jenkinsci.plugins.envinject.EnvInjectListener$2.buildEnvVars(EnvInjectListener.java:211)
      at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:942)
      at hudson.tasks.ArtifactArchiver.perform(ArtifactArchiver.java:136)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804)
      at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:776)
      at hudson.model.Build$BuildExecution.post2(Build.java:183)
      at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:726)
      at hudson.model.Run.execute(Run.java:1628)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:247)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                gbois Gregory Boissinot
                Reporter:
                martin_naughton martin naughton
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: