-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
8308116: jdk.test.lib.compiler.InMemoryJavaCompiler.compile does not close files #14001
Conversation
👋 Welcome back aboldtch! A progress list of the required criteria for merging this PR into |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are few nits inline.
Also, please update copyright years.
return CloseableCompilationTask.createTask(null, new FileManagerWrapper(file, moduleOverride), null, opts, null, Arrays.asList(file)); | ||
} | ||
|
||
private static class CloseableCompilationTask implements Closeable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make a sense to implement Callable as well? Just to make semantic clearer. (It is just suggestion.)
return new CloseableCompilationTask(task, fileManager); | ||
} | ||
|
||
public void close() throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add tag Override.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might it be better to wrap IOException into RuntimeException here and don't have any 'throws' but it is up to you.
@xmas92 This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 119 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
Got the suggestion to close the fileManager directly. It require some extra refactoring. But does not change the class hierarchy so no test need to be changed. Creating a cleaner patch. There are some parts that could be extracted into helper methods, but the compile method seems small enough to not require this. And it is harder to keep such a refactoring clean without introducing changes to the class hierarchy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable.
Thanks for the reviews |
Going to push as commit e9320f3.
Your commit was automatically rebased without conflicts. |
jdk.test.lib.compiler.InMemoryJavaCompiler.compile(String className, CharSequence sourceCode, String... options) creates a JavaFileManager but fails to close it after the CompilationTask is completed, leaving the file descriptors open until reference processing kicks in.
Graph below shows number of open file descriptors before and after this patch for a program which compiles dummy classes in a loop.
Testing: GHA and Oracle CI tier1-3. Tests using jdk.test.lib.compiler.InMemoryJavaCompiler also tested locally.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/14001/head:pull/14001
$ git checkout pull/14001
Update a local copy of the PR:
$ git checkout pull/14001
$ git pull https://git.openjdk.org/jdk.git pull/14001/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 14001
View PR using the GUI difftool:
$ git pr show -t 14001
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/14001.diff
Webrev
Link to Webrev Comment