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

Email-ext can't recover after a failed smtp delivery

      I used the email-ext to set up notifications for build success, but had Jenkins set up to use an smtp server that was company-internal. This worked fine when I only had company internal mail recipients, but when I added an outside recipient, the build failed because email-ext returned an SMTPException: Could not deliver. All this is fine and expected in a PEBKAC situation.

      However, when I had set up a new, proper smtp server in Jenkins and sent successful test emails through the Jenkins configuration page, I figured everything would be fine. But the next time a build finished, no emails were sent out even though the build finished as normal. Checking the logs I found that it said:

      "
      Email was triggered for: Success
      Sending email for trigger: Success
      "

      The two usual last lines with "Sending email to: blah@blah, Finished: SUCCESS" were missing. Obviously email-ext was unable to recover from the previous error even though the settings had been corrected. I worked around the problem by restarting Jenkins, and everything started working as expected with the new configuration.

          [JENKINS-15311] Email-ext can't recover after a failed smtp delivery

          nalin_makar added a comment -

          We ran into this issue with our deployment as well. We are running v2.24.1. Email-Ext stops sending out any emails until Jenkins is restarted once it reaches this state.

          nalin_makar added a comment - We ran into this issue with our deployment as well. We are running v2.24.1. Email-Ext stops sending out any emails until Jenkins is restarted once it reaches this state.

          Alex Earl added a comment -

          I will try and reproduce this locally.

          Alex Earl added a comment - I will try and reproduce this locally.

          Alex Earl added a comment -

          Are you using "Override Global Settings" for the smtp settings, or are you using the default Jenkins area for specifying the SMTP settings?

          Alex Earl added a comment - Are you using "Override Global Settings" for the smtp settings, or are you using the default Jenkins area for specifying the SMTP settings?

          Robert Nordan added a comment -

          I used the default Jenkins area for SMTP settings.

          Robert Nordan added a comment - I used the default Jenkins area for SMTP settings.

          Alex Earl added a comment -

          In that case it may be an issue with the core because email-ext uses the core emailer's session creation for sending the email.

          Alex Earl added a comment - In that case it may be an issue with the core because email-ext uses the core emailer's session creation for sending the email.

          I experienced the same issue today. It'd be nice for an error message to be generated.

          bootstraponline added a comment - I experienced the same issue today. It'd be nice for an error message to be generated.

          Alex Earl added a comment -

          I could not replicate it when I tried. What version of core are you running?

          Alex Earl added a comment - I could not replicate it when I tried. What version of core are you running?

          bootstraponline added a comment - - edited

          1.485. I restarted Jenkins and now mail-ext works.

          bootstraponline added a comment - - edited 1.485. I restarted Jenkins and now mail-ext works.

          Alex Earl added a comment -

          I can only test on the LTS which is what email-ext supports. I don't have a system I can try it on.

          Alex Earl added a comment - I can only test on the LTS which is what email-ext supports. I don't have a system I can try it on.

          Couldn't the success detection logic be improved to determine if an email was truly sent or not? The issue isn't so much that email-ext doesn't recover after failure, rather it's the false positive of claiming success when no email has been sent.

          bootstraponline added a comment - Couldn't the success detection logic be improved to determine if an email was truly sent or not? The issue isn't so much that email-ext doesn't recover after failure, rather it's the false positive of claiming success when no email has been sent.

          Alex Earl added a comment -

          If the "Sending email to:..." is not logged, then no email is being sent, so there is no false positive.

          Alex Earl added a comment - If the "Sending email to:..." is not logged, then no email is being sent, so there is no false positive.

          Alex Earl added a comment -

          Please try using the override default settings feature of email-ext and see if you see the same issue. I want to isolate if something changed in core (which is used if you don't override).

          Alex Earl added a comment - Please try using the override default settings feature of email-ext and see if you see the same issue. I want to isolate if something changed in core (which is used if you don't override).

          bootstraponline added a comment - - edited

          The current behavior is "Sending email for trigger: Success" and then nothing. It'd be better to have a line that says "Unable to send email. Email-ext can't recover from errors. Please restart Jenkins and try again."

          I restarted Jenkins so I can no longer reproduce the error. I didn't override default settings though.

          bootstraponline added a comment - - edited The current behavior is "Sending email for trigger: Success" and then nothing. It'd be better to have a line that says "Unable to send email. Email-ext can't recover from errors. Please restart Jenkins and try again." I restarted Jenkins so I can no longer reproduce the error. I didn't override default settings though.

          Alex Earl added a comment -

          If the core emailer never returns, then I can't log something saying there was an error. It's a closed box basically.

          Alex Earl added a comment - If the core emailer never returns, then I can't log something saying there was an error. It's a closed box basically.

          Alex Earl added a comment -

          I have no way of replicating this, so it will only get some traction if someone is willing to run with a debug version of the plugin.

          Alex Earl added a comment - I have no way of replicating this, so it will only get some traction if someone is willing to run with a debug version of the plugin.

          I'll try to reproduce the issue on a local Jenkins install. Where is the debug version of the plugin?

          bootstraponline added a comment - I'll try to reproduce the issue on a local Jenkins install. Where is the debug version of the plugin?

          Alex Earl added a comment -

          I will need to build one. I'll attach it here when its done.

          Alex Earl added a comment - I will need to build one. I'll attach it here when its done.

          Alex Earl added a comment -

          Please try this, it has some added debug if you turn it on in the global config.

          Alex Earl added a comment - Please try this, it has some added debug if you turn it on in the global config.

          Alex Earl added a comment -

          Need more information from submitted. Reopen with more information.

          Alex Earl added a comment - Need more information from submitted. Reopen with more information.

            slide_o_mix Alex Earl
            robpvn Robert Nordan
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: