[foreign-jextract] Integrated: 8250774: jextract does not close all files
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Wed Jul 29 14:49:14 UTC 2020
On Wed, 29 Jul 2020 11:28:56 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> Since when we switched to the new jextract implementation, we have observed spurious test failures on windows, caused
> by the fact that some of the files generated by jextract test runs are left opened and, therefore, cannot be deleted.
> I have investigated this matter further (on Linux), by debugging one of the failing test (UnionDeclTest) and using
> `lsof` to keep track of the list of opened file descriptors associated with the test process. What I discovered was
> that calling `Writer::writeClassFiles` was causing the leak; upon closer inspection, I found this dubious code:
> Files.write(fullPath, entry.openInputStream().readAllBytes());
> In other words, the input stream was not being closed. As per javadoc, `readAllBytes` does _not_ close the stream when
> done. Fixing this (by using a try with resources) seems to get rid of the issues, and the leaked descriptors are no
> longer visible using `lsof`.
This pull request has now been integrated.
Changeset: c1a2a00d
Author: Maurizio Cimadamore <mcimadamore at openjdk.org>
URL: https://git.openjdk.java.net/panama-foreign/commit/c1a2a00d
Stats: 4 lines in 1 file changed: 0 ins; 3 del; 1 mod
8250774: jextract does not close all files
Reviewed-by: sundar
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/271
More information about the panama-dev
mailing list