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

Adds a close() method to Compilation results #370

Closed
wants to merge 1 commit into from

Conversation

axiak
Copy link

@axiak axiak commented Sep 24, 2023

This close method will allow file manager to be closed. Otherwise, during a normal test running lots of compilations, the java process might accumulate file descriptors. These open files are generally not a problem, but in the latest MacOS Ventura, the limit of open file descriptors is set to a low number and impossible to increase.

This close method will allow file manager to be closed.
Otherwise, during a normal test running lots of compilations,
the java process might accumulate file descriptors. These
open files are generally not a problem, but in the latest MacOS
Ventura, the limit of open file descriptors is set to a low
number and impossible to increase.
@google-cla
Copy link

google-cla bot commented Sep 24, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@cgdecker cgdecker added the P3 label Oct 2, 2023
@cgdecker
Copy link
Member

cgdecker commented Oct 2, 2023

Is this an issue you've run into in practice with this? I haven't dug into the code much but it seems surprising to me that default file manager would hold open file descriptors given that FileObjects don't seem to represent open files and aren't Closeable themselves.

Either way, I'm not sure this is the approach I'd prefer to take, in part because it would break a lot of code using this that's checked to ensure that Closeable stuff is actually closed. I think ideally I'd want something where Compiler automatically uses and closes a single file manager for each test, which could be done by making it a TestRule (or making a TestRule wrapper for it) and/or giving Compiler a tear-down method that can be called in an @After method. These approaches would avoid the need to manually ensure that close() is called for each Compilation.

@cgdecker
Copy link
Member

cgdecker commented Oct 3, 2023

Actually I think it's a lot simpler than I thought at first. There isn't any need for the file manager to still be open once the compilation has finished, so we can just ensure it's closed in compile.

copybara-service bot pushed a commit that referenced this pull request Oct 3, 2023
…reates.

Fixes #370

According to that PR, it sounds like not closing this can leak file descriptors.

RELNOTES=Fixed `Compiler.compile` to ensure that it doesn't leak file descriptors.
PiperOrigin-RevId: 570407877
@copybara-service copybara-service bot closed this in 972ac1e Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants