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

Email-ext throws NullPointerException when "attach build log" is checked on 1.480.3

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • email-ext-plugin
    • OS Windows_NT
      PROCESSOR_ARCHITECTURE x86
      PROCESSOR_ARCHITEW6432 AMD64

      java.runtime.version 1.6.0_26-b03
      Jenkins war org.jenkins-ci.main:jenkins-war:1.480.3

      List of plugins used in project:

      multiple-scms
      mercurial
      subversion
      nant
      sonar
      flexible-publish
      email-ext

      I perform a fairly simple build, use the flexible-plugin to only archive on success and then send an email. Without "attach build log" checked everything works, with it checked I get the following error:

      Run condition [Current build status] enabling perform for step [Archive the artifacts]
      Archiving artifacts
      Checking for post-build
      Performing post-build step
      Checking if email needs to be generated
      Email was triggered for: Success
      Sending email for trigger: Success
      NOT overriding default server settings, using Mailer to create session
      messageContentType = text/plain; charset=UTF-8
      Request made to attach build log
      Adding recipients from recipient list
      Successfully created MimeMessage
      Sending email to: MY.USERNAME@MYPLACEOFEMPLOYMENT.com
      ERROR: Could not send email as a part of the post-build publishers.
      java.lang.NullPointerException
      at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:311)
      at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:289)
      at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:249)
      at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:718)
      at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:693)
      at hudson.model.Build$BuildExecution.cleanUp(Build.java:192)
      at hudson.model.Run.execute(Run.java:1546)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:237)
      Some error occured trying to send the email...check the Jenkins log

        1. email-ext.hpi
          4.99 MB
        2. email-ext.hpi
          4.99 MB
        3. zip-build-before-attach.diff
          11 kB

          [JENKINS-16919] Email-ext throws NullPointerException when "attach build log" is checked on 1.480.3

          Mark Orchard added a comment -

          The new snapshot has eliminated the NullPointerException, I now see the following in the job log:

          00:42:56.447 Checking for post-build
          00:42:56.447 Performing post-build step
          00:42:56.447 Checking if email needs to be generated
          00:42:56.447 Email was triggered for: Success
          00:42:56.447 Sending email for trigger: Success
          00:42:56.447 NOT overriding default server settings, using Mailer to create session
          00:42:56.585 messageContentType = text/plain; charset=UTF-8
          00:42:56.597 Request made to attach build log
          00:42:56.613 Adding recipients from recipient list
          00:42:56.618 Successfully created MimeMessage
          00:42:56.618 Sending email to: MY.USERNAME@MYPLACEOFEMPLOYMENT.com
          00:42:57.041 Error sending to the following VALID addresses: MY.USERNAME@MYPLACEOFEMPLOYMENT.com
          00:42:57.068 Finished: SUCCESS

          and basically nothing in the jenkins log:

          Feb 21, 2013 7:05:53 PM hudson.model.Run execute
          INFO: LE_Team_Test_Build #75 main build action completed: SUCCESS

          I don't have access to modify the JVM options from home, so I'll make the change first thing tomorrow once I get into the office.

          Thanks

          Mark Orchard added a comment - The new snapshot has eliminated the NullPointerException, I now see the following in the job log: 00:42:56.447 Checking for post-build 00:42:56.447 Performing post-build step 00:42:56.447 Checking if email needs to be generated 00:42:56.447 Email was triggered for: Success 00:42:56.447 Sending email for trigger: Success 00:42:56.447 NOT overriding default server settings, using Mailer to create session 00:42:56.585 messageContentType = text/plain; charset=UTF-8 00:42:56.597 Request made to attach build log 00:42:56.613 Adding recipients from recipient list 00:42:56.618 Successfully created MimeMessage 00:42:56.618 Sending email to: MY.USERNAME@MYPLACEOFEMPLOYMENT.com 00:42:57.041 Error sending to the following VALID addresses: MY.USERNAME@MYPLACEOFEMPLOYMENT.com 00:42:57.068 Finished: SUCCESS and basically nothing in the jenkins log: Feb 21, 2013 7:05:53 PM hudson.model.Run execute INFO: LE_Team_Test_Build #75 main build action completed: SUCCESS I don't have access to modify the JVM options from home, so I'll make the change first thing tomorrow once I get into the office. Thanks

          Alex Earl added a comment -

          Ok, I need to output the exception error, let me build another snapshot, sorry I didn't have that in before.

          Alex Earl added a comment - Ok, I need to output the exception error, let me build another snapshot, sorry I didn't have that in before.

          Alex Earl added a comment -

          Try this one please

          Alex Earl added a comment - Try this one please

          Mark Orchard added a comment -

          Ah that did it!

          00:52:58.856 Checking for post-build
          00:52:58.856 Performing post-build step
          00:52:58.856 Checking if email needs to be generated
          00:52:58.856 Email was triggered for: Success
          00:52:58.856 Sending email for trigger: Success
          00:52:58.856 NOT overriding default server settings, using Mailer to create session
          00:52:58.950 messageContentType = text/plain; charset=UTF-8
          00:52:58.953 Request made to attach build log
          00:52:58.964 Adding recipients from recipient list
          00:52:58.969 Successfully created MimeMessage
          00:52:58.969 Sending email to: MY.USERNAME@MYPLACEOFEMPLOYMENT.com
          00:52:59.341 Error sending to the following VALID addresses: MY.USERNAME@MYPLACEOFEMPLOYMENT.com
          00:52:59.341 SendFailedException message: 552 4.3.1 Message size exceeds fixed maximum message size
          00:52:59.341
          00:52:59.342 Finished: SUCCESS

          It appears my build log it too large to email (it runs in at about 5mb). I'll have to work out a way to write it to disk and compress it before trying to attach it. Thanks Alex, you've been super helpful!

          Mark Orchard added a comment - Ah that did it! 00:52:58.856 Checking for post-build 00:52:58.856 Performing post-build step 00:52:58.856 Checking if email needs to be generated 00:52:58.856 Email was triggered for: Success 00:52:58.856 Sending email for trigger: Success 00:52:58.856 NOT overriding default server settings, using Mailer to create session 00:52:58.950 messageContentType = text/plain; charset=UTF-8 00:52:58.953 Request made to attach build log 00:52:58.964 Adding recipients from recipient list 00:52:58.969 Successfully created MimeMessage 00:52:58.969 Sending email to: MY.USERNAME@MYPLACEOFEMPLOYMENT.com 00:52:59.341 Error sending to the following VALID addresses: MY.USERNAME@MYPLACEOFEMPLOYMENT.com 00:52:59.341 SendFailedException message: 552 4.3.1 Message size exceeds fixed maximum message size 00:52:59.341 00:52:59.342 Finished: SUCCESS It appears my build log it too large to email (it runs in at about 5mb). I'll have to work out a way to write it to disk and compress it before trying to attach it. Thanks Alex, you've been super helpful!

          Alex Earl added a comment -

          I'll leave this open because of the NPE exception and leave the fix in that I have now.

          Alex Earl added a comment - I'll leave this open because of the NPE exception and leave the fix in that I have now.

          Code changed in jenkins
          User: Alex Earl
          Path:
          src/main/java/hudson/plugins/emailext/ExtendedEmailPublisher.java
          http://jenkins-ci.org/commit/email-ext-plugin/9f207ef592417158ad01c711c1a6b9349c9edb5a
          Log:
          Fix JENKINS-16919

          Fixed NPE by checking return of the getters for the SendFailedException.


          You received this message because you are subscribed to the Google Groups "Jenkins Commits" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com.
          For more options, visit https://groups.google.com/groups/opt_out.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Alex Earl Path: src/main/java/hudson/plugins/emailext/ExtendedEmailPublisher.java http://jenkins-ci.org/commit/email-ext-plugin/9f207ef592417158ad01c711c1a6b9349c9edb5a Log: Fix JENKINS-16919 Fixed NPE by checking return of the getters for the SendFailedException. – You received this message because you are subscribed to the Google Groups "Jenkins Commits" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out .

          Alex Earl added a comment -

          Fixed NPE when error occurs sending email.

          Alex Earl added a comment - Fixed NPE when error occurs sending email.

          Mark Orchard added a comment -

          Hi Alex,

          I'm not entirely sure this is the right place to ask (actually I'm sure it isn't). I've added the option to compress the build log before attaching it to the email, I've tested the change on my local jenkins instance, and would like to push the change back into the email-ext repo, but I'm not sure what the process is, for now I've attached a git patch file to this ticket.

          Mark Orchard added a comment - Hi Alex, I'm not entirely sure this is the right place to ask (actually I'm sure it isn't). I've added the option to compress the build log before attaching it to the email, I've tested the change on my local jenkins instance, and would like to push the change back into the email-ext repo, but I'm not sure what the process is, for now I've attached a git patch file to this ticket.

          Alex Earl added a comment -

          Best thing to do is fork the plugin on GitHub, make the changes and push to your fork then issue a pull request.

          Alex Earl added a comment - Best thing to do is fork the plugin on GitHub, make the changes and push to your fork then issue a pull request.

          Mark Orchard added a comment -

          Cool, thanks. I'll try that... Time to go learn howto git!

          Mark Orchard added a comment - Cool, thanks. I'll try that... Time to go learn howto git!

            slide_o_mix Alex Earl
            morchard Mark Orchard
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: