Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8250774: jextract does not close all files #271



Copy link

@mcimadamore mcimadamore commented Jul 29, 2020

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.


  • Change must not contain extraneous whitespace
  • Change must be properly reviewed



  • Athijegannathan Sundararajan (sundar - Committer)


$ git fetch pull/271/head:pull/271
$ git checkout pull/271

Copy link

@bridgekeeper bridgekeeper bot commented Jul 29, 2020

👋 Welcome back mcimadamore! A progress list of the required criteria for merging this PR into foreign-jextract will be added to the body of your pull request.

@openjdk openjdk bot added the rfr label Jul 29, 2020
Copy link

@openjdk openjdk bot commented Jul 29, 2020

@mcimadamore This change now passes all automated pre-integration checks, type /integrate in a new comment to proceed. After integration, the commit message will be:

8250774: jextract does not close all files

Reviewed-by: sundar
  • If you would like to add a summary, use the /summary command.
  • To credit additional contributors, use the /contributor command.
  • To add additional solved issues, use the /issue command.

There are currently no new commits on the foreign-jextract branch since the last update of the source branch of this PR. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you would like to avoid potential automatic rebasing, specify the current head hash when integrating, like this: /integrate 623ef58142b23a295f77a9b3e75b84c7c72045e8.

➡️ To integrate this PR with the above commit message to the foreign-jextract branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Jul 29, 2020
Copy link
Collaborator Author

@mcimadamore mcimadamore commented Jul 29, 2020


@openjdk openjdk bot closed this Jul 29, 2020
@openjdk openjdk bot added integrated and removed ready rfr labels Jul 29, 2020
Copy link

@openjdk openjdk bot commented Jul 29, 2020

Pushed as commit c1a2a00.

Copy link

@mlbridge mlbridge bot commented Jul 29, 2020


@mcimadamore mcimadamore deleted the filetest-fix branch Nov 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants