Uploaded image for project: 'Jira Platform Cloud'
  1. Jira Platform Cloud
  2. JRACLOUD-42044

Race condition when multiple mail handlers access the same mail box

XMLWordPrintable

      NOTE: This bug report is for JIRA Cloud. Using JIRA Server? See the corresponding bug report.

      Order of events:

      1. mail handler 1 starts processing a message with attachments; log:
        Issue XX-1234 created
      2. mail handler 2 starts processing the same message and MailFetcherService's getAssociatedIssueKey detects existing issue with the Message-ID; log:
        Deleting message 'foo' without processing in order to avoid creating duplicate issues/comments. This message has already been partially processed, associated issue key: XX-1234
      3. mail handler 1 tries to process attachment; log:
        Exception while adding attachments to XX-1234. Some attachments from the message might be missing. Making a note on the issue.
        java.io.IOException
                at javax.mail.internet.MimePartDataSource.getInputStream(MimePartDataSource.java:113)
                at javax.activation.DataSourceDataContentHandler.getContent(DataHandler.java:797)
                at javax.activation.DataHandler.getContent(DataHandler.java:542)
                at javax.mail.internet.MimeBodyPart.getContent(MimeBodyPart.java:637)
                at com.atlassian.mail.MailUtils.isContentEmpty(MailUtils.java:638)
                at com.atlassian.jira.plugins.mail.handlers.AbstractMessageHandler.attachAttachmentsParts(AbstractMessageHandler.java:912)
                at com.atlassian.jira.plugins.mail.handlers.AbstractMessageHandler.shouldAttach(AbstractMessageHandler.java:801)
                at com.atlassian.jira.plugins.mail.handlers.AbstractMessageHandler$1.handlePart(AbstractMessageHandler.java:603)
                at com.atlassian.jira.plugins.mail.handlers.AbstractMessageHandler.handleMultipart(AbstractMessageHandler.java:700)
                at com.atlassian.jira.plugins.mail.handlers.AbstractMessageHandler.createAttachmentsForMessage(AbstractMessageHandler.java:661)
                at com.atlassian.jira.plugins.mail.handlers.CreateIssueHandler.addCcWatchersAndAttachments(CreateIssueHandler.java:300)
                at com.atlassian.jira.plugins.mail.handlers.CreateIssueHandler.handleMessage(CreateIssueHandler.java:276)
                at com.metainf.jira.plugin.emailissue.handler.CreateAndLinkHandler.handleMessage(CreateAndLinkHandler.java:48)
                at com.metainf.jira.plugin.emailissue.handler.AbstractMailHandler.handleMessage(AbstractMailHandler.java:96)
                at com.metainf.jira.plugin.emailissue.handler.EmailThisIssueMailHandler.handleMessage(EmailThisIssueMailHandler.java:419)
                at com.atlassian.jira.service.services.mail.MailFetcherService$1.process(MailFetcherService.java:438)
                at com.atlassian.jira.service.services.mail.MailFetcherService$MessageProviderImpl.getAndProcessMail(MailFetcherService.java:304)
                at com.atlassian.jira.service.services.mail.MailFetcherService.runImpl(MailFetcherService.java:426)
                at com.atlassian.jira.service.services.file.AbstractMessageHandlingService.run(AbstractMessageHandlingService.java:263)
                at com.atlassian.jira.service.JiraServiceContainerImpl.run(JiraServiceContainerImpl.java:66)
                at com.atlassian.jira.service.ServiceRunner.runService(ServiceRunner.java:75)
                at com.atlassian.jira.service.ServiceRunner.runServiceId(ServiceRunner.java:53)
                at com.atlassian.jira.service.ServiceRunner.runJob(ServiceRunner.java:36)
                at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:135)
                at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:101)
                at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:80)
                at com.atlassian.scheduler.quartz1.Quartz1Job.execute(Quartz1Job.java:32)
                at org.quartz.core.JobRunShell.run(JobRunShell.java:223)
                at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
        

        and

        javax.mail.MessageRemovedException
                at com.sun.mail.imap.IMAPMessage.checkExpunged(IMAPMessage.java:205)
                at com.sun.mail.imap.IMAPMessage.getFrom(IMAPMessage.java:236)
                at com.metainf.jira.plugin.emailissue.handler.EmailThisIssueMailHandler.saveSenderInField(EmailThisIssueMailHandler.java:622)
                at com.metainf.jira.plugin.emailissue.handler.EmailThisIssueMailHandler.access$100(EmailThisIssueMailHandler.java:59)
                at com.metainf.jira.plugin.emailissue.handler.EmailThisIssueMailHandler$1.createComment(EmailThisIssueMailHandler.java:160)
                at com.metainf.jira.plugin.emailissue.handler.IssueSupportingMessageHandlerContext.createComment(IssueSupportingMessageHandlerContext.java:39)
                at com.metainf.jira.plugin.emailissue.handler.IssueSupportingMessageHandlerContext.createComment(IssueSupportingMessageHandlerContext.java:39)
                at com.atlassian.jira.plugins.mail.handlers.AbstractMessageHandler.addCommentIndicatingAttachmentFailureAndMarkForDeletion(AbstractMessageHandler.java:865)
                at com.atlassian.jira.plugins.mail.handlers.CreateIssueHandler.addCcWatchersAndAttachments(CreateIssueHandler.java:313)
                at com.atlassian.jira.plugins.mail.handlers.CreateIssueHandler.handleMessage(CreateIssueHandler.java:276)
                at com.metainf.jira.plugin.emailissue.handler.CreateAndLinkHandler.handleMessage(CreateAndLinkHandler.java:48)
                at com.metainf.jira.plugin.emailissue.handler.AbstractMailHandler.handleMessage(AbstractMailHandler.java:96)
                at com.metainf.jira.plugin.emailissue.handler.EmailThisIssueMailHandler.handleMessage(EmailThisIssueMailHandler.java:419)
                at com.atlassian.jira.service.services.mail.MailFetcherService$1.process(MailFetcherService.java:438)
                at com.atlassian.jira.service.services.mail.MailFetcherService$MessageProviderImpl.getAndProcessMail(MailFetcherService.java:304)
                at com.atlassian.jira.service.services.mail.MailFetcherService.runImpl(MailFetcherService.java:426)
                at com.atlassian.jira.service.services.file.AbstractMessageHandlingService.run(AbstractMessageHandlingService.java:263)
                at com.atlassian.jira.service.JiraServiceContainerImpl.run(JiraServiceContainerImpl.java:66)
                at com.atlassian.jira.service.ServiceRunner.runService(ServiceRunner.java:75)
                at com.atlassian.jira.service.ServiceRunner.runServiceId(ServiceRunner.java:53)
                at com.atlassian.jira.service.ServiceRunner.runJob(ServiceRunner.java:36)
                at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:135)
                at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:101)
                at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:80)
                at com.atlassian.scheduler.quartz1.Quartz1Job.execute(Quartz1Job.java:32)
                at org.quartz.core.JobRunShell.run(JobRunShell.java:223)
                at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
        

              Unassigned Unassigned
              9da142218f90 Jaakko Linnosaari
              Votes:
              1 Vote for this issue
              Watchers:
              17 Start watching this issue

                Created:
                Updated:
                Resolved: