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

BndtoolsJAREditorTempFiles keeps growing: 1 jar file creates two folders, but only one is removed on closing #6340

Open
chrisrueger opened this issue Oct 28, 2024 · 2 comments
Assignees

Comments

@chrisrueger
Copy link
Contributor

chrisrueger commented Oct 28, 2024

Problem

I noticed the following behavior recently in 7.1.0.SNAPSHOT where I am opening a lot of jar files to verify stuff.

  1. I open one .jar file
image

This creates 2 temp folders

  1. now I close the Jar File Viewer window.
    This deletes only one of the two temp folders.
image

Expected result:
Both temp folders from the 1st screenshot should have been removed.
Also ending Eclipse does not remove anything.

I searched other related issues, but not sure if one of it is related. Here is the search result:
https://github.com/bndtools/bnd/issues?q=is%3Aissue+bndtoolsjareditortempfiles+is%3Aclosed

@chrisrueger
Copy link
Contributor Author

Reason seems to be that JARTreePage.update() is called two times in different threads.

And because stuff is happening in a backgroud Job

JAREditor.background("Reading zip file", monitor -> {

see https://github.com/bndtools/bnd/blob/master/bndtools.jareditor/src/bndtools/jareditor/internal/JARTreePage.java#L94

I was able to fix it by avoiding a background job when the jar is loaded:
so basically removing the outer

JAREditor.background("Reading zip file", monitor -> {

and just do the stuff inside in the main / display thread.
Now only one folder is created.

Performance wise I do not notice a difference. The jar opens instantly just as before. Maybe even faster, because only one temp folder is created , thus less work.

Not sure how this is "good" or "bad" in Eclipse. I personally don't know what would be bad to open the jar in the Display thread. I mean, it is like "I want to open that file, and of course I am willing to wait until it is opened".

I will do some more testing and maybe push the PR later.

@pkriens any opinion?

@pkriens
Copy link
Member

pkriens commented Oct 31, 2024

The issue is that some jar files > 50Mb and that will be noticeable. (Or at least it used to be.)

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

Successfully merging a pull request may close this issue.

2 participants