Mail fails to send intermittently with Unknown SMTP host error

お困りですか?

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

コミュニティに質問

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

問題

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

診断ステップ

  • 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.