VidocqH / lsp-lens.nvim

Neovim plugin for displaying references and difinition infos upon functions like JB's IDEA.
MIT License
252 stars 15 forks source link

File Descriptor Leak during Rename Operations in Large Files #36

Open ESSO0428 opened 5 months ago

ESSO0428 commented 5 months ago

Hello

I've encountered a potential resource management issue in lsp-lens.nvim that seems to occur during rename operations in large files.

Issue Description

In a Django project, specifically while working with a views.py file approximately 900 lines long, I used both lsp rename and %s to rename variables and strings (related to modifying column names in queries). Post these operations, including after undoing the changes, the file descriptor count (lsof -p nvim_pid | wc -l) drastically increased and did not decrease, reaching up to 1069. This led to the following error, rendering many plugins nearly dysfunctional:

Error detected while processing InsertLeave Autocommands for "*":
Error executing lua callback: Vim:E903: Process failed to start: too many open files: "/usr/bin/zsh"
stack traceback:

Steps to Reproduce

Open a large Python file (like view.py in a Django project) with lsp-lens.nvim enabled.

Perform rename operations using lsp.buf.rename() or %s/string_a/string_b/g. Observe the file descriptor count increase, with subsequent errors. Environment Neovim version: NVIM v0.9.4 Build type: Release LuaJIT 2.1.1692716794

Operating System: Ubuntu 20.04.6 LTS on Windows 10 x86_64 This issue appears to be a file descriptor leak, particularly noticeable in large files during and after rename operations. It seems resources aren't being released properly after these operations.

I would appreciate any assistance or insights you can provide to help resolve this issue. Thank you for your contributions to this plugin.

Lastly, I want to express my appreciation for the creation of this interesting and useful plugin. It has been an invaluable tool in my development workflow. Thank you for your hard work and dedication to the Neovim community.

Best regards