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

Hanging file handle when stream is used for license bundle normalizer but task is not run #311

Open
Vampire opened this issue May 31, 2024 · 0 comments

Comments

@Vampire
Copy link
Contributor

Vampire commented May 31, 2024

Follow-up to #301.
As you added the stream-variant, but not the URL variant, there is a problem now.
When I configure the licenseReport extension, I already have to open the stream to give it to the constructor of LicenseBundleNormalizer.

Only when the filter is actually used and thus the init() method is called, the stream is consumed and then closed.

But if you invoke a build that does not run through that code-path, the file handle leaks and you for example cannot switch branches where the file needs to be deleted and similar.

URL would have been better for my use-case here as that would not cause the stream to stay open and so for example cause a file handle leak.

(No, I can not use the String constructor instead, as I get the file from classpath and during test execution of my plugin this just happens to be a file on disk. And even if it were from the Jar, I guess the Jar file handle would then leak)

Maybe it would be better to consume the stream directly in the constructor for example.
Or a way to open the stream only on-demand.
Or the URL variant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant