[
https://issues.apache.org/jira/browse/CXF-7396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17387248#comment-17387248
]
Grégory commented on CXF-7396:
------------------------------
As workaround I have scheduled in the application this method wo regularly
delete the unused temps:
{code:java}
public void cleanUpCxfTemp() throws IOException {
final File tempDir = FileUtils.getDefaultTempDir();
final File[] files = tempDir.listFiles();
if (ArrayUtils.isEmpty(files)) {
return;
}
final Instant thirtySecondsBeforeNow = Instant.now().minus(30,
ChronoUnit.SECONDS);
for (File file : files) {
final FileTime lastModifiedTime =
Files.getLastModifiedTime(file.toPath());
// Only delete temp files not actually used
if (lastModifiedTime.toInstant().isBefore(thirtySecondsBeforeNow)) {
FileUtils.delete(file);
}
}
}
{code}
> 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)