Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-9315

Bamboo throws NumberFormatException when trying to send mail

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Low Low
    • 3.2
    • 3.1.4
    • Notifications
    • None
    • CentOS 5.5, JDK 1.6.0_24

      After restarting our Bamboo 3.1.4 server this morning, we noticed no notifications were being sent.
      When we attempted to send a test mail from the admin interface, Bamboo threw a exception.
      All of the settings appeared to be correct, but we clicked the edit button.
      Without changing any of the settings, we tried sending a test mail from the edit screen, and it worked without issue.
      We saved the configuration (having changed nothing) and emails started sending again.
      However, the issue seems to re-appear if you restarted Bamboo.
      Below is the stack-trace seen in the logs when builds attempt to send notifications while the error appears.

      2011-07-18 07:13:19,192 ERROR [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-16] [EmailListener] Failed to find mail server
      java.lang.NumberFormatException: For input string: "null"
              at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
              at java.lang.Integer.parseInt(Integer.java:449)
              at java.lang.Integer.parseInt(Integer.java:499)
              at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:398)
              at javax.mail.Service.connect(Service.java:288)
              at javax.mail.Service.connect(Service.java:169)
              at javax.mail.Service.connect(Service.java:118)
              at javax.mail.Transport.send0(Transport.java:188)
              at javax.mail.Transport.send(Transport.java:118)
              at alt.javax.mail.TransportImpl.send(TransportImpl.java:18)
              at com.atlassian.mail.server.impl.SMTPMailServerImpl.send(SMTPMailServerImpl.java:155)
              at com.atlassian.bamboo.mail.EmailListener.handleEvent(EmailListener.java:64)
              at com.atlassian.event.legacy.LegacyListenerHandler$LegacyListenerInvoker.invoke(LegacyListenerHandler.java:55)
              at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$2.run(AsynchronousAbleEventDispatcher.java:60)
              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
              at com.atlassian.bamboo.build.pipeline.concurrent.NamedThreadFactory$2.run(NamedThreadFactory.java:50)
              at java.lang.Thread.run(Thread.java:662)
      

            [BAM-9315] Bamboo throws NumberFormatException when trying to send mail

            bmccoy added a comment -

            Well we will leave it as an unsolved mystery then. Please let us know if it happens again.
            I have made this code a bit more defensive in 3.2 so if it happens again it hopefully wont blow up quite as badly!

            Cheers,
            Brydie

            bmccoy added a comment - Well we will leave it as an unsolved mystery then. Please let us know if it happens again. I have made this code a bit more defensive in 3.2 so if it happens again it hopefully wont blow up quite as badly! Cheers, Brydie

            Hey Krystian,
            The restart happened and the mail settings were preserved. Seems to have been a transient issue.

            David Corley added a comment - Hey Krystian, The restart happened and the mail settings were preserved. Seems to have been a transient issue.

            David

            Has the restart happened today or is it 01.08.2011 Monday?

            Cheers,
            Krystian

            Krystian Brazulewicz added a comment - David Has the restart happened today or is it 01.08.2011 Monday? Cheers, Krystian

            Hey Brydie,
            I checked bamboo-mail.cfg.xml and the port setting is there.
            I also checked the write permissions for the Bamboo user, and Bamboo is able to write to that file.

            We'll be restarting Bamboo next Monday at 7am GMT, so I'll report back then and see if the issue still exists.

            David Corley added a comment - Hey Brydie, I checked bamboo-mail.cfg.xml and the port setting is there. I also checked the write permissions for the Bamboo user, and Bamboo is able to write to that file. We'll be restarting Bamboo next Monday at 7am GMT, so I'll report back then and see if the issue still exists.

            bmccoy added a comment -

            Hi David,

            It looks like the port has been lost/not set for the mail configuration. When you edit it, the port is being set in memory (so works till restart), but does not appear to be persisted to the configuration settings on file.

            The mail configuration is stored in <bamboo-home>/bamboo-mail.cfg.xml.

            1. Can you please check to see if the <port> does actually exist in this file.
            2. Is there any reason why Bamboo might not be able to write to this file (e.g. permissions, being locked by another process)?

            If there is no port defined, you can probably work around this issue by manually adding <port>25</port> to the smtp-server configuration. However, it would be nice to figure out why its not working!

            Cheers,
            Brydie

            bmccoy added a comment - Hi David, It looks like the port has been lost/not set for the mail configuration. When you edit it, the port is being set in memory (so works till restart), but does not appear to be persisted to the configuration settings on file. The mail configuration is stored in <bamboo-home>/bamboo-mail.cfg.xml. Can you please check to see if the <port> does actually exist in this file. Is there any reason why Bamboo might not be able to write to this file (e.g. permissions, being locked by another process)? If there is no port defined, you can probably work around this issue by manually adding <port>25</port> to the smtp-server configuration. However, it would be nice to figure out why its not working! Cheers, Brydie

              bmccoy bmccoy
              b0d88db9bee7 David Corley
              Affected customers:
              0 This affects my team
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: