Skip to content

Pyright consuming 100% CPU #4176

@larsks

Description

@larsks

Describe the bug

I am running pyright under neovim lsp. When pyright is running, I see:

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
 791059 lars      20   0 3072068   2.5g  37180 R 117.6   3.9  10:08.94 node

Examining the pyright process with strace, it appears to start by calling statx() on every single file in my home directory, which consumes an enormous amount of resources. This behavior is independent of the directory from which neovim was launched.

Even after it has finished scanning files it continues to consume 100% CPU; at this point strace shows lots of calls to futex() interspersed with calls to getpid() (about 35,000 times in 10 seconds).

To Reproduce

  1. Configure neovim to use pyright:

    require'lspconfig'.pyright.setup{
        on_attach=on_attach,
    }
    

    Where on_attach just sets up a bunch of key mappings.

  2. Open a Python file with neovim.

Expected behavior

I expect pyright to check the syntax of the files I have open in neovim and nothing else.

Additional information

This is similar to #128 but @erictraut asked for a new issue for related problems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions