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

NPE from org.springframework.ide.vscode.boot.java.utils.SpringIndexer.removeSymbolsByProject(SpringIndexer.java:674) #105

Closed
apupier opened this issue Oct 8, 2018 · 7 comments
Milestone

Comments

@apupier
Copy link

apupier commented Oct 8, 2018

I have a lot of errors for now so don't know the steps to reproduce but I hope it will be possible to fix the NPE without the steps to reproduce

full log of vscode-springboot:

[main] INFO org.springframework.ide.vscode.commons.util.Log - Starting LS
[main] INFO org.springframework.ide.vscode.commons.util.Log - Connected to parent using socket on port 45556
[SimpleLanguaserver main thread-1] INFO org.springframework.ide.vscode.boot.jdt.ls.JdtLsProjectCache - JDT Language Server not available. Fallback classpath provider will be used instead.
[SimpleLanguaserver main thread-1] INFO org.springframework.ide.vscode.boot.jdt.ls.JavaProjectsServiceWithFallback - Fallback classpath provider will be enabled
[pool-3-thread-1] INFO org.springframework.ide.vscode.boot.metadata.AdHocSpringPropertyIndexProvider - File changed: file:///c%3A/git/spring-petclinic/target/classes/application.properties
[pool-3-thread-1] INFO org.springframework.ide.vscode.boot.BootLanguageServer - A project changed null, triggering reconcile on all open documents
[pool-2-thread-1] ERROR org.springframework.ide.vscode.boot.java.utils.SpringIndexer - org.springframework.ide.vscode.boot.java.utils.SpringIndexer$DeleteProject@73287aab threw exception
[pool-3-thread-1] INFO org.springframework.ide.vscode.boot.metadata.AdHocSpringPropertyIndexProvider - => Project changed: null
java.lang.NullPointerException
	at java.util.concurrent.ConcurrentHashMap.replaceNode(ConcurrentHashMap.java:1106)
	at java.util.concurrent.ConcurrentHashMap.remove(ConcurrentHashMap.java:1097)
	at org.springframework.ide.vscode.boot.java.utils.SpringIndexer.removeSymbolsByProject(SpringIndexer.java:674)
	at org.springframework.ide.vscode.boot.java.utils.SpringIndexer.access$500(SpringIndexer.java:81)
	at org.springframework.ide.vscode.boot.java.utils.SpringIndexer$DeleteProject.run(SpringIndexer.java:584)
	at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1626)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
[pool-3-thread-1] INFO org.springframework.ide.vscode.boot.metadata.AdHocSpringPropertyIndexProvider - File changed: file:///c%3A/git/spring-petclinic/target/classes/application.properties
[pool-3-thread-1] INFO org.springframework.ide.vscode.boot.metadata.AdHocSpringPropertyIndexProvider - => Project changed: null
[ForkJoinPool.commonPool-worker-1] INFO org.springframework.ide.vscode.boot.BootLanguageServer - A project changed spring-petclinic, triggering reconcile on all open documents
[SimpleLanguaserver main thread-1] INFO org.springframework.ide.vscode.commons.boot.app.cli.SpringBootApp - Creating JMX connector: service:jmx:rmi://127.0.0.1/stub/rO0ABXN9AAAAAQAlamF2YXgubWFuYWdlbWVudC5yZW1vdGUucm1pLlJNSVNlcnZlcnhyABdqYXZhLmxhbmcucmVmbGVjdC5Qcm94eeEn2iDMEEPLAgABTAABaHQAJUxqYXZhL2xhbmcvcmVmbGVjdC9JbnZvY2F0aW9uSGFuZGxlcjt4cHNyAC1qYXZhLnJtaS5zZXJ2ZXIuUmVtb3RlT2JqZWN0SW52b2NhdGlvbkhhbmRsZXIAAAAAAAAAAgIAAHhyABxqYXZhLnJtaS5zZXJ2ZXIuUmVtb3RlT2JqZWN002G0kQxhMx4DAAB4cHc0AAtVbmljYXN0UmVmMgAACTEwLjAuNzUuMQAA579y51wZc9Di2HBg5z0AAAFmUuVnsoABAHg=
[SimpleLanguaserver main thread-1] INFO org.springframework.ide.vscode.commons.boot.app.cli.SpringBootApp - Created JMX connector: javax.management.remote.rmi.RMIConnector: jmxServiceURL=service:jmx:rmi://127.0.0.1/stub/rO0ABXN9AAAAAQAlamF2YXgubWFuYWdlbWVudC5yZW1vdGUucm1pLlJNSVNlcnZlcnhyABdqYXZhLmxhbmcucmVmbGVjdC5Qcm94eeEn2iDMEEPLAgABTAABaHQAJUxqYXZhL2xhbmcvcmVmbGVjdC9JbnZvY2F0aW9uSGFuZGxlcjt4cHNyAC1qYXZhLnJtaS5zZXJ2ZXIuUmVtb3RlT2JqZWN0SW52b2NhdGlvbkhhbmRsZXIAAAAAAAAAAgIAAHhyABxqYXZhLnJtaS5zZXJ2ZXIuUmVtb3RlT2JqZWN002G0kQxhMx4DAAB4cHc0AAtVbmljYXN0UmVmMgAACTEwLjAuNzUuMQAA579y51wZc9Di2HBg5z0AAAFmUuVnsoABAHg=
[SimpleLanguaserver main thread-1] INFO org.springframework.ide.vscode.commons.util.Log - Closed: file:///c%3A/git/spring-petclinic/src/main/java/org/springframework/samples/petclinic/PetClinicApplication.java
[SimpleLanguaserver main thread-1] INFO org.springframework.ide.vscode.boot.java.utils.SpringLiveHoverWatchdog - Shutting down SpringLiveHoverWatchdog
WARNING	?	JMX client heartbeat 2	2018-10-08T08:58:41.622Z	ClientCommunicatorAdmin#Checker-run	Failed to check connection: java.net.ConnectException: Connection refused: connect
WARNING	?	JMX client heartbeat 2	2018-10-08T08:58:41.633Z	ClientCommunicatorAdmin#Checker-run	stopping
@BoykoAlex
Copy link
Contributor

@apupier what kind of projects do you have in your workspace?

@kdvolder
Copy link
Member

kdvolder commented Oct 9, 2018

@martinlippert recently fixed a NPE that Dave Syer was getting a lot. I'm not sure its the same problem but thought I'd mention it. Martin may know for sure.

@apupier
Copy link
Author

apupier commented Oct 9, 2018

what kind of projects do you have in your workspace?

I don't reproduce anymore but if i remember well it was the project created from Spring initializr Maven/Java/2.0.5 and with Apache Camel dependency

@BoykoAlex
Copy link
Contributor

BoykoAlex commented Oct 9, 2018

@apupier Did you change file:///c%3A/git/spring-petclinic/target/classes/application.properties this file to trigger the issue? I mean the file under /target/classes/?

@apupier
Copy link
Author

apupier commented Oct 9, 2018

Did you change file:///c%3A/git/spring-petclinic/target/classes/application.properties this file to trigger the issue?

I changed the applciation.properties during my experiments yes. But it was not under the target/classes, it was in the src/main/resources folder. I don't reproduce today while changing it

@kdvolder
Copy link
Member

kdvolder commented Oct 9, 2018

I don't reproduce anymore

This is probably a bug triggered by some 'problems' in the project. E.g. as someone is editing the code, or the dependencies the project may have temportary compile errors, or maybe dependencies are not fullly resolved yet.

It probably means our code needs some extra NPE checks to guard agains situations were some pieces of the AST are not known (and so they are null). Even if the problem is not immediately reproducible it should be possible to use the stacktrace to figure out where a null check might be missing.

@BoykoAlex
Copy link
Contributor

Added NPE checks in the indexing code to prevent NPEs from happening for null-name project.

@martinlippert martinlippert added this to the 4.0.1 milestone Oct 31, 2018
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

4 participants