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

Improved maven indexer failure modes in low space situations #5655

Merged
merged 1 commit into from
Mar 14, 2023

Conversation

mbien
Copy link
Member

@mbien mbien commented Mar 12, 2023

  • indexing will disable itself if the index failed to extract due to no space left on the device (temp or cache) and notify the user. Once add maven indexer remote index download settings. #5646 is merged we could potentially change this to disable only the remote indexing and keep local indexing active
  • take cause and suppressed exceptions into account while scanning for "no space" messages in the exception
  • added a fallback to clean up remaining files on exception, this doesn't handle the gz itself since this isn't under our control (yet upgrade to maven-indexer 7.0.1 and improve index downloads #4999 would help there)
  • simplified the code a bit

low-storage-index-error

(note: the numbers on the screenshot make no sense since I tested while using different paths to ram disks to simulate low storage, in reality one of the two would be very low)

regarding cancelling: It can happen that while the download or extraction is in progress other threads queue their queries and block on the mutex. When a user cancels the process it will simply restart until the "queue" is empty - this isn't solved by this PR.

https://issues.apache.org/jira/browse/NETBEANS-5489
https://issues.apache.org/jira/browse/NETBEANS-5239

 - indexing will disable itself if the index failed to extract due
   to no space left on the device (temp or cache) and notify the user
 - take cause and suppressed exceptions into account while scanning
   for "no space" messages
 - added a fallback to clean up remaining files on exception
 - simplified the code a bit
@mbien mbien added Maven [ci] enable "build tools" tests ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) labels Mar 12, 2023
@mbien mbien added this to the NB18 milestone Mar 12, 2023
@mbien mbien requested a review from matthiasblaesing March 12, 2023 02:47
@mbien mbien changed the title improved maven indexer failure modes in low space situations Improved maven indexer failure modes in low space situations Mar 12, 2023
Copy link
Contributor

@matthiasblaesing matthiasblaesing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sane to me with a minor nitpick.

Exceptions.printStackTrace(ex);
}
LOGGER.log(Level.INFO, "Downloaded maven index file has size {0} (zipped). The usable space in {1} is {2}.", new Object[]{downloaded, tmpFolder, usableSpace});
Path tmpFolder = Paths.get(System.getProperty("java.io.tmpdir"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At a later time we might allow people to choose a different path for the temp files. If here the tmpFolder is initialized from tmpStorage, this would be easier to update and kept consistent. The variable might not yet initalized though or intialized to null.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this is right now only half of the implementation. Since we don't control the location of the gz itself yet. This is for the larger part: the extracted temp index, before it is moved to cache - so it does help a bit.

if we find a way to get this in: #4999 we then have almost full control over it. The last remaining part would be to fix a bug in maven-indexer which currently hardcodes the extraction of silo files to tmp - but this does also require 4999, since we use a EOL indexer lib now without a way to get fixes in.

Once everything is in place we could make it configurable in the UI. As workaround: users can probably start nb by overriding the tmp folder:
-J-Djava.io.tmpdir=/path/to/tmpdir

I am also in contact with maven devs via slack since I have some ideas how to potentially significantly shrink index size. (wouldn't it be nice to drop all artifacts which are older than x years and make this configurable in the UI? Some artifacts also copy their whole doc into the description field which we could probably drop too. However, this is all blocked by JDK 8, I don't want to work too much ahead when a simple veto can put that time into waste)

@mbien mbien requested a review from neilcsmith-net March 13, 2023 21:43
@mbien
Copy link
Member Author

mbien commented Mar 14, 2023

thanks for the review -> merging

(and I agree we should make the path configurable as soon it is possible)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) Maven [ci] enable "build tools" tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants