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

Resource leak for maven plugin used with java eclipse formatter #447

Closed
pzygielo opened this issue Aug 29, 2019 · 4 comments · Fixed by #451
Closed

Resource leak for maven plugin used with java eclipse formatter #447

pzygielo opened this issue Aug 29, 2019 · 4 comments · Fixed by #451
Assignees
Labels

Comments

@pzygielo
Copy link
Contributor

Resource leak for maven plugin used with java eclipse formatter


After check goal of spotless maven plugin (1.24.1) configured to use java > eclipse, temporary directory is left in filesystem.

Seems that below deleteOnExit

private static URL createTemporaryDirectory() {
try {
Path locationPath = Files.createTempDirectory(TEMP_PREFIX);
locationPath.toFile().deleteOnExit();
return locationPath.toUri().toURL();
} catch (IOException e) {
throw new IOError(e);
}

is not enough, as directory is non-empty (contains subdirectory org.eclipse.core.runtime), and as such is not deleted on JVM exit.

@fvgh
Copy link
Member

fvgh commented Aug 29, 2019

@pzygielo
Thank's for the report.
I noticed the problem just recently while implementing #292. I am sure that for the initial versions of the Eclipse formatters the directory was always empty. That's why I never provided a better implementation. Now it seems to be used for file locks. Anyhow, for #292 I need some temporary files and maybe an extension of the implementation. But I also would like to have a look why the .manager\.fileTableLock is created in the first place. It is possible that I can improve some things in the setup of the Eclipse framework.

@fvgh fvgh self-assigned this Aug 29, 2019
@fvgh fvgh added the bug label Aug 29, 2019
@pzygielo
Copy link
Contributor Author

@fvgh - now that you brought hidden files to light (I missed them) - in top temporary dir com_diffplug_spotless_extra_eclipse#... there is also non-empty-with-files .metadata (but I'm sure you already know, or would know on the course of developing change).

@nedtwigg
Copy link
Member

Fixed in 3.24.3

@pzygielo
Copy link
Contributor Author

Fixed in 3.24.3

As I am maven-ing, I upgraded plugin to 1.24.3 (both tags happily refer to the same 0d08d58 😄 anyway), and I confirm - no temporary files left after goal run.
Thank you.

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 a pull request may close this issue.

3 participants