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

Hudson sending mail using SMTP sometimes fails with message "Connection refused"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Minor Minor
    • mailer-plugin
    • None
    • Kubuntu Linux 9.10

      I'm running Hudson 1.324 on Kubuntu Linux 9.10. I've set up SMTP server configuration and configured Hudson to send me email notifications of failed builds. This works, but it fails about 50% of the times with the following message (with anonymised addresses):

      Sending e-mails to: me@mydomain.com
      ERROR: Could not connect to SMTP host: smtp.mysmtpserver.nl, port: 25
      javax.mail.MessagingException: Could not connect to SMTP host: smtp.mysmptserver.nl, port: 25;
      nested exception is:
      java.net.ConnectException: Connection refused
      at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1282)
      at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
      at javax.mail.Service.connect(Service.java:275)
      at javax.mail.Service.connect(Service.java:156)
      at javax.mail.Service.connect(Service.java:105)
      at javax.mail.Transport.send0(Transport.java:168)
      at javax.mail.Transport.send(Transport.java:98)
      at hudson.tasks.MailSender.execute(MailSender.java:97)
      at hudson.tasks.Mailer.perform(Mailer.java:95)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
      at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:480)
      at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:466)
      at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:454)
      at hudson.model.Build$RunnerImpl.post2(Build.java:146)
      at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:438)
      at hudson.model.Run.run(Run.java:1146)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:123)
      Caused by: java.net.ConnectException: Connection refused
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:310)
      at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:176)
      at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:163)
      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)
      at java.net.Socket.connect(Socket.java:542)
      at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:230)
      at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
      at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1250)
      ... 18 more
      Finished: SUCCESS

      This is the same server I use for all my email traffic, and it never bounces like this. Also, sending a test email from Hudson always works. However, for the build messages, it fails 50% of the time.

      The SMTP set up does not use authentication other than IP-based, so no SSL/TLS/whatever is playing a role here.

      I have contacted the ISP but they do not bounce when you send too many messages within too short a time interval, and anyways the messages get sent with 1-2 minutes in between, so it is unlikely that this would trigger any anti-spam filter or something of the kind. The difficult part here is that it works sometimes, but sometimes not.

            Unassigned Unassigned
            hyrrokkin_m hyrrokkin_m
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: