Service Management Email Request fails to process some attachments

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server と Data Center のみ - この記事は、サーバーおよびデータセンター プラットフォームのアトラシアン製品にのみ適用されます。

問題

Service Management fails to process some email messages that contains multiple/larger attachments with the following error thrown in atlassian-jira.log

2018-04-09 16:45:42,238 Caesium-2-3 WARN sender@sender.com     [c.a.s.i.feature.emailchannel.IncomingEmailParser] Error processing email message
com.sun.mail.util.DecodingException: BASE64Decoder: Error in encoded stream: needed at least 2 valid base64 characters, but only got 0 before padding character (=), the 10 most recent characters were: "U5ErkJggg="
	at com.sun.mail.util.BASE64DecoderStream.decode(BASE64DecoderStream.java:271)
	at com.sun.mail.util.BASE64DecoderStream.read(BASE64DecoderStream.java:144)
	at java.io.FilterInputStream.read(FilterInputStream.java:107)
	at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1383)
	at org.apache.commons.io.IOUtils.copy(IOUtils.java:1357)
	at org.apache.commons.io.IOUtils.toByteArray(IOUtils.java:361)
	at com.atlassian.mail.MailUtils.buildAttachment(MailUtils.java:327)
	at com.atlassian.mail.MailUtils.addAttachments(MailUtils.java:302)
	at com.atlassian.mail.MailUtils.internalGetAttachments(MailUtils.java:289)
	at com.atlassian.mail.MailUtils.getAttachments(MailUtils.java:281)
	at com.atlassian.servicedesk.squalor.email.ServiceDeskMailUtils.getServiceDeskAttachments(ServiceDeskMailUtils.java:162)
	at com.atlassian.servicedesk.internal.feature.emailchannel.IncomingEmailParser.parse(IncomingEmailParser.java:66)
	at com.atlassian.servicedesk.internal.feature.emailchannel.IncomingEmailManagerImpl.lambda$createIssueInJiraContext$19(IncomingEmailManagerImpl.java:539)
	at com.atlassian.pocketknife.step.EitherStep1.lambda$then$0(EitherStep1.java:23)
	at io.atlassian.fugue.Either$RightProjection.flatMap(Either.java:886)
	at io.atlassian.fugue.Either.flatMap(Either.java:231)
	at com.atlassian.pocketknife.step.EitherStep1.then(EitherStep1.java:23)
	at com.atlassian.servicedesk.internal.feature.emailchannel.IncomingEmailManagerImpl.createIssueInJiraContext(IncomingEmailManagerImpl.java:539)
	at com.atlassian.servicedesk.internal.feature.emailchannel.IncomingEmailManagerImpl.createIssueFromEmail(IncomingEmailManagerImpl.java:219)
	at com.atlassian.servicedesk.internal.feature.emailchannel.IncomingEmailServiceImpl.createNewIssueWithRequestType(IncomingEmailServiceImpl.java:265)
	at com.atlassian.servicedesk.internal.feature.emailchannel.IncomingEmailServiceImpl.lambda$createNewIssueWithMailChannel$25(IncomingEmailServiceImpl.java:247)
	at io.atlassian.fugue.Either$RightProjection.flatMap(Either.java:886)

診断

環境

  • Observed on Service Management 3.9.3 with QQMail (other versions/mail servers may be affected)
  • Email Request is setup using IMAP protocol

診断ステップ

  • Verify whether the attachment is base64 encoded attachment is indeed corrupted. Obtain the original email message, then identify attachment with the string shown in the error message, ie: in the example log above
    "U5ErkJggg="
  • Copy the base64 encoded attachment data and try decoding it with any base64 decoder. If successful, the problem is not due incorrect base64 format in the original email itself.

原因

Some mail servers do not work well with javamail's IMAP partial fetch (reason is unknown), as a result the email may only be fetched partially by Service Management which causes the base64 decoding error.

回避策

Disable partial fetch by setting the JVM flags as per Setting Properties and Options on Startup

For IMAP protocol:

-Dmail.imap.partialfetch=false

For IMAP SECURE protocol:

-Dmail.imaps.partialfetch=false
最終更新日 2020 年 11 月 23 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.