[
https://issues.apache.org/jira/browse/CXF-3504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13036126#comment-13036126
]
ext2 commented on CXF-3504:
---------------------------
Yes the patch will leave no temporary file on disk.
But it introduce another problem: the http-connection doesn't closed;
After execute the last-attachment input-stream's close, I can saw a
"ESBTABLISHING" status socket, that indicate the socket cannot be closed;
To understand the problem, let's check some source code of CXF attachment:
class AttachmentDeserializer{
//because the patch just close MIMEPartInputStream, so the
network-inputstream isn't consumed over; then stream.read() will return another
bytes to indicate the "we still have another attachment"(but actually , we
didn't)
public boolean hasNext() throws IOException {
.......
int v = stream.read();
if (v == -1) {
return false;
}
stream.unread(v);
return true;
}
//now because attachments.hasNext() will never return false, so the
network-stream cannot be closed;
public void markClosed(DelegatingInputStream delegatingInputStream){
closedCount++;
if (closedCount == createCount && !attachments.hasNext(false)) {
int x = stream.read();
while (x != -1) {
x = stream.read();
}
stream.close();
closed = true;
}
}
}
> for big attachment, a temporary file is left on disk and keep opend, if the
> application just close the DataSource's inputStream and doesn't consume it;
> --------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CXF-3504
> URL: https://issues.apache.org/jira/browse/CXF-3504
> Project: CXF
> Issue Type: Bug
> Affects Versions: 2.4
> Reporter: ext2
> Assignee: Freeman Fang
> Fix For: 2.4.1, 2.3.5
>
> Attachments: attachment-clean.zip, mtom.wsdl
>
>
> when the client receiving multiple larget attachments from server. here
> "large" means : attachment size is large enough to be saved as temporary file
> on disk;
> for the last attachment, if the user application only close the input stream
> got from DataSource and doesn't consume the input stream at all, a temporary
> file will be left on the disk.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira