Matthias Bläsing created NETBEANS-5142:
------------------------------------------

             Summary: LSP Client creates excessive processes
                 Key: NETBEANS-5142
                 URL: https://issues.apache.org/jira/browse/NETBEANS-5142
             Project: NetBeans
          Issue Type: Bug
          Components: lsp
    Affects Versions: 12.2
            Reporter: Matthias Bläsing
            Assignee: Matthias Bläsing


It was observed, that while using the typescript editor support in NetBeans to 
work with angular projects, the whole system became sluggish. Parts of this can 
be attributed to having `ng serve` running in the background and using many 
resources when compiling, but that could not be the whole story.

Checking the task manager showed, that the taskgroup of netbeans contained more 
than 500 processes. The problem was reproducible.

Running with a debugger showed, that a breakpoint placed in 
org.netbeans.modules.typescript.editor.TypeScriptLSP.startServer(Lookup) was 
hit multiple times in a short time frame although only one file was opened.

This can be tracked back int 
org.netbeans.modules.lsp.client.LSPBindings.getBindingsImpl(Project, 
FileObject, String, boolean) where the map `project2MimeType2Server` provides a 
cache, that should yield the same LSP server if a project is present or at 
least the same lsp server for a directory.

This caching does not work. The cache is a WeakHashMap with an URI as key. The 
uri is created in the `getBindingsImpl` method and becomes immediately eligible 
for GC. In consequence the next access will fail to retrieve the previously 
created LSP as the key got GCed.

TL;DR: Caching does not work.

The problem seems to be introduced recently as it was only observed since a few 
weeks. Most probably it was introduced when support for LSP without project 
reference was introduced:

https://github.com/apache/netbeans/commit/74feecb

At that point the cache was switched from Project to URI. The Project is kept 
alive by the IDE, so the cache should have worked at that time.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to