Temporary file created by CachedOutputStream is not deleted after exchange is
completed
---------------------------------------------------------------------------------------
Key: CAMEL-3997
URL: https://issues.apache.org/jira/browse/CAMEL-3997
Project: Camel
Issue Type: Bug
Reporter: Ashwin Karpe
There seems to be an issue related to tmp file created by CachedOutputStream.
My issue:
1. send a SOAP request to CXF consumer with a attachment whose size is
larger than 64K
2. In my bundle, I will get the attachment by following code:
from("cxf:bean:foobarEndpoint")
// foobarEndpoint is defined in bundle-context.xml
// <cxf:cxfEndpoint id="foobarEndpoint"
// serviceClass="com.mycompany.FooBar">
// </cxf:cxfEndpoint>
.doTry()
.to("log:myInboundLogRoute -> Start")
.process(retrieveAttachment())
.doCatch(Exception.class)
.doFinally()
//.process(removeAttachment())
.end()
.to("log:myInboundLogRoute -> End");
private Processor retrieveAttachment() {
return new Processor() {
public void process(Exchange exchange) throws Exception {
if (LOGGER.isDebugEnabled())
LOGGER.debug("retrieveAttachment start");
// handle attachments
java.util.Collection<org.apache.cxf.message.Attachment> atts =
PhaseInterceptorChain
.getCurrentMessage().getAttachments();
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("retrieveAttachment done");
}
}
};
}
3. After the exchange is completed, there is a tmp file left under
/tmp/cxf-tmp-***/ directory, which has the same size of attachment.
Note:
a. If the size of attachment < 64k, there will be no tmp file left.
b. If in my bundle, I didn't invoke retrieveAttachment(), there will be
no tmp file left.
It seems that CachedOutputStream is not closed by CXF properly after the
exchange is completed. I got some description from CachedOutputStream.java.
037 /**
038 * This output stream will store the content into a File if the stream
context size is exceed the
039 * THRESHOLD which's default value is 64K. The temp file will store in
the temp directory, you
040 * can configure it by setting the TEMP_DIR property. If you don't set
the TEMP_DIR property,
041 * it will choose the directory which is set by the system property of
"java.io.tmpdir".
042 * You can get a cached input stream of this stream. The temp file which
is created with this
043 * output stream will be deleted when you close this output stream or
the all cached
044 * fileInputStream is closed after the exchange is completed.
045 */
This issues is happening both in both fuse4.2 and fuse4.3.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira