[
https://issues.apache.org/jira/browse/CXF-7396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17395564#comment-17395564
]
Andriy Redko commented on CXF-7396:
-----------------------------------
[~dkulp] [~coheigea] guys, I have been looking into this issue for a few days,
it is quite easily reproducible but sadly, there are many cases when it may
manifests. The root of the problem is the way CachedOutputStream manages
references to the input streams created out of temporary file (basically,
CachedOutputStream::getInputStream() + streamList list).
What I found out is that mostly all the time the input stream produced by
CachedOutputStream::getInputStream() is not closed. Consequently, the
CachedOutputStream sees the reference (in the streamList list) and does not
delete the temporary file. It is used, for example, in DocLiteralInInterceptor,
LoggingInInterceptor/WireTapIn and often is hidden deep, like in the
StreamSource. It seems like it could happen at in or/and out phases as well.
I have not found any more or less concise way to fix it, one of the approaches
I am thinking to try out is to:
- store such input streams in the message (in- and out-)
- introduce in- and out- interceptors to close any cached input steams
(unlocking the temporary file removal)
Alternatively, the scheduled cleanup workaround could also help, but I am not
sure it will work all the time, the file could be locked. Any thoughts /
insights / ideas? Thanks!
> CachedOutputStream doesn't delete temp files
> --------------------------------------------
>
> Key: CXF-7396
> URL: https://issues.apache.org/jira/browse/CXF-7396
> Project: CXF
> Issue Type: Bug
> Components: Core
> Affects Versions: 3.1.8
> Reporter: Matthew Roth
> Priority: Minor
> Fix For: NeedMoreInfo
>
> Attachments: HTTP Request.jmx, Screenshot 2020-05-05 at 10.09.43.png,
> Screenshot 2020-05-12 at 12.42.11.png, image-2018-05-29-13-58-03-109.png,
> image-2018-05-29-14-00-16-442.png, image-2018-05-29-14-00-54-215.png
>
>
> In the CachedOutputStream the method maybeDeleteTempFile doesn't always
> delete the temp file when it should.
>
> this.streamList.remove(stream)
> Doesn't remove the stream, occasionally the stream is not in the list causing
> the check of this.streamList().isEmpty() to fail. Also occurs when
> this.streamList() contains multiple streams.
> This seems occur when too many large requests are processed in a row.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)