Mail fails to send intermittently with Unknown SMTP host error

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

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.

*Fisheye および Crucible は除く

問題

After configuring a mail server with Confluence, test emails are successful and most notifications are sent successfully as well. Sometimes regularly scheduled e-mails will fail to send. These emails fail to be sent at random intervals throughout the day as well.

The following appears in the atlassian-confluence.log each time the emails are unsuccessful.

2015-06-13 00:01:30,111 ERROR [scheduler_Worker-2] [atlassian.core.task.AbstractErrorQueuedTaskQueue] handleException com.atlassian.mail.MailException: javax.mail.MessagingException: Unknown SMTP host: smtp.hostname.com;
  nested exception is:
  java.net.UnknownHostException: smtp.hostname.com
com.atlassian.mail.MailException: javax.mail.MessagingException: Unknown SMTP host: smtp.hostname.com;
  nested exception is:
  java.net.UnknownHostException: smtp.hostname.com
2015-10-23 10:30:25,153 ERROR [scheduler_Worker-6] [atlassian.core.task.AbstractErrorQueuedTaskQueue] handleException com.atlassian.mail.MailException: javax.mail.MessagingException: Unknown SMTP host: smtp.hostname.com;
  nested exception is:
  java.net.UnknownHostException: smtp.hostname.com
com.atlassian.mail.MailException: javax.mail.MessagingException: Unknown SMTP host: smtp.hostname.com;
  nested exception is:
  java.net.UnknownHostException: smtp.hostname.com

診断

環境

  • Confluence is configured with a mail server that uses dynamic IPs

Diagnostic Steps

  • Check the IP of the mail server from the server that Confluence is running on to make sure that it is reachable. We can run the following in a terminal to get a list of the IPs:

    nslookup <canonical name of mail server>

This should return a list of IPs used. If you keep running this command once a day the list of IPs will regularly change as these are dynamic IPs. The JVM caches these IPs for a certain amount of time, and is sometimes configured to never re-resolve the DNS lookup. In this case, some of the older IPs are cached and the JVM tried to use those to communicate with the mail server. This causes the 'Unknown SMTP host' error. 

ソリューション

Manually configure the JVM to cache these IPs for smaller periods of time.

This can be configured through the 'networkaddress.cache.ttl' setting by modifying your java.security file found in %JRE%/lib/security. Check in the Java directory that Confluence is running on for that file, and add the following line:

networkaddress.cache.ttl=60

This will set your JVM DNS cache to 60 seconds. Since the error happens once every few hours in the examples observed previously, this should address the issue. We recommend restarting the server altogether to ensure this change is picked up by the JVM.

Last modified on Mar 30, 2016

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.