REditorSupport / REditorSupport/languageserver

VSCode Perl::LanguageServer causes a process that consumes CPU

Open
#642 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
675
Forks
118
Avg merge
1d 37m
Merged PRs (30d)
11

Description

When running Perl::LanguageServer inside of VSCode there is a master perl that consumes about 100% of a CPU. Initially, this process fires off a number of pls processes, apparently parsing all of the Perl modules it can find and communicating that data to the master perl process bloating it up to 1.5G in my case. OK, I understand that. There's a lot of Perl code here. However, after it settles down and the pls processes go away the master perl process continues to chew on about 100% of one CPU, even if VSCode is essentially idle.

top - 10:47:37 up 14:32,  1 user,  load average: 0.09, 0.19, 0.22
Tasks: 204 total,   3 running, 201 sleeping,   0 stopped,   0 zombie
%Cpu(s): 22.5 us,  4.3 sy,  0.1 ni, 72.8 id,  0.0 wa,  0.2 hi,  0.1 si,  0.0 st
MiB Mem :   7685.1 total,    427.8 free,   3963.5 used,   3293.8 buff/cache
MiB Swap:   1024.0 total,    942.9 free,     81.1 used.   3405.2 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                                                                                                                                  
   4635 root      20   0 2069884   1.5g   8496 R  99.7  20.6 863:12.92 perl                                                                                                                                                                                     
   4220 root      20   0 1070064 198816  47200 S   2.0   2.5   0:51.59 node                                                                                                                                                                                     
   2021 root      20   0  895920  97960  16820 S   1.3   1.2   2:44.30 python3                      

Closing VSCode causes the master perl process to go away.

An strace of the master perl reveals:

select(16, [3 5 8], [], NULL, {tv_sec=3600, tv_usec=0}) = 1 (in [5], left {tv_sec=3599, tv_usec=999999})
select(16, [3 5 8], [], NULL, {tv_sec=3600, tv_usec=0}) = 1 (in [5], left {tv_sec=3599, tv_usec=999999})
select(16, [3 5 8], [], NULL, {tv_sec=3600, tv_usec=0}) = 1 (in [5], left {tv_sec=3599, tv_usec=999999})
select(16, [3 5 8], [], NULL, {tv_sec=3600, tv_usec=0}) = 1 (in [5], left {tv_sec=3599, tv_usec=999999})
select(16, [3 5 8], [], NULL, {tv_sec=3600, tv_usec=0}) = 1 (in [5], left {tv_sec=3599, tv_usec=999999})

over and over again.

Perl version: 5.36.0
OS: CloudLinux: 8.8 (also experienced on AlmaLinux 8.8 and CentOS 7)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the idle CPU usage in Perl::LanguageServer under VSCode and inspect the repeated select calls shown by strace. Use the reported Perl 5.36.0 and Linux environments as a baseline; done means identifying the cause and confirming that the master perl process no longer consumes a CPU while VSCode is idle.

Written by the indexing model from the issue text.

Assessment

Tech stack
perl
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.