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

[Service Desk Mail Handler] - Mails with attachments of size bigger than 10 MB fail to be added as comments of existing requests

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Low Low
    • 4.13.3, 4.15.0
    • 4.14.0, 4.13.1
    • Email - Incoming
    • None

      Issue summary

      If an incoming mail is used to add a comment to an existing ticket, this mail fails to be processed by the Service Desk Mail Handler if it has an attachment of size bigger than 10 MB with the error:

      Unexpected error while running action as user...
      

      Steps to replicate

      • Install Jira 8.13.0 with JSD 4.13.0
      • Create a new Service Desk project
      • Configure a mail handler in the JSD project in Project Settings > Email Requests
      • Create a new request in the JSD project via the customer portal
      • Now, send a new email to the JSD Mail Handler by making sure:
        • To include the issue key of the request created earlier in the subject (so that a new comment can be added to the existing request)
        • That the sender of this email is the same as the reporter of the request created earlier (so that this user has the right to add a comment to this request)
        • To include an attachment of size greater than 10 MB
      • Wait for about 5 minutes for the Mail Handler to process this email (due to the large size of the email)

      Actual Results

      • Go to the JSD Email Request Audit Log, and observe that the mail failed to be processed with the following error:
      • Check the Jira incoming mail logs, and observe the following error:
        2020-11-26 11:06:18,638+0100 ERROR [] Caesium-1-3 anonymous     Exception when MailHandlerWorker handles message: 
        java.lang.RuntimeException: Unexpected error while running action as user 'julien'
        	at com.atlassian.pocketknife.internal.util.runner.AuthenticationContextUtilImpl.runAs(AuthenticationContextUtilImpl.java:57) [?:?]
        	at com.atlassian.servicedesk.internal.feature.emailchannel.IncomingEmailServiceImpl.inEmailContext(IncomingEmailServiceImpl.java:504) [?:?]
        	at com.atlassian.servicedesk.internal.feature.emailchannel.IncomingEmailServiceImpl.lambda$doCreateNewOrCommentOnIssueWithMailChannel$15(IncomingEmailServiceImpl.java:185) [?:?]
        	...
        
        Caused by: java.lang.IllegalArgumentException: Cannot format given Object as a Number
        	at java.text.NumberFormat.format(NumberFormat.java:248) [?:1.8.0_121]
        	at java.text.Format.format(Format.java:157) [?:1.8.0_121]
        	at java.text.MessageFormat.subformat(MessageFormat.java:1262) [?:1.8.0_121]
        	at java.text.MessageFormat.format(MessageFormat.java:865) [?:1.8.0_121]
        	at java.text.Format.format(Format.java:157) [?:1.8.0_121]
        	at com.atlassian.jira.i18n.BackingI18n.formatI18nMsg(BackingI18n.java:251) [classes/:?]
        	at com.atlassian.jira.i18n.BackingI18n.getText(BackingI18n.java:159) [classes/:?]
        	at com.atlassian.servicedesk.internal.comment.InternalServiceDeskCommentErrors.buildDisplayedAttachmentBlockWithParam(InternalServiceDeskCommentErrors.java:167) [?:?]
        	at com.atlassian.servicedesk.internal.comment.InternalServiceDeskCommentErrors.getAttachmentFailedMessages(InternalServiceDeskCommentErrors.java:144) [?:?]
        	at com.atlassian.servicedesk.internal.comment.AttachmentValidatorImpl.validateMailAttachmentsToAdd(AttachmentValidatorImpl.java:233) [?:?]
        

      Expected results

      A comment should be added

      • with the attachment if the attachment size is less than 10MB
      • without the attachment if the attachment size is more than 10MB

      Note

      The error is not replicated when sending an email to create a new issue (instead of sending an email to add a comment to an existing issue). In such case, the request is successfully created, but without the attachment:

      Environment

      Jira 8.13.0
      JSD 4.13.0

      Workaround

      The workaround consists in increasing the attachment size limit in the file <JIRA_HOME>/jira-config.properties, so that the mail handler can accept attachments of size bigger than the default coded limit 10MB.
      Note that the unit is in bytes, therefore, to set the limit to 20MB for example, the value to be set is 20971520.

      Detailed steps below to change the limit to 20MB for example:

      • Edit the file <JIRA_HOME>/jira-config.properties as per this kb by adding the following parameter:
        webwork.multipart.maxSize = 20971520
        
      • Re-start Jira

        1. ErrorReproducedLocally.png
          42 kB
          Julien Rey
        2. EmailSentToCreateNewIssue.png
          164 kB
          Julien Rey

            [JSDSERVER-7069] [Service Desk Mail Handler] - Mails with attachments of size bigger than 10 MB fail to be added as comments of existing requests

            Rodrigo Martinez made changes -
            Remote Link Original: This issue links to "JSDS-7804 (Bulldog)" [ 517741 ] New: This issue links to "JSMDC-7804 (JIRA Server (Bulldog))" [ 517741 ]
            Sylwia Mikołajczuk made changes -
            Resolution New: Fixed [ 1 ]
            Status Original: Waiting for Release [ 12075 ] New: Closed [ 6 ]
            Craig Shannon made changes -
            Status Original: In Progress [ 3 ] New: Waiting for Release [ 12075 ]
            Craig Shannon made changes -
            Affects Version/s New: 4.14.0 [ 92890 ]
            Craig Shannon made changes -
            Fix Version/s New: 4.13.3 [ 93597 ]
            Fix Version/s New: 4.15.0 [ 93602 ]
            Craig Shannon made changes -
            Status Original: Short Term Backlog [ 12074 ] New: In Progress [ 3 ]
            Craig Shannon made changes -
            Status Original: Gathering Impact [ 12072 ] New: Short Term Backlog [ 12074 ]
            Craig Shannon made changes -
            Status Original: Needs Triage [ 10030 ] New: Gathering Impact [ 12072 ]
            Craig Shannon made changes -
            Remote Link New: This issue links to "JSDS-7804 (Bulldog)" [ 517741 ]
            Bugfix Automation Bot made changes -
            Support reference count New: 1

              Unassigned Unassigned
              jrey Julien Rey
              Affected customers:
              0 This affects my team
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: