Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Why this happens

A FolderClosedException is caused when the connection between Jira and the inbound Mail server is closed abruptly by the mail server whilst mail is being retrieved. This is caused by the configuration of your mail server, and the Jira environment.

Is this a JEMH bug?

No. The connection between Jira and the mail server is handled by Jira.

Impact

As the FolderClosedException is triggered by the mail server whilst the mail is being retrieved, the mail in question is left in the mailbox, so no emails are lost. As the email could not be retrieved email processing will fail so JEMH will not create a comment/new issue.

Auditing

If using Inbound Auditing, an Audit event will be created however there will be no copy of the original email to be exported or used in a Support ZIP. Using auditing actions that rely on the email being present will result in a popup similar to the following:

Links shown on the popup:

IMAP batch Sizes too low: https://thepluginpeople.atlassian.net/wiki/spaces/JEMH/pages/57606174/Download+performance+of+POP+vs+IMAP

Atlassian background info:
https://confluence.atlassian.com/jirakb/imap-mail-fails-with-folderclosedexception-in-logs-in-jira-server-385319403.html

Logs

A stack trace for the FolderClosedException will be added to the 'atlassian-jira-incoming-mail.log', such as the following example from the linked Atlassian documentation:

2013-07-12 09:52:50,478 ERROR [xxx] QuartzScheduler_Worker-3 ServiceRunner xxxx[xxxxx]: Exception: null
javax.mail.FolderClosedException
	at com.sun.mail.imap.IMAPMessage.getProtocol(IMAPMessage.java:145)
	at com.sun.mail.imap.IMAPMessage.getHeader(IMAPMessage.java:743)
	at com.atlassian.jira.service.services.mail.MailFetcherService$MessageProviderImpl.getAndProcessMail(MailFetcherService.java:257)
	at com.atlassian.jira.service.services.mail.MailFetcherService.runImpl(MailFetcherService.java:356)
	at com.atlassian.jira.service.services.file.AbstractMessageHandlingService.run(AbstractMessageHandlingService.java:257)
	at com.atlassian.jira.service.JiraServiceContainerImpl.run(JiraServiceContainerImpl.java:61)
	at com.atlassian.jira.service.ServiceRunner.execute(ServiceRunner.java:48)
	at org.quartz.core.JobRunShell.run(JobRunShell.java:195)

How to fix

Large Emails

Mail items that are too large and take an excessive time to be retrieved can result in a FolderClosedException, as the mail server interoperates the long retrieval time as an error, and closes the connection. This can be compounded if using the IMAP protocol which has a low default ‘Fetch’ size which makes mail retrial of larger mail items significantly slower. See for more info and steps to increase IMAP ‘Fetch’ size:

Concurrent logins

Mail servers have limits on the number of active connections for mail retrieval. If this limit is exceeded the mail server will close existing mail connections to create new connections. If mail is being retrieved and the connection is closed a FolderClosedException is created. Jira and JEMH work best when using a Mail server with limited mail connections, dedicated to automation.

  • No labels