java.lang.OutOfMemoryError

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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)
    via by martin naughton,
  • 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)
    via by martin naughton,
  • OutOfMemoryError in StringBuilder and HashSet
    via Stack Overflow by Dongle
    ,
  • Report generation OOME
    via GitHub by isavin
    ,
    • 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)

    Users with the same issue

    Unknown visitor
    Unknown visitor1 times, last one,
    HandemelindoHandemelindo
    1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    harshgharshg
    2 times, last one,
    sunilssunils
    1 times, last one,
    57 more bugmates