Skip to content

Yang LSP taking too much memory & stop working.  #248

Description

@Kaauw

Hello Team,

I have an issue with Yang LSP (with Yangster vscode). It take too much memory and do not work.

Context

  • VScode with remote ssh development.
  • Workspace with 4 projects, each of them import the same yang base (Cisco NSO environment)

Versions

user@host:~$java --version
openjdk 11.0.25 2024-10-15
OpenJDK Runtime Environment (build 11.0.25+9-post-Ubuntu-1ubuntu122.04)
OpenJDK 64-Bit Server VM (build 11.0.25+9-post-Ubuntu-1ubuntu122.04, mixed mode, sharing)

user@host:~$uname -a
Linux ubuntu-server 5.15.0-125-generic #135-Ubuntu SMP Fri Sep 27 13:53:58 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

user@host:~$code --version
1.95.2
e8653663e8840adaf45af01eab5c627a5af81807
x64

CPU/Memory info

CPU/Memory after reboot and all services loaded, before opening a workspace :

image

Same output after workspace opened :

image

Problem

Yangster output there is an heap memory problem, and sometimes it crash for the whole workspace.

Troubleshooting done

Splitting workspaces

Not working as it pop a new Yang-LSP Process, this use all the VM Memory and make it not usable.

Increase the heap space

I saw in the server launch script I can change the heap space via two environment variables :

JAVA_OPTS= ??
YANG_LANGUAGE_SERVER_OPTS= ??

But I don't know Java & I don't know which value I can use here.

Output from vscode

[Info  - 1:27:32 PM] Indexing YangPath element: file:/var/opt/ncs/packages/private1/src/yang/private1.yang
[... 691 yangs files here ...]
[Info  - 1:28:37 PM] Indexing YangPath element: file:/opt/ncs/current/src/ncs/yang/tailf-ncs-kicker-extension.yang
[Error - 1:30:28 PM] Error loading yangPath resource class org.eclipse.emf.common.util.URI: java.lang.OutOfMemoryError: Java heap space
	at jdk.internal.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.xtext.parser.antlr.AbstractInternalAntlrParser.parse(AbstractInternalAntlrParser.java:594)
	at org.eclipse.xtext.parser.antlr.AbstractAntlrParser.doParse(AbstractAntlrParser.java:103)
	at org.eclipse.xtext.parser.antlr.AbstractAntlrParser.parse(AbstractAntlrParser.java:85)
	at org.eclipse.xtext.parser.antlr.AbstractAntlrParser.doParse(AbstractAntlrParser.java:63)
	at org.eclipse.xtext.parser.AbstractParser.parse(AbstractParser.java:34)
	at org.eclipse.xtext.resource.XtextResource.doLoad(XtextResource.java:178)
	at org.eclipse.xtext.linking.lazy.LazyLinkingResource.doLoad(LazyLinkingResource.java:115)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1563)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1342)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
	at org.eclipse.xtext.resource.XtextResourceSet.getResource(XtextResourceSet.java:266)
	at org.eclipse.xtext.resource.SynchronizedXtextResourceSet.getResource(SynchronizedXtextResourceSet.java:33)
	at io.typefox.yang.utils.YangPathProvider.process(YangPathProvider.java:115)
	at io.typefox.yang.utils.YangPathProvider.lambda$process$3(YangPathProvider.java:109)
	at io.typefox.yang.utils.YangPathProvider$$Lambda$175/0x0000000840327440.accept(Unknown Source)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at io.typefox.yang.utils.YangPathProvider.process(YangPathProvider.java:111)
	at io.typefox.yang.utils.YangPathProvider.lambda$process$3(YangPathProvider.java:109)
	at io.typefox.yang.utils.YangPathProvider$$Lambda$175/0x0000000840327440.accept(Unknown Source)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at io.typefox.yang.utils.YangPathProvider.process(YangPathProvider.java:111)
	at io.typefox.yang.utils.YangPathProvider.lambda$process$3(YangPathProvider.java:109)
	at io.typefox.yang.utils.YangPathProvider$$Lambda$175/0x0000000840327440.accept(Unknown Source)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at io.typefox.yang.utils.YangPathProvider.process(YangPathProvider.java:111)
	at io.typefox.yang.utils.YangPathProvider.lambda$process$3(YangPathProvider.java:109)
	at io.typefox.yang.utils.YangPathProvider$$Lambda$175/0x0000000840327440.accept(Unknown Source)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)

Idea

  1. Due to the fact that 4 projects import the same baseline, yang-lsp import recusively each base yang + service yang.
  2. Splitting workspace into 4 workspaces is not a solution as it pop many processes and uses all the vm available memory.

Regards,

Ben

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions