[JIRA] (JENKINS-53305) javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;

942 views
Skip to first unread message

lystor@gmail.com (JIRA)

unread,
Aug 29, 2018, 3:59:01 AM8/29/18
to jenkinsc...@googlegroups.com
Mykola Ulianytskyi created an issue
 
Jenkins / Bug JENKINS-53305
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;
Issue Type: Bug Bug
Assignee: Unassigned
Components: mailer-plugin
Created: 2018-08-29 07:58
Environment: Docker image jenkins/jenkins:2.121.2
Priority: Critical Critical
Reporter: Mykola Ulianytskyi

Hello

We use docker image jenkins/jenkins:2.121.2 and sometimes pipelines in Jenkins fails with next exception:

 

{{javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed; }}
{{ boundary="----=_Part_232_854096954.1535491539067"}}
{{ at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:896)}}
{{ at javax.activation.DataHandler.writeTo(DataHandler.java:317)}}
{{ at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1476)}}
{{ at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1772)}}
{{ at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1099)}}
Caused: javax.mail.MessagingException: IOException while sending message;
{{ nested exception is:}}
{{ javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed; }}
{{ boundary="----=_Part_232_854096954.1535491539067"}}
{{ at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1141)}}
{{ at javax.mail.Transport.send0(Transport.java:195)}}
{{ at javax.mail.Transport.send(Transport.java:124)}}
{{ at org.jenkinsci.plugins.workflow.steps.MailStep$MailStepExecution.run(MailStep.java:142)}}
{{ at org.jenkinsci.plugins.workflow.steps.MailStep$MailStepExecution.run(MailStep.java:128)}}
{{ at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:50)}}
{{ at hudson.security.ACL.impersonate(ACL.java:290)}}
{{ at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:47)}}
{{ at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)}}
{{ at java.util.concurrent.FutureTask.run(FutureTask.java:266)}}
{{ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)}}
{{ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)}}
{{ at java.lang.Thread.run(Thread.java:748)}}

 

Example of pipeline:

node {
{{ mail(to: "x...@example.com", subject: "test", body: "test")}}
}

 

Settings:

 

Restart of Jenkins temporary solve the issue.

 

Please fix the bug.

Thank you

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

lystor@gmail.com (JIRA)

unread,
Aug 29, 2018, 4:07:01 AM8/29/18
to jenkinsc...@googlegroups.com
Mykola Ulianytskyi updated an issue
Change By: Mykola Ulianytskyi
Hello

We use docker image jenkins/jenkins:
* Jenkins 2.121.2 and sometimes (official Docker image)
* Mailer Plugin 1.21

 

Sometimes
pipelines in Jenkins fails with next exception:

 

{
\ {javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed; }}
{{ mail(to: "x...@example.com", subject: "test", body: "test")}}
{{}}}

 

Settings:
* SMTP server: mail.example.com
* Default user e-mail suffix: @example.com


 

Restart of Jenkins temporary solve the issue.

 

Please fix the bug.

Thank you

lystor@gmail.com (JIRA)

unread,
Aug 29, 2018, 4:07:02 AM8/29/18
to jenkinsc...@googlegroups.com

sarch@cloudbees.com (JIRA)

unread,
Sep 4, 2018, 11:03:02 AM9/4/18
to jenkinsc...@googlegroups.com
Steve Arch commented on Bug JENKINS-53305
 
Re: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;

Mykola Ulianytskyi - we're having the same behaviour on our build platform - maybe we can share some details to diagnose the problem. I'm having trouble re-creating it locally on my dev machine and finding it hard to trace?

Are you running on build agents, or building on the master itself? Was this a fresh install of the docker image or have you got any other plugins installed too? How often do you get the issues?

 

I'm not seeing it locally on a fresh jenkins install, but we see it ~5% of the time on our long-running jobs on our CI system. We run one-shot agents so hard to trace exactly what the infrastructure is that it fails on when it fails to trace the issue

sarch@cloudbees.com (JIRA)

unread,
Sep 4, 2018, 11:03:03 AM9/4/18
to jenkinsc...@googlegroups.com
Steve Arch edited a comment on Bug JENKINS-53305
[~lystor] - we're having the same behaviour on our build platform - maybe we can share some details to diagnose the problem. I'm having trouble re-creating it locally on my dev machine and finding it hard to trace?


Are you running on build agents, or building on the master itself? Was this a fresh install of the docker image or have you got any other plugins installed too? How often do you get the issues?

 

I'm not seeing it locally on a fresh jenkins install, but we see it ~5% of the time on our long-running jobs on our CI system. We run one-shot agents so hard to trace exactly what the infrastructure is that it fails on when it fails to trace the issue . As it's our main CI system, attaching a debugger isn't possible :(

sarch@cloudbees.com (JIRA)

unread,
Sep 5, 2018, 11:48:01 AM9/5/18
to jenkinsc...@googlegroups.com
Steve Arch started work on Bug JENKINS-53305
 
Change By: Steve Arch
Status: Open In Progress

sarch@cloudbees.com (JIRA)

unread,
Sep 5, 2018, 11:48:01 AM9/5/18
to jenkinsc...@googlegroups.com

sarch@cloudbees.com (JIRA)

unread,
Sep 5, 2018, 11:52:04 AM9/5/18
to jenkinsc...@googlegroups.com
Steve Arch commented on Bug JENKINS-53305
 
Re: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;

It seems to be an issue with the context class loader. By running lots of jobs, I could see that the thread's current class loader was `null` when the problem occurred.

I can re-create the issue exactly by running `Thread.currentThread().setContextClassLoader(null);` just before the call to `Transport.send(mimeMessage);`

Still investigating...

sarch@cloudbees.com (JIRA)

unread,
Sep 5, 2018, 11:52:04 AM9/5/18
to jenkinsc...@googlegroups.com
Steve Arch edited a comment on Bug JENKINS-53305

sarch@cloudbees.com (JIRA)

unread,
Sep 10, 2018, 4:43:03 AM9/10/18
to jenkinsc...@googlegroups.com
Steve Arch updated an issue
 
Change By: Steve Arch
Attachment: stacktrace2.txt
Attachment: stacktrace1.txt

sarch@cloudbees.com (JIRA)

unread,
Sep 10, 2018, 4:45:02 AM9/10/18
to jenkinsc...@googlegroups.com
Steve Arch commented on Bug JENKINS-53305
 
Re: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;

I've been trying to track this down, but have run out of time. It definitely seems to be the issue mentioned above that the contextClassLoader is set to null, but where this is getting set to null I don't know. I've traced this back up the stack and all the threads that it's operating on are spawned by the pipeline plugins (when a thread spawns another thread, the contextClassLoader is inherited from the parent). I could see that the threads in the pipeline plugins had the contextClassLoader set to `null` sometimes, but I couldn't track down where in its myriads of threads and threadpools the root of the issue where it was setting the contextClassLoader to null that triggered this issue (there are lots of instances where it does set it to null, but a lot of those are 'valid' given the context. 

Unfortunately, I can only see this issue on our build infrastructure which is hard to debug (attaching a debugger will basically lock up the Jenkins instance) as there is so much going on. Mykola Ulianytskyi - are you able to recreate the issues in a fresh/newly installed instance that I could run locally to get a better handle on what's going on? Remote debugging isn't working for me.

What I was attempting to do was to launch Jenkins with debug flags and attach a debugger to Thread.setContextClassLoader and get the debugger to break if it is setting it no null. As I said, this happened so much it was hard to identify where this was doing it 'wrongly'. Maybe Mykola Ulianytskyi could have some luck tracing it down?

Some possibly useful stack traces I got are attached if they are useful to anyone. I got lots where it was in the sun.net.www.http package, but these seem valid given the comments here and given the fact that that thread is not re-used.

sarch@cloudbees.com (JIRA)

unread,
Sep 10, 2018, 4:47:02 AM9/10/18
to jenkinsc...@googlegroups.com

As a workaround, I have raised https://github.com/jenkinsci/workflow-basic-steps-plugin/pull/69 as a workaround, so you may find a local build of this deployed to your Jenkins instance will be a workaround for the issue (it's not an actual fix). It detects if the contextClassLoader is null before attempting to send the email, and then sets it to the default one in Jenkins.

sarch@cloudbees.com (JIRA)

unread,
Nov 20, 2018, 7:10:01 AM11/20/18
to jenkinsc...@googlegroups.com
Steve Arch stopped work on Bug JENKINS-53305
 
Change By: Steve Arch
Status: In Progress Open

dnusbaum@cloudbees.com (JIRA)

unread,
Nov 29, 2018, 4:31:03 PM11/29/18
to jenkinsc...@googlegroups.com
Devin Nusbaum started work on Bug JENKINS-53305
 
Change By: Devin Nusbaum
Status: Open In Progress

dnusbaum@cloudbees.com (JIRA)

unread,
Nov 29, 2018, 4:31:03 PM11/29/18
to jenkinsc...@googlegroups.com

dnusbaum@cloudbees.com (JIRA)

unread,
Nov 29, 2018, 4:32:01 PM11/29/18
to jenkinsc...@googlegroups.com
Devin Nusbaum commented on Bug JENKINS-53305
 
Re: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;

I filed a PR that would address one potential way this could happen in a slightly more general way than the workflow-basic-steps workaround in https://github.com/jenkinsci/workflow-step-api-plugin/pull/39, but I still do not understand the actual root cause.

dnusbaum@cloudbees.com (JIRA)

unread,
Dec 6, 2018, 2:51:02 PM12/6/18
to jenkinsc...@googlegroups.com

I would be very interested to know if anyone who is experiencing this problem still sees it in after updating to version 2.17 of the Pipeline Step API Plugin, which should be available from the update center in a few hours.

cleclerc@cloudbees.com (JIRA)

unread,
Dec 11, 2018, 1:57:03 PM12/11/18
to jenkinsc...@googlegroups.com
Cyrille Le Clerc updated an issue
 
Change By: Cyrille Le Clerc
Hello
* Jenkins 2.121.2 (official Docker image)
* Mailer Plugin 1.21

 

Sometimes pipelines in Jenkins fails with next exception:

 
{noformat}
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;
boundary="----=_Part_232_854096954.1535491539067"
at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:896)
at javax.activation.DataHandler.writeTo(DataHandler.java:317)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1476)
at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1772)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1099)
Caused: javax.mail.MessagingException: IOException while sending message;
nested exception is:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;
boundary="----=_Part_232_854096954.1535491539067"
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1141)
at javax.mail.Transport.send0(Transport.java:195)
at javax.mail.Transport.send(Transport.java:124)
at org.jenkinsci.plugins.workflow.steps.MailStep$MailStepExecution.run(MailStep.java:142)
at org.jenkinsci.plugins.workflow.steps.MailStep$MailStepExecution.run(MailStep.java:128)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:50)
at hudson.security.ACL.impersonate(ACL.java:290)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
{noformat}
 

Example of pipeline:

{{node {}}
mail(to: "x...@example.com", subject: "test", body: "test")
{{}}}

 

Settings:
* SMTP server: mail.example.com
* Default user e-mail suffix: @example.com

 

Restart of Jenkins temporary solve the issue.

 

Please fix the bug.

Thank you

cleclerc@cloudbees.com (JIRA)

unread,
Dec 11, 2018, 1:57:07 PM12/11/18
to jenkinsc...@googlegroups.com
{ { code}
node { }}
mail(to: "x...@example.com", subject: "test", body: "test")
{{ } }}

{code}  


Settings:
* SMTP server: mail.example.com
* Default user e-mail suffix: @example.com

 

Restart of Jenkins temporary solve the issue.

 

Please fix the bug.

Thank you

cleclerc@cloudbees.com (JIRA)

unread,
Dec 11, 2018, 1:59:02 PM12/11/18
to jenkinsc...@googlegroups.com
Cyrille Le Clerc commented on Bug JENKINS-53305
 
Re: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;

Devin Nusbaum I am seeing the bug at the moment with the Pipeline Step API 2.16. I'll try to bump soon.

francesco.gualazzi@lastminute.com (JIRA)

unread,
Jun 7, 2019, 8:58:04 AM6/7/19
to jenkinsc...@googlegroups.com

A workaround we found with the same LTS version (2.121.3) is to add the MIME types explicitly, like so

import javax.activation.MailcapCommandMap;
import javax.activation.CommandMap;

@NonCPS
def setupMail(){
    MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
    mc.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html");
    mc.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml");
    mc.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain");
    mc.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
    mc.addMailcap("message/rfc822;; x-java-content- handler=com.sun.mail.handlers.message_rfc822");
}

node {
    setupMail()
    mail(   from: 'jen...@co.com', 
            replyTo: 'm...@co.com', 
            to: som...@co.com,
            subject: "Hi there MIME",  
            body: "It Works!")
}

Hope this helps

francesco.gualazzi@lastminute.com (JIRA)

unread,
Jun 7, 2019, 9:01:03 AM6/7/19
to jenkinsc...@googlegroups.com
Francesco Gualazzi edited a comment on Bug JENKINS-53305
A workaround we found with the Mailer plugin v 1.22 but same LTS version (2.121.3) .

A workaround we found
is to add the MIME types explicitly, like so

{code}

import javax.activation.MailcapCommandMap;
import javax.activation.CommandMap;

@NonCPS
def setupMail(){
    MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
    mc.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html");
    mc.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml");
    mc.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain");
    mc.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
    mc.addMailcap("message/rfc822;; x-java-content- handler=com.sun.mail.handlers.message_rfc822");
}

node {
    setupMail()
    mail(   from: 'jen...@co.com',
            replyTo: 'm...@co.com',
            to: som...@co.com,
            subject: "Hi there MIME",  
            body: "It Works!")
}
{code}

Hope this helps :D

carsten.pfeiffer@gebit.de (JIRA)

unread,
Aug 20, 2019, 2:46:02 AM8/20/19
to jenkinsc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages