cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mustafa Sezgin (JIRA)" <>
Subject [jira] Created: (CXF-2706) AttachmentDeserializer/LazyLoading Attachment Collection enters into continuous while loop for input with missing boundary
Date Thu, 11 Mar 2010 00:51:27 GMT
AttachmentDeserializer/LazyLoading Attachment Collection enters into continuous while loop
for input with missing boundary

                 Key: CXF-2706
             Project: CXF
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.2.6, 2.2.5, 2.2.4, 2.2.3, 2.2.2
         Environment: All known platforms to mankind
            Reporter: Mustafa Sezgin

We recently came across an issue in our production environments where we detected http processor
threads that had been alive for over a week chewing up CPU. By inspecting thread dumps we
found that our external API's (JAX-RS) were the problem with CXF being the culprit. All processor
threads had the same stack trace and were all related to POST requests which were multipart

Upon further investigation the cause was identified to be an incorrectly sent multipart input
with a missing end boundary. The result of this was the LazyAttachmentCollection entering
into a continuous loop 'waiting' for more data even though there was none with the client
end point having long gone.

I have put together a test case demonstrating this. I have tried to imitate the CXF code path
as much as possible (AttachmentInInterceptor).  

I consider this to be a fairly serious issue as mistakes like this will likely happen frequently
by developers and it would only take 8 of these requests to consume an 8 core cpu and its
'game over man'...

I aim to have a patch implemented for this as soon as possible when i have some free time
but im hoping you guys might be able get onto it sooner than me as a fix for this would greatly

A sample stack trace from Tomcat is below 

                at java.lang.System.arraycopy(Native Method)
                at org.apache.cxf.attachment.MimeBodyPartInputStream.hasData(
                at org.apache.cxf.attachment.MimeBodyPartInputStream.processBuffer(
                at org.apache.cxf.helpers.IOUtils.copy(
                at org.apache.cxf.helpers.IOUtils.copy(
                at org.apache.cxf.attachment.AttachmentDataSource.<init>(
                at org.apache.cxf.attachment.AttachmentUtil.createAttachment(
                at org.apache.cxf.attachment.AttachmentDeserializer.createAttachment(
                at org.apache.cxf.attachment.AttachmentDeserializer.readNext(
                at org.apache.cxf.attachment.LazyAttachmentCollection.loadAll(
                at org.apache.cxf.attachment.LazyAttachmentCollection.size(
                at org.apache.cxf.jaxrs.ext.MessageContextImpl.createAttachments(
                at org.apache.cxf.jaxrs.ext.MessageContextImpl.get(
                at org.apache.cxf.jaxrs.utils.multipart.AttachmentUtils.getMultipartBody(
                at org.apache.cxf.jaxrs.utils.multipart.AttachmentUtils.getAttachments(
                at org.apache.cxf.jaxrs.provider.MultipartProvider.readFrom(
                at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(
                at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(
                at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(
                at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(
                at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(
                at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(
                - locked <0x00002aaae3f66ac8> (a org.apache.cxf.phase.PhaseInterceptorChain)
                at org.apache.cxf.transport.ChainInitiationObserver.onMessage(
                at org.apache.cxf.transport.servlet.ServletDestination.invoke(
                at org.apache.cxf.transport.servlet.ServletController.invokeDestination(
                at org.apache.cxf.transport.servlet.ServletController.invoke(
                at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(
                at org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(
                at javax.servlet.http.HttpServlet.service(
                at javax.servlet.http.HttpServlet.service(


This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message