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

Using Atlassian Cloud default POP mail Server on another Mail Handler has undesired effects

    XMLWordPrintable

Details

    Description

      Atlassian Cloud has a default 'POP Mail Server' and a default Mail Handler called 'Comments from emails' (Studio Email Handler). They can be edited or deleted but changes will be restored automatically after a JIRA restart.

      Problem:
      When setting a Mail Handler to use the same 'POP Mail Server' with email address jira@instancename.atlassian.net both Handlers (default and new) will compete to get emails at different times and not all emails will result in an issue created or comment added by the Handlers.

      Details:
      The default Mail Handler 'Comments from emails' looks for emails on a different moment that the other Mail handlers (see the times):

      # cat * | grep "MailFetcherService"
      2014-09-30 15:46:15,211 atlassian-scheduler-quartz1.clustered_Worker-3 DEBUG ServiceRunner    MAP handler [atlassian.mail.incoming.mailfetcherservice] MailFetcherService run() method has been called
      2014-09-30 15:46:30,462 atlassian-scheduler-quartz1.clustered_Worker-1 DEBUG ServiceRunner    Comments from emails [atlassian.mail.incoming.mailfetcherservice] MailFetcherService run() method has been called
      2014-09-30 15:47:15,211 atlassian-scheduler-quartz1.clustered_Worker-4 DEBUG ServiceRunner    MAP handler [atlassian.mail.incoming.mailfetcherservice] MailFetcherService run() method has been called
      2014-09-30 15:47:30,485 atlassian-scheduler-quartz1.clustered_Worker-3 DEBUG ServiceRunner    Comments from emails [atlassian.mail.incoming.mailfetcherservice] MailFetcherService run() method has been called
      2014-09-30 15:48:15,212 atlassian-scheduler-quartz1.clustered_Worker-2 DEBUG ServiceRunner    MAP handler [atlassian.mail.incoming.mailfetcherservice] MailFetcherService run() method has been called
      2014-09-30 15:48:30,461 atlassian-scheduler-quartz1.clustered_Worker-4 DEBUG ServiceRunner    Comments from emails [atlassian.mail.incoming.mailfetcherservice] MailFetcherService run() method has been called
      2014-09-30 15:49:15,210 atlassian-scheduler-quartz1.clustered_Worker-1 DEBUG ServiceRunner    MAP handler [atlassian.mail.incoming.mailfetcherservice] MailFetcherService run() method has been called
      2014-09-30 15:49:30,462 atlassian-scheduler-quartz1.clustered_Worker-2 DEBUG ServiceRunner    Comments from emails [atlassian.mail.incoming.mailfetcherservice] MailFetcherService run() method has been called

      So depending on when the email is received, it can be grabbed by one mail handler or the other and it will be deleted after is processed. In this example we see several emails being deleted by different handlers:

      # cat * | grep "Closing store" -B1 | grep deleted
      2014-09-30 14:19:15,912 atlassian-scheduler-quartz1.clustered_Worker-3 DEBUG ServiceRunner    MAP handler [com.atlassian.mail.incoming] S: +OK Logging out, messages deleted.
      2014-09-30 14:27:15,717 atlassian-scheduler-quartz1.clustered_Worker-2 DEBUG ServiceRunner    MAP handler [com.atlassian.mail.incoming] S: +OK Logging out, messages deleted.
      2014-09-30 14:34:15,745 atlassian-scheduler-quartz1.clustered_Worker-4 DEBUG ServiceRunner    MAP handler [com.atlassian.mail.incoming] S: +OK Logging out, messages deleted.
      2014-09-30 14:46:30,695 atlassian-scheduler-quartz1.clustered_Worker-2 DEBUG ServiceRunner    Comments from emails [com.atlassian.mail.incoming] S: +OK Logging out, messages deleted.
      2014-09-30 15:02:30,673 atlassian-scheduler-quartz1.clustered_Worker-2 DEBUG ServiceRunner    Comments from emails [com.atlassian.mail.incoming] S: +OK Logging out, messages deleted.
      2014-09-30 15:03:15,659 atlassian-scheduler-quartz1.clustered_Worker-1 DEBUG ServiceRunner    MAP handler [com.atlassian.mail.incoming] S: +OK Logging out, messages deleted.
      

      Scenarios:
      A) If emails subject have an Issue Key and are from a JIRA user, then a comment will always be added.
      B) If emails subject have an Issue Key and are NOT from a JIRA user, then a comment is only added if the New Handler processes the email.
      C) If emails subject don't have an Issue key, then an Issue is created only if the New Handler processes the email.

      So what happens in (B) is that the default mail handler 'Comments from emails' may remove the email because there is no action to do (because the user is not a valid JIRA user and there is no Default Reporter set). Then afterwards the 'MAP handler' finds an empty email box and the email was lost.

      Steps to reproduce:

      1. Create a Mail Handler with:
        • Server: 'POP Mail Server'
        • Handler: 'Create a new issue or add a comment to an existing issue' on a project.
        • Default Reporter: any user with create issue, add comment and add attachment permissions to the project selected.
      2. enable "The Incoming Mail debug log" from <instance>/secure/admin/ViewLogging.jspa
      3. send messages at different times while tailing the logs with "grep deleted" to see the different mail handlers responding to the emails

      Workaround:
      Set a different Server with a different email address and use that server on new Mail Handlers (and if used in multiple handlers, set the 'Catch Email Address' on all of them to avoid the same situation)
      Additionaly, the Project Email Address can be changed to match the POP Server address in the Project Administration/Notifications section

      Attachments

        Issue Links

          Activity

            People

              ohookins@atlassian.com Oliver Hookins (Inactive)
              mfernandezbadii Mauro Badii
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: