IMAP mail fails with FolderClosedException in logs in Jira server
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles 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
Symptoms
The following stack trace appears in the atlassian-jira-incoming-mail.log:
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)
or
2013-07-12 13:24:28,875 INFO [xxxx] QuartzScheduler_Worker-3 ServiceRunner xxxx[xxxxx]: Cannot handle message as the recipient(s) (xxx) do not match the catch email xxx
Cause
The problem can be caused by the following circumstances:
- In mail server having a limit of emails to be sent by each person daily and the quota was being exceeded.
- JIRA is trying to scan/read but has too many emails which takes a considerable amount of time.
- There are limits set by the mail server that only certain amount of mails can be read by JIRA on a particular time
- There is corrupted mail blocking JIRA from continuing to scan/read other emails
- If catch email address is an alias email (such as Gmail).
Resolution
Identify and remove the mail conditions such as:
- Remove the mails to archive or move them to a different folder/mailbox from the one that JIRA is trying to scan through.
- Increase the timed out value by referring to the resolution in this KB article
- If using Gmail and an alias of an email address, please try to test with the original (non-alias'd) mailbox and see if it works or not.