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

Clean old temporary local maven index cache dir before scan #7586

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

mbien
Copy link
Member

@mbien mbien commented Jul 16, 2024

When the last local maven repo scan didn't clean up properly, for example when the JVM exits during scan, subsequent scans would throw java.io.IOException: Cannot create temporary directory.

This has a fairly low probability since local index scans finish fast - saw this during debugging.

exception:

java.io.IOException: Cannot create temporary directory: /home/mbien/NetBeansProjects/netbeans/nbbuild/testuserdir/var/cache/tmp-local
	at org.netbeans.modules.maven.indexer.NexusRepositoryIndexerImpl.scan(NexusRepositoryIndexerImpl.java:813)
	at org.netbeans.modules.maven.indexer.NexusRepositoryIndexerImpl.indexLoadedRepo(NexusRepositoryIndexerImpl.java:616)
[catch] at org.netbeans.modules.maven.indexer.NexusRepositoryIndexerImpl.lambda$spawnIndexLoadedRepo$8(NexusRepositoryIndexerImpl.java:714)
	at org.netbeans.modules.openide.util.DefaultMutexImplementation.writeAccess(DefaultMutexImplementation.java:229)
	at org.openide.util.Mutex.writeAccess(Mutex.java:253)
	at org.netbeans.modules.maven.indexer.NexusRepositoryIndexerImpl.lambda$spawnIndexLoadedRepo$9(NexusRepositoryIndexerImpl.java:707)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1403)
	at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:287)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2018)

how to simulate:
create a tmp-local folder in your fresh cache folder, trigger initial local repo indexing, e.g by adding a dependency to a maven project.

 
When the last local maven repo scan didn't clean up properly,
for example when the JVM exits during scan, subsequent scans
would throw "java.io.IOException: Cannot create temporary directory".
@mbien mbien added the Maven [ci] enable "build tools" tests label Jul 16, 2024
@mbien mbien added this to the NB23 milestone Jul 16, 2024
@mbien mbien requested a review from matthiasblaesing July 16, 2024 20:22
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.

Only eyeballed this, but I also saw this problem when running test builds (these have the tendency to be forcibly shutdown before scan finished) and approach looks good to me.

@mbien mbien merged commit 1b31400 into apache:master Jul 16, 2024
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Maven [ci] enable "build tools" tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants