Uploaded image for project: 'Jira Service Management Data Center'
  1. Jira Service Management Data Center
  2. JSDSERVER-6884

Some incoming mails containing attachment failed to be processed

    XMLWordPrintable

Details

    Description

      Issue Summary

      In some cases, if an incoming mail used to reply to an existing ticket contains attachments which names match the names of attachments that are already in the ticket, the mail will fail to be processed.

      Steps to Reproduce

      The exact steps to reproduce are not clear yet as we haven't been able to reproduce it in our environment. However, from what we observed, the issue seems to happen:

      • when the existing ticket was created with attachment before an upgrade to JSD 4.8.0 (Jira 8.8.0)
      • when the reply to this ticket (containing attachments of same name) was sent after the upgrade to JSD 4.8.0 (Jira 8.8.0)

      Expected Results

      The email should be processed a new comment should be added to the ticket, along with the attachments.

      Actual Results

      The email fails to be processed, and the following error will be thrown in the Jira logs:

      2020-06-05 11:33:06,311+0300 Caesium-1-3 ERROR XXX [c.a.p.i.util.runner.AuthenticationContextUtilImpl] Unexpected error while running action as user 'XXX'
      java.lang.IllegalStateException: Duplicate key com.atlassian.jira.issue.attachment.Attachment@ffffff2a
      at java.util.stream.Collectors.lambda$throwingMerger$0(Collectors.java:133)
      at java.util.HashMap.merge(HashMap.java:1254)
      at java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1320)
      at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
      at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
      at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
      at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
      at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
      at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
      at com.atlassian.servicedesk.internal.comment.InternalServiceDeskCommentServiceImpl.getOriginalAttachments(InternalServiceDeskCommentServiceImpl.java:500)
      

      or:

      2020-04-02 23:36:53,401+0200 Caesium-1-2 ERROR thomas.soupart@exxoss.com     [c.a.p.i.util.runner.AuthenticationContextUtilImpl] Unexpected error while running action as user 'user'
      java.lang.IllegalStateException: Duplicate key image001.png (attempted merging values com.atlassian.jira.issue.attachment.Attachment@ffffff2a and com.atlassian.jira.issue.attachment.Attachment@fffff955)
      	at java.base/java.util.stream.Collectors.duplicateKeyException(Collectors.java:133)
      

      Workaround

      Workaround 1

      Remove all the images imageXXX.png directly from the ticket created before the Service Desk upgrade to 4.8.0. By doing this, new emails sent to these tickets that contain the same attachments imageXXX.png should be added successfully.

      Workaround 2

      When replying to an email to add a comment to an existing ticket, make sure that this email does not contain signature image (remove any image with file names such as imageXXX.png.

      Attachments

        Issue Links

          Activity

            People

              ashubovych moofoo (Inactive)
              jrey Julien Rey
              Votes:
              2 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Backbone Issue Sync