Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-5142

LSP Client creates excessive processes

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 12.2
    • Fix Version/s: 12.3
    • Component/s: lsp

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                matthiasblaesing Matthias Bläsing
                Reporter:
                matthiasblaesing Matthias Bläsing
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h
                  1h