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

PostbuildTask loads build log into memory, causing OutOfMemoryException

    Details

    • Similar Issues:

      Description

      Post build task recently started to generate exception, while it was working great before (upgrade to jenkins 1.449 or 1.450).

      Here is the exception trace. It occurs right after "Archiving artifacts"

      FATAL: Java heap space
      09:36:53 java.lang.OutOfMemoryError: Java heap space
      09:36:53 at java.lang.AbstractStringBuilder.<init>(AbstractStringBuilder.java:62)
      09:36:53 at java.lang.StringBuilder.<init>(StringBuilder.java:97)
      09:36:53 at hudson.Util.loadFile(Util.java:171)
      09:36:53 at hudson.model.Run.getLog(Run.java:1562)
      09:36:53 at hudson.plugins.postbuildtask.PostbuildTask.perform(PostbuildTask.java:99)
      09:36:53 at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
      09:36:53 at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:700)
      09:36:53 at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:675)
      09:36:53 at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:653)
      09:36:53 at hudson.model.Build$RunnerImpl.post2(Build.java:162)
      09:36:53 at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:622)
      09:36:53 at hudson.model.Run.run(Run.java:1434)
      09:36:53 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      09:36:53 at hudson.model.ResourceController.execute(ResourceController.java:88)
      09:36:53 at hudson.model.Executor.run(Executor.java:238)

        Attachments

          Activity

          Hide
          evernat evernat added a comment - - edited

          Is it reproduced with a recent Jenkins version?
          If yes, would it be ok to just increase -Xmx in your configuration?

          (Without more information on your server and on your jobs, it will be hard to know the cause of this. And yes, your current jobs/builds or perhaps new jenkins version may need just a little bit more heap memory than before and that is not always a defect. It depends on what you do with this server.)

          Show
          evernat evernat added a comment - - edited Is it reproduced with a recent Jenkins version? If yes, would it be ok to just increase -Xmx in your configuration? (Without more information on your server and on your jobs, it will be hard to know the cause of this. And yes, your current jobs/builds or perhaps new jenkins version may need just a little bit more heap memory than before and that is not always a defect. It depends on what you do with this server.)
          Hide
          hhatto Hideo Hattori added a comment -

          I'm also have the same error when very large build logfile is outputted.

          Revision 40978: /trunk/hudson/plugins/postbuild-task
          src/main/java/hudson/plugins/postbuildtask/PostbuildTask.java:99
          AbstractBuild.getLog(non-input) is deprecated.

          Can an option value(or default value) be given?

          Thanks.

          Show
          hhatto Hideo Hattori added a comment - I'm also have the same error when very large build logfile is outputted. Revision 40978: /trunk/hudson/plugins/postbuild-task src/main/java/hudson/plugins/postbuildtask/PostbuildTask.java:99 AbstractBuild.getLog(non-input) is deprecated. Can an option value(or default value) be given? http://javadoc.jenkins-ci.org/hudson/model/Run.html#getLog( ) http://javadoc.jenkins-ci.org/hudson/model/Run.html#getLog(int ) Thanks.
          Hide
          recampbell Ryan Campbell added a comment -

          I've seen this as well. The plugin should use getLogInputStream() and convert that into a CharSequence for the regexp.

          http://www.java-tips.org/java-se-tips/java.util.regex/how-to-apply-regular-expressions-on-the-contents-of-a.html

          Show
          recampbell Ryan Campbell added a comment - I've seen this as well. The plugin should use getLogInputStream() and convert that into a CharSequence for the regexp. http://www.java-tips.org/java-se-tips/java.util.regex/how-to-apply-regular-expressions-on-the-contents-of-a.html
          Hide
          nmanos Noam Manos added a comment -

          Having the same error on Jenkins 2.0 with Post build Plugin 1.8 (wow, it was last updated on 2011! perhaps that's a good time to try another plugin...) :

          The console log had over 300K lines (301866 lines), and had to search for a simple word ("sync.props")

          FATAL: Java heap space
          java.lang.OutOfMemoryError: Java heap space
          at java.util.Arrays.copyOfRange(Arrays.java:3664)
          at java.lang.String.<init>(String.java:207)
          at java.lang.StringBuilder.toString(StringBuilder.java:407)
          at hudson.Util.loadFile(Util.java:205)
          at hudson.model.Run.getLog(Run.java:1913)
          at hudson.plugins.postbuildtask.PostbuildTask.perform(PostbuildTask.java:99)
          at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
          at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
          at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
          at hudson.model.Build$BuildExecution.post2(Build.java:185)
          at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668)
          at hudson.model.Run.execute(Run.java:1763)
          at hudson.matrix.MatrixRun.run(MatrixRun.java:146)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:410)
          Started calculate disk usage of build
          Finished Calculation of disk usage of build in 0 seconds
          Started calculate disk usage of workspace
          Finished Calculation of disk usage of workspace in 2 second
          Finished: FAILURE

          Show
          nmanos Noam Manos added a comment - Having the same error on Jenkins 2.0 with Post build Plugin 1.8 (wow, it was last updated on 2011! perhaps that's a good time to try another plugin...) : The console log had over 300K lines (301866 lines), and had to search for a simple word ("sync.props") FATAL: Java heap space java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOfRange(Arrays.java:3664) at java.lang.String.<init>(String.java:207) at java.lang.StringBuilder.toString(StringBuilder.java:407) at hudson.Util.loadFile(Util.java:205) at hudson.model.Run.getLog(Run.java:1913) at hudson.plugins.postbuildtask.PostbuildTask.perform(PostbuildTask.java:99) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723) at hudson.model.Build$BuildExecution.post2(Build.java:185) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668) at hudson.model.Run.execute(Run.java:1763) at hudson.matrix.MatrixRun.run(MatrixRun.java:146) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410) Started calculate disk usage of build Finished Calculation of disk usage of build in 0 seconds Started calculate disk usage of workspace Finished Calculation of disk usage of workspace in 2 second Finished: FAILURE
          Hide
          ebormik Boris Mikusevic added a comment -

          How can I check these ticket created on July 25th?
          JNJira [ 143288 ] JNJira + In-Review [ 175861 ]

          Show
          ebormik Boris Mikusevic added a comment - How can I check these ticket created on July 25th? JNJira [ 143288 ] JNJira + In-Review [ 175861 ]
          Hide
          leonidlee Leonid Lee added a comment -

          I got the same thing.

          Build fails on post-build step.

          
          17:14:36 Sending email for trigger: Always
          17:14:58 FATAL: null
          17:14:58 java.lang.OutOfMemoryError
          17:14:58 at java.lang.AbstractStringBuilder.hugeCapacity(AbstractStringBuilder.java:161)
          17:14:58 at java.lang.AbstractStringBuilder.newCapacity(AbstractStringBuilder.java:155)
          17:14:58 at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:125)
          17:14:58 at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:448)
          17:14:58 at java.lang.StringBuilder.append(StringBuilder.java:136)
          17:14:58 at hudson.Util.replaceMacro(Util.java:176)
          17:14:58 at hudson.Util.replaceMacro(Util.java:142)
          17:14:58 at org.jenkinsci.plugins.envinject.service.EnvInjectEnvVars.resolveVars(EnvInjectEnvVars.java:219)
          17:14:58 at org.jenkinsci.plugins.envinject.EnvInjectListener$2.buildEnvVars(EnvInjectListener.java:211)
          17:14:58 at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:947)
          17:14:58 at org.jenkinsci.plugins.tokenmacro.TokenMacro.expandAll(TokenMacro.java:241)
          17:14:58 at hudson.plugins.emailext.plugins.ContentBuilder.transformText(ContentBuilder.java:71)
          17:14:58 at hudson.plugins.emailext.EmailRecipientUtils.getRecipientList(EmailRecipientUtils.java:187)
          17:14:58 at hudson.plugins.emailext.plugins.recipients.ListRecipientProvider.addRecipients(ListRecipientProvider.java:40)
          17:14:58 at hudson.plugins.emailext.ExtendedEmailPublisher.createMail(ExtendedEmailPublisher.java:590)
          17:14:58 at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:331)
          17:14:58 at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:322)
          17:14:58 at hudson.plugins.emailext.ExtendedEmailPublisher.access$100(ExtendedEmailPublisher.java:61)
          17:14:58 at hudson.plugins.emailext.ExtendedEmailPublisher$1.endBuild(ExtendedEmailPublisher.java:788)
          17:14:58 at hudson.matrix.MatrixBuild$MatrixBuildExecution.post2(MatrixBuild.java:422)
          17:14:58 at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668)
          17:14:58 at hudson.model.Run.execute(Run.java:1763)
          17:14:58 at hudson.matrix.MatrixBuild.run(MatrixBuild.java:313)
          17:14:58 at hudson.model.ResourceController.execute(ResourceController.java:98)
          17:14:58 at hudson.model.Executor.run(Executor.java:410)
          17:14:58 Finished: FAILURE
          
          
          Show
          leonidlee Leonid Lee added a comment - I got the same thing. Build fails on post-build step. 17:14:36 Sending email for trigger: Always 17:14:58 FATAL: null 17:14:58 java.lang.OutOfMemoryError 17:14:58 at java.lang.AbstractStringBuilder.hugeCapacity(AbstractStringBuilder.java:161) 17:14:58 at java.lang.AbstractStringBuilder.newCapacity(AbstractStringBuilder.java:155) 17:14:58 at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:125) 17:14:58 at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:448) 17:14:58 at java.lang.StringBuilder.append(StringBuilder.java:136) 17:14:58 at hudson.Util.replaceMacro(Util.java:176) 17:14:58 at hudson.Util.replaceMacro(Util.java:142) 17:14:58 at org.jenkinsci.plugins.envinject.service.EnvInjectEnvVars.resolveVars(EnvInjectEnvVars.java:219) 17:14:58 at org.jenkinsci.plugins.envinject.EnvInjectListener$2.buildEnvVars(EnvInjectListener.java:211) 17:14:58 at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:947) 17:14:58 at org.jenkinsci.plugins.tokenmacro.TokenMacro.expandAll(TokenMacro.java:241) 17:14:58 at hudson.plugins.emailext.plugins.ContentBuilder.transformText(ContentBuilder.java:71) 17:14:58 at hudson.plugins.emailext.EmailRecipientUtils.getRecipientList(EmailRecipientUtils.java:187) 17:14:58 at hudson.plugins.emailext.plugins.recipients.ListRecipientProvider.addRecipients(ListRecipientProvider.java:40) 17:14:58 at hudson.plugins.emailext.ExtendedEmailPublisher.createMail(ExtendedEmailPublisher.java:590) 17:14:58 at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:331) 17:14:58 at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:322) 17:14:58 at hudson.plugins.emailext.ExtendedEmailPublisher.access$100(ExtendedEmailPublisher.java:61) 17:14:58 at hudson.plugins.emailext.ExtendedEmailPublisher$1.endBuild(ExtendedEmailPublisher.java:788) 17:14:58 at hudson.matrix.MatrixBuild$MatrixBuildExecution.post2(MatrixBuild.java:422) 17:14:58 at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668) 17:14:58 at hudson.model.Run.execute(Run.java:1763) 17:14:58 at hudson.matrix.MatrixBuild.run(MatrixBuild.java:313) 17:14:58 at hudson.model.ResourceController.execute(ResourceController.java:98) 17:14:58 at hudson.model.Executor.run(Executor.java:410) 17:14:58 Finished: FAILURE

            People

            • Assignee:
              Unassigned
              Reporter:
              stibbons stibbons
            • Votes:
              4 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated: