You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
code completion is really slow with spring-boot-language-server version #282
When invoking content assist on java files the contents assist is really slow. I have tested this with Eclipse STS4 nightlies and VSCode release as well. They have spring-boot LS versions 1.7.0-SNAPSHOT and 1.6.0-SNAPSHOT respectively. The problem seems to be in 1.7.x version series.
This becomes the problem when working with java files and greatly effect the functionality of intellij when trying to implement the spring boot plugin to intellij. IntelliJ seems to trigger auto completions on typing.
I'm not noticing CA in Java file being slow. First invocation in the file ~100ms consequent less than 5ms. Spring Boot LS only produces CA for java files inside @Value annotations.
Is there a specific project and/or Java file where CA is slow? Can you measure how long Spring Boot LS CA takes? (See SimpleTextDocumentService#completion(CompletionParams))
With eclipse i tried this and when the lsp content computor is enabled the normal java content asist becomes slow. But when i disable it its back to normal. I don't see any such delays in the yml and properties contributions
Enabling/disabling Spring Boot LS from preferences didn't reveal any slow down in CA for me... It doesn't mean there is no issue though.
Can you check how long Spring Boot LS takes to produce Completion Proposals in your case? Is it just any random CA invocation takes long time in a Java file?
Is it just the CA that is slow? Or is it a general IDE slow down? If it generally becomes sluggish with Boot LS running heap dumps when it is slow would help too.
Also check if SimpleTextDocumentService#resolveCompletionItem(CompletionItem) is getting called numerous times. Ideally it should only be called (request sent from the client) for the currently selected completion item. If it's called for all then it's a serious bug.
Eclipse Preferences: Language Servers -> Spring Language Servers. Now you should see the check boxes for STS LS plugins. Check Spring Boot (or any other) to the see the log of the LS process in the Eclipse Console view.
Where is the 4 seconds it took for completion got logged? It should be between those lines... Do you log the calculated time? If the code is similar to the snippet i pasted above the time should be logged...
Feels like you didn't rebuild the LS jars... From eclipse-language-servers folder run ./local-build.sh wait until it's completed then re-launch the runtime workbench.
No i didn't changed the source code. Well at least we can see there is some delay since the log time is the time the log entry was created rather than the time it was written to file right ?
Seems like @gayanper clearly is experiencing long delay for boot language server to return '0 completions'. The timestamp in the log output are indeed good enough evidence to prove that.
The question is now... why? To find out more it will probably be necessary to add some additional logging during the processing.
Yes, indeed from the time of the log entries it does take long... doesn't take as long for me. It'd be great if you could dig into the code a bit and see what exactly takes all that time on the Boot LS. Simply measuring the time method execution takes will point in the right direction... Would be good to know how long it takes for BootJavaCompletionEngine#getCompletions(...) for example...
Otherwise, it'd be good to have the project you're trying. the Java file as well. Any specific places that are having slow CA? What's the JVM running the LS process? Are you on Win, Mac or Linux?
I get for CA:
13:26:06.094 [pool-3-thread-1] INFO o.s.i.v.c.l.u.SimpleTextDocumentService - completion request received
13:26:06.099 [elastic-5] INFO o.s.i.v.c.l.c.VscodeCompletionEngineAdapter - Starting completion handling
13:26:06.108 [elastic-5] INFO o.s.i.v.c.l.c.VscodeCompletionEngineAdapter - Got 0 completions
13:26:06.110 [elastic-5] INFO o.s.i.v.c.l.c.VscodeCompletionEngineAdapter - Completion handling terminated!
13:26:07.391 [pool-3-thread-1] INFO o.s.i.v.c.l.u.SimpleTextDocumentService - completion request received
13:26:07.392 [elastic-2] INFO o.s.i.v.c.l.c.VscodeCompletionEngineAdapter - Starting completion handling
13:26:07.455 [ForkJoinPool.commonPool-worker-15] INFO o.s.i.v.c.boot.app.cli.SpringBootApp - check for spring jmx beans (retry no. 1) -- LocalSpringBootApp [id=46595, name=``]
13:26:07.456 [ForkJoinPool.commonPool-worker-3] INFO o.s.i.v.c.boot.app.cli.SpringBootApp - check for spring jmx beans (retry no. 1) -- LocalSpringBootApp [id=51885, name=``]
13:26:07.456 [ForkJoinPool.commonPool-worker-7] INFO o.s.i.v.c.boot.app.cli.SpringBootApp - check for spring jmx beans (retry no. 1) -- LocalSpringBootApp [id=81619, name=``]
13:26:07.472 [elastic-2] INFO o.s.i.v.c.l.c.VscodeCompletionEngineAdapter - Got 0 completions
13:26:07.472 [elastic-2] INFO o.s.i.v.c.l.c.VscodeCompletionEngineAdapter - Completion handling terminated!
13:26:09.737 [pool-3-thread-1] INFO o.s.i.v.c.l.u.SimpleTextDocumentService - completion request received
13:26:09.738 [elastic-5] INFO o.s.i.v.c.l.c.VscodeCompletionEngineAdapter - Starting completion handling
13:26:09.740 [elastic-5] INFO o.s.i.v.c.l.c.VscodeCompletionEngineAdapter - Got 0 completions
13:26:09.740 [elastic-5] INFO o.s.i.v.c.l.c.VscodeCompletionEngineAdapter - Completion handling terminated!
Looks fast. Trying to figure out what is different in your setup.
@martinlippert I am using STS 4.4.0 (win10 x64, eclipse 4.13, openjdk 12). i had a lot of freezes in the past weeks when using the code assistant or combined hover. Today i disabled the spring boot "language server" for Java source files and the freezes are gone. Does the Language Server require a permanent stable internet connection? i am using STS behind a proxy in the company i work at. could that be a problem?
i could also not find any documentation about this option and was also not able to spot a difference in the code assitant after i disabled the language server.
@d2k2-git lets move this discussion over to #370
Is your OS Windows?
Is your STS 4.4.0 based on Eclipse 4.12 or 4.13?
What do you see in the Boot Language Server log? Can you paste it here? (Should see the log in Console view if you have enabled Boot Languege Server logging in the console view via preferences)
Can you profile content assist invocation with VisualVM (CPU sampling) and attach the profiling file here?
Please reply with more info in #370. Thanks in advance!
Does the Language Server require a permanent stable internet connection? i am using STS behind a proxy in the company i work at. could that be a problem?
Not explicitly or by design. But I have been surprised in the past that sometimes even just using localhost connecions can end-up somehow pinging outside internet. I recall somethings related to domain name and/or reverse domain name resolution being called from inside Java's socket apis causing delays in the past. So I wouldn't rule out that the firewalling situation in your network has this kind of an effect.
@d2k2-git Maybe it is nevertheless related to #370, at least you could try to enable the logging to the console via Preferences -> Language Server -> Spring Language Server and activate the logging for the Spring Boot LS there. Maybe it reveals anything interesting on the console, like a similar exception than in #370.
So far i was not able to find any interesting information from the log files. i will have time in arround 10 days to invetigate this problem. i would like to help you. but i need some detailed instruction how to perform the thread/memory snapshots you need. i already tried to do myself, but eclipse is not even listed in jprofiler or visualvm. in jconsole i could not find any dumping/snapshot option.
Start STS 4.4.0, open Java file from Spring Boot project
Start Visual VM. You should see in the left pane the following:
Then click on the Sample toggle button at the top of the right pane. You should see on the next row CPU and Stop buttons:
Click on CPU button (starts sampling). Gp to Eclipse and activate time consuming content assist proposals computation. Wait until proposal computed or Eclipse freezes and then click Stop button in VisualVM.
Click on the Snapshot button
Now you should see the snapshot under the app in the left pane
Right-click on that snapshot and click on Save As...
Attach the saved .nps file for profiled Eclipse here.
Repeat the same steps for the Boot LS process: org.springframeework.ide.vscode.boot.app.BootLanguageServerBootApp and attach .nps file for the Boot LS profiling here as well.
@BoykoAlex
Sorry for the late answear. i try to follow your instruction to make a snapshot with visualVM. But there is no eclipse and bootLanguageServer process listed in VisualVM. i tested with different JDK combinations, but no luck.
I can only confirm that STS is now running for many days without freeze when using the content assistant since i disabled the LanguageServer for Java source files.
I still wonder what i am missing after disabling the languagse server for java source files. i did not notice any difference while using the content assistant.
I still wonder what i am missing after disabling the languagse server for java source files. i did not notice any difference while using the content assistant.
The language server doesn't do much in terms of content assist in Java files. There is one example where it kicks in that is inside of @Value(...) annotations. Of the top of my head there's nothing else that comes to mind. The language server does other things though such as providing boot specific symbols in 'open symbols' dialog (press CTRL-6 to open it). Hovers for live process data, completions for properties while editing application.properties and application.yml.
If you are not interested in any of those features then you are probably not missing anything disabling the language server.
@d2k2-git
In the recent past we have seen several reports similar to yours from people on windows and in many cases the problem was caused by them using the built-in windows zip utility to unpack STS distribution. The zip utility in Windows does not support long path names out of the box and just unpacks STS incorrectly causing the language server in particular to break.
If you are on Windows and this sounds like it could be your problem, then maybe you can try some of the worksarounds described in that ticket. TLDR: unpack it using something else like jar xf ... on the CLI or 7zip.
In the recent past we have seen several reports similar to yours from people on windows and in many cases the problem was caused by them using the built-in windows zip utility to unpack STS distribution. The zip utility in Windows does not support long path names out of the box and just unpacks STS incorrectly causing the language server in particular to break.
@kdvolder
thx for your answear. STS was unpacked with 7zip on my system.
Activity
BoykoAlex commentedon Apr 30, 2019
I'm not noticing CA in Java file being slow. First invocation in the file ~100ms consequent less than 5ms. Spring Boot LS only produces CA for java files inside
@Valueannotations.Is there a specific project and/or Java file where CA is slow? Can you measure how long Spring Boot LS CA takes? (See
SimpleTextDocumentService#completion(CompletionParams))gayanper commentedon Apr 30, 2019
With eclipse i tried this and when the lsp content computor is enabled the normal java content asist becomes slow. But when i disable it its back to normal. I don't see any such delays in the yml and properties contributions
BoykoAlex commentedon Apr 30, 2019
Enabling/disabling Spring Boot LS from preferences didn't reveal any slow down in CA for me... It doesn't mean there is no issue though.
Can you check how long Spring Boot LS takes to produce Completion Proposals in your case? Is it just any random CA invocation takes long time in a Java file?
gayanper commentedon Apr 30, 2019
Is there a way i can measure without debugging the language server ?
BoykoAlex commentedon Apr 30, 2019
Measure time in the method and log the calculated time. For example:
BoykoAlex commentedon Apr 30, 2019
Is it just the CA that is slow? Or is it a general IDE slow down? If it generally becomes sluggish with Boot LS running heap dumps when it is slow would help too.
Also check if
SimpleTextDocumentService#resolveCompletionItem(CompletionItem)is getting called numerous times. Ideally it should only be called (request sent from the client) for the currently selected completion item. If it's called for all then it's a serious bug.gayanper commentedon Apr 30, 2019
The log you mentioned, how can i enabled it to be shown in Language Server Console in eclipse ?
BoykoAlex commentedon Apr 30, 2019
Eclipse Preferences: Language Servers -> Spring Language Servers. Now you should see the check boxes for STS LS plugins. Check Spring Boot (or any other) to the see the log of the LS process in the Eclipse Console view.
gayanper commentedon Apr 30, 2019
This was the output. Seems like the completions take nearly 4 seconds to results a empty completion list. This is initial completion
gayanper commentedon Apr 30, 2019
This is the second completion request, which also takes around 700ms
gayanper commentedon Apr 30, 2019
This is a new different completion request on the same started IDE without closing the file even.
BoykoAlex commentedon Apr 30, 2019
Where is the 4 seconds it took for completion got logged? It should be between those lines... Do you log the calculated time? If the code is similar to the snippet i pasted above the time should be logged...
Feels like you didn't rebuild the LS jars... From
eclipse-language-serversfolder run./local-build.shwait until it's completed then re-launch the runtime workbench.gayanper commentedon Apr 30, 2019
No i didn't changed the source code. Well at least we can see there is some delay since the log time is the time the log entry was created rather than the time it was written to file right ?
kdvolder commentedon Apr 30, 2019
Seems like @gayanper clearly is experiencing long delay for boot language server to return '0 completions'. The timestamp in the log output are indeed good enough evidence to prove that.
The question is now... why? To find out more it will probably be necessary to add some additional logging during the processing.
BoykoAlex commentedon Apr 30, 2019
Yes, indeed from the time of the log entries it does take long... doesn't take as long for me. It'd be great if you could dig into the code a bit and see what exactly takes all that time on the Boot LS. Simply measuring the time method execution takes will point in the right direction... Would be good to know how long it takes for
BootJavaCompletionEngine#getCompletions(...)for example...Otherwise, it'd be good to have the project you're trying. the Java file as well. Any specific places that are having slow CA? What's the JVM running the LS process? Are you on Win, Mac or Linux?
I get for CA:
Looks fast. Trying to figure out what is different in your setup.
24 remaining items
BoykoAlex commentedon May 2, 2019
Hopefully fixed with 6163411
gayanper commentedon May 3, 2019
@BoykoAlex @kdvolder Windows 10 results

Execution1
Execution2

gayanper commentedon May 3, 2019
Some benchmarks which shows the current direction is the right direction :)
BoykoAlex commentedon May 6, 2019
I think we are ok to close this
d2k2-git commentedon Sep 24, 2019
@martinlippert I am using STS 4.4.0 (win10 x64, eclipse 4.13, openjdk 12). i had a lot of freezes in the past weeks when using the code assistant or combined hover. Today i disabled the spring boot "language server" for Java source files and the freezes are gone. Does the Language Server require a permanent stable internet connection? i am using STS behind a proxy in the company i work at. could that be a problem?
i could also not find any documentation about this option and was also not able to spot a difference in the code assitant after i disabled the language server.
BoykoAlex commentedon Sep 24, 2019
@d2k2-git lets move this discussion over to #370
Is your OS Windows?
Is your STS 4.4.0 based on Eclipse 4.12 or 4.13?
What do you see in the Boot Language Server log? Can you paste it here? (Should see the log in Console view if you have enabled Boot Languege Server logging in the console view via preferences)
Can you profile content assist invocation with VisualVM (CPU sampling) and attach the profiling file here?
Please reply with more info in #370. Thanks in advance!
BoykoAlex commentedon Sep 24, 2019
@d2k2-git actually never mind #370. It's about Ctrl-Click navigation... it might be unrelated to CA being slow... Please comment here :-)
kdvolder commentedon Sep 24, 2019
Not explicitly or by design. But I have been surprised in the past that sometimes even just using localhost connecions can end-up somehow pinging outside internet. I recall somethings related to domain name and/or reverse domain name resolution being called from inside Java's socket apis causing delays in the past. So I wouldn't rule out that the firewalling situation in your network has this kind of an effect.
martinlippert commentedon Sep 25, 2019
@d2k2-git Maybe it is nevertheless related to #370, at least you could try to enable the logging to the console via
Preferences -> Language Server -> Spring Language Serverand activate the logging for the Spring Boot LS there. Maybe it reveals anything interesting on the console, like a similar exception than in #370.d2k2-git commentedon Sep 27, 2019
So far i was not able to find any interesting information from the log files. i will have time in arround 10 days to invetigate this problem. i would like to help you. but i need some detailed instruction how to perform the thread/memory snapshots you need. i already tried to do myself, but eclipse is not even listed in jprofiler or visualvm. in jconsole i could not find any dumping/snapshot option.
BoykoAlex commentedon Sep 27, 2019
@d2k2-git
VisualVM
Repeat the same steps for the Boot LS process:
org.springframeework.ide.vscode.boot.app.BootLanguageServerBootAppand attach .nps file for the Boot LS profiling here as well.d2k2-git commentedon Oct 11, 2019
@BoykoAlex
Sorry for the late answear. i try to follow your instruction to make a snapshot with visualVM. But there is no eclipse and bootLanguageServer process listed in VisualVM. i tested with different JDK combinations, but no luck.
I can only confirm that STS is now running for many days without freeze when using the content assistant since i disabled the LanguageServer for Java source files.
I still wonder what i am missing after disabling the languagse server for java source files. i did not notice any difference while using the content assistant.
kdvolder commentedon Oct 15, 2019
The language server doesn't do much in terms of content assist in Java files. There is one example where it kicks in that is inside of
@Value(...)annotations. Of the top of my head there's nothing else that comes to mind. The language server does other things though such as providing boot specific symbols in 'open symbols' dialog (press CTRL-6 to open it). Hovers for live process data, completions for properties while editingapplication.propertiesandapplication.yml.If you are not interested in any of those features then you are probably not missing anything disabling the language server.
@d2k2-git
In the recent past we have seen several reports similar to yours from people on windows and in many cases the problem was caused by them using the built-in windows zip utility to unpack STS distribution. The zip utility in Windows does not support long path names out of the box and just unpacks STS incorrectly causing the language server in particular to break.
See: #304
If you are on Windows and this sounds like it could be your problem, then maybe you can try some of the worksarounds described in that ticket. TLDR: unpack it using something else like
jar xf ...on the CLI or 7zip.d2k2-git commentedon Oct 17, 2019
@kdvolder
thx for your answear. STS was unpacked with 7zip on my system.