Bamboo unable to connect to mail server due to slow IPv6 DNS lookups

Platform Notice: Data Center Only - This article only applies to Atlassian apps on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Symptoms

Bamboo is not able to connect to a mail server or mail queue keeps getting overloaded as each message takes a long time to leave the queue. Test emails work as intended.

Applies to : Bamboo Data Center, all currently supported versions. The behavior depends on the host's network and DNS setup, not on a specific Bamboo version.

Diagnosis

  1. Enable Mail Debug logging in Bamboo

  2. Generate Thread dumps for Bamboo

  3. Looking at Bamboo debug logs, we can see the message "451 Timeout waiting for data from client":

DEBUG SMTP: trying to connect to host "email.server.com", port 587, isSSL false .... DEBUG SMTP: connected to host "email.server.com", port: 587 EHLO email.server.com 451 Timeout waiting for data from client. HELO email.server.com DEBUG SMTP: EOF: [EOF] 2019-05-27 15:41:40,214 WARN [mail-queue-processor] [EmailService] Uncaught exception while processing mail queue com.atlassian.mail.MailException: javax.mail.MessagingException: [EOF] at com.atlassian.mail.server.impl.SMTPMailServerImpl.sendWithMessageId(SMTPMailServerImpl.java:225) at com.atlassian.mail.server.impl.SMTPMailServerImpl.send(SMTPMailServerImpl.java:162) at com.atlassian.bamboo.mail.EmailService.sendEmailSynchronously(EmailService.java:115) at com.atlassian.bamboo.mail.EmailService$MailQueueProcessor.run(EmailService.java:67) at java.lang.Thread.run(Thread.java:748) Caused by: javax.mail.MessagingException: [EOF] at com.sun.mail.smtp.SMTPTransport.issueCommand(SMTPTransport.java:2168) at com.sun.mail.smtp.SMTPTransport.helo(SMTPTransport.java:1552) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:703) at javax.mail.Service.connect(Service.java:386) at javax.mail.Service.connect(Service.java:245) at javax.mail.Service.connect(Service.java:194) at com.atlassian.mail.server.impl.SMTPMailServerImpl.sendWithMessageId(SMTPMailServerImpl.java:185) ... 4 more

4. The thread dumps will reveal the mail threads are taking a long time in the method java.net.Inet6AddressImpl.lookupAllHostAddr:

"mail-queue-processor" #49 daemon prio=5 os_prio=0 tid=0x00007ff727563000 nid=0x7a63 runnable [0x00007ff7232f3000] java.lang.Thread.State: RUNNABLE at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:929) at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1324) at java.net.InetAddress.getLocalHost(InetAddress.java:1501) - locked <0x00000000c0dfb8a0> (a java.lang.Object) at com.sun.mail.smtp.SMTPTransport.getLocalHost(SMTPTransport.java:253) - locked <0x00000000e00ae788> (a com.sun.mail.smtp.SMTPTransport) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:701) - locked <0x00000000e00ae788> (a com.sun.mail.smtp.SMTPTransport)

Cause

Java resolves host names by calling the operating system's resolver (`getaddrinfo`). On a host with IPv6 turned on, it asks for both IPv4 (A) and IPv6 (AAAA) addresses. If the DNS server, the network, or the local resolver settings don't handle AAAA queries properly (for example, the queries are dropped instead of answered), each lookup waits for the resolver's timeout and retries. Mail threads in Bamboo block for that whole time, and the mail server may close the session with a `451` timeout.

Solution

Resolution

  • Set the following parameter on Bamboo startup:

    -Djava.net.preferIPv4Stack=true

    With the parameter stated above set to true, Java will not execute IPv6 lookup methods and the problem should be avoided.

Updated on October 22, 2026

Still need help?

The Atlassian Community is here for you.