Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install_cli.py script and possibly other scripts running in background causing high cpu usage #192

Open
farzadmf opened this issue Nov 29, 2024 · 3 comments

Comments

@farzadmf
Copy link

Hi, I noticed that my CPU usage has gone very hight.

After some digging, I realized that every time I start neovim, a new process calling

python3 -W ignore .../vim-wakatime/scripts/install_cli.py /Users/farzadmf

is started on my Mac and keeps running forever.

Also I see another script running having this command:

-c import sys, importlib.util;\012sys.path = [p for p in sys.path if p != ""] ....

which is also probably coming from Wakatime since it starts when I start Neovim.

Since the scripts are running forever, eating my CPU, I stopped them, but then I see an error/message in Neovim showing [Wakatime] 143:

Is it possible to investigate what's going on causing this issue?

Thank you

@alanhamlett
Copy link
Member

alanhamlett commented Nov 29, 2024

For now, add this line to your neovim config: vim.s.autoupdate_cli = 0

What's the contents of your ~/.wakatime/wakatime-internal.cfg file?

@farzadmf
Copy link
Author

farzadmf commented Dec 1, 2024

Thank you @alanhamlett for the and sorry for the late reply on my part.

Are you sure it's vim.s.autoupdate_cli? I tried doing it my init() function in lazy.nvim configuration, and it's complaining:

...dmf/.config/nvim/lua/plugins-lzv/coding/vim-wakatime.lua:12: attempt to index field 's' (a nil value)

As for the cfg file, I had to disable wakatime when I opened this issue because of it eating my CPU, but this is what I have:

[internal]
cli_version               = v1.106.0
cli_version_last_modified = Mon, 25 Nov 2024 18:09:42 GMT
cli_version_last_accessed = 1732855369
heartbeats_last_sent_at   = 2024-11-29T00:07:15-05:00

Also, I tried to manually run the never-ending command, which is:

/Users/farzadmf/.local/share/mise/shims/python3 -W ignore /Users/farzadmf/.local/share/nvim/.../vim-wakatime/scripts/install_cli.py /Users/farzadmf

and it works fine: runs and says the CLI is up-to-date, not sure why it gets stuck (or seems to be stuck) when I open Neovim

@alanhamlett
Copy link
Member

Are you sure it's vim.s.autoupdate_cli? I tried doing it my init() function in lazy.nvim configuration, and it's complaining

Oops, sorry I thought it was a global variable that we could have used to disable auto-updates but it's a script local variable that only exists inside the plugin scope. The two ways to disable auto updates are putting wakatime-cli in your $PATH or setting this variable in your nvim config:
vim.g.wakatime_CLIPath = ~/.wakatime/wakatime-cli

and it works fine: runs and says the CLI is up-to-date, not sure why it gets stuck (or seems to be stuck) when I open Neovim

That means the Python script is working, and the problem seems to be in how the plugin is executing the Python script:

elseif s:nvim_async

By chance, do you have debug = true in your ~/.wakatime.cfg file? That would cause NVim to check for wakatime-cli updates in the foreground instead of the background.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants