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

Message IDs longer than 255 characters can cause email loop and multiple issues created from the same incoming email

    XMLWordPrintable

Details

    Description

      Summary

      After an email is sent to an inbox (or a folder) read by an incoming email handler in Jira Cloud, in some situations, this email may have a Message-ID longer than 255 characters. In this case, Jira will create a ticket for it but fail when adding a reference to this issue in table 'notification instance'.

      Since it fails, it won't archive the message or mark it as read, processing it again, having the same length issue and creating multiple issues until the message is finally removed from the inbox manually. This may cause multiple issues for the same email to be processed over and over again.

      The Message-ID should be limited by the line limit defined in RFC-2822 of 998 characters (way more than 255), so this is a limit to consider.

      Steps to Reproduce

      1. Have a mailbox and an incoming handler reading for it
      2. Send a message with Message-ID longer than 255 characters

      Expected Results

      Email is processed correctly.

      Actual Results

      Issue or comment is created, but it fails to add an entry to 'notificationinstance', processing the email several times. This error appears:

      com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:NotificationInstance][messageid,<long Message ID here>][source,99999999][type,ISSUE_CREATED_FROM_EMAIL][email,email@domain.com] (SQL Exception while executing the following:INSERT INTO public.notificationinstance (notificationtype, SOURCE, emailaddress, MESSAGEID) VALUES (?, ?, ?, ?) (ERROR: value too long for type character varying(255)))
       at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:312)
       at com.atlassian.jira.mail.MailThreadManagerImpl.storeIncomingMessageId(MailThreadManagerImpl.java:50)
       at com.atlassian.jira.plugins.mail.handlers.AbstractMessageHandler.recordIncomingMessageId(AbstractMessageHandler.java:1524)
       at com.atlassian.jira.plugins.mail.handlers.CreateIssueHandler.addCcWatchersAndAttachments(CreateIssueHandler.java:265)
       at com.atlassian.jira.plugins.mail.handlers.CreateIssueHandler.handleAcceptedMessage(CreateIssueHandler.java:248)
       at com.atlassian.jira.plugins.mail.handlers.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:401)
       at com.atlassian.jira.plugins.mail.handlers.CreateOrCommentHandler.handleAcceptedMessage(CreateOrCommentHandler.java:109)
       at com.atlassian.jira.plugins.mail.handlers.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:401)
       at com.atlassian.jira.service.services.mail.SingleMessageProcessorImpl.process(SingleMessageProcessorImpl.java:46)
      ...
       at java.lang.Thread.run(Thread.java:748) 
      Caused by: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:NotificationInstance][messageid,<long Message ID here>][source,99999999][type,ISSUE_CREATED_FROM_EMAIL][email,email@domain.com] (SQL Exception while executing the following:INSERT INTO public.notificationinstance (notificationtype, SOURCE, emailaddress, MESSAGEID) VALUES (?, ?, ?, ?) (ERROR: value too long for type character varying(255)))
       at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:219)
      

      Workaround

      If the issue was already processed, remove it from inbox or any folder that is read by the handler.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jsilveira Jaime S
              Votes:
              2 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: