The DataSourceProvider (org.jboss.resteasy.plugins.providers.DataSourceProvider.readDataSource(InputStream, MediaType)) creates a temporary file named "resteasy-provider-datasource ... .tmp" when reading more then 4096 bytes. However, it does not delete the created temporary file itself nor does it provide a facility to do so. This results in a resource leak.
The file is now marked for deletion at the shut down of the JVM. In addition, the file is deleted immediately once the input stream has reached the end.
While this commit improvies the behavior of RESTEasy, it does not completely eliminate the potential of a build-up of temporary files. If a endpoint does not fully consume attachments, then they won't be deleted until the JVM is restarted, which could be a long time.
A potential workaround is to create an EJB timer to delete these files periodically. I wrote such an EJB here:
Currently waiting for the upstream PRs to be merged.
Upstream trunk merged: https://github.com/resteasy/Resteasy/pull/532
@Kyle, could you please create a PR for Branch_2_3 upstream also?
I'll merge this to 2.3.8.SP2-redhat for EAP 6.3.1.
Upgrading RESTEasy to 2.3.8.SP2 solves the problem: https://github.com/jbossas/jboss-eap/pull/1557/files
Hi Weinan, I didn't see this commit in the 2.3.8.SP2 branch. Can you please double check it made the build? My apologies if I was supposed to push the commit myself. Thanks.
(In reply to Kyle Lape from comment #7)
> Hi Weinan, I didn't see this commit in the 2.3.8.SP2 branch. Can you
> please double check it made the build? My apologies if I was supposed to
> push the commit myself. Thanks.
Seems like I forgot to push my changes. I'll ask Dustin to rebuild a -redhat-2 to include it.
Assigned since commit did not make it. Needs respin of redhat-2. Thanks Kyle.
Verified in EAP 6.3.1.CP.CR1.
Kyle Lape <kyle.lape> updated the status of jira RESTEASY-1080 to Resolved
Alessio Soldano <asoldano> updated the status of jira RESTEASY-1080 to Closed