nvim-lint icon indicating copy to clipboard operation
nvim-lint copied to clipboard

Subrocesses not being killed

Open jsongerber opened this issue 1 year ago • 3 comments

I'm using PHPStan to lint PHP code.

My understanding is that each save should trigger an analyze command, and if a previous process is still running, it should terminate before a new one starts.

When checking the running processes via require('lint').get_running(), it only shows a single process, which seems correct. However, it appears that multiple processes are being spawned: 380215159-980e9af7-4ca9-4baf-8d7f-dc94eca1b925

As you can see, only one command is phpstan analyze, others are subprocesses that seems to be orphans, and keep hanging for long minutes, and can take a lot of memory, affecting performance. This behavior seems similar to issue #521, so I’m wondering if this might be a regression.

Please tell me if you need any more information.

jsongerber avatar Oct 25 '24 15:10 jsongerber

I experience the same with shellcheck and flake8 I think it's major bug that must be fixed sooner I can't mend the throttling anyhow but rebooting the laptop which is annoying

lukoshkin avatar Dec 07 '24 19:12 lukoshkin

This behavior seems similar to https://github.com/mfussenegger/nvim-lint/issues/521, so I’m wondering if this might be a regression.

There are test cases for the cancellation: https://github.com/mfussenegger/nvim-lint/blob/c9aa44ff09aeb8b06ba7ab1e58faab7c318f191b/spec/lint_spec.lua#L29-L54

So I'm fairly sure it didn't regress.

Could you check if you can terminate the orphan phpstan processes using kill ? nvim-lint first sends a sigint signal and if that doesn't work for ~10 seconds it sends a sigkill

mfussenegger avatar Jan 18 '25 16:01 mfussenegger

Thank you for your response and for taking time to investigate.

At the time of creating this issue I had 8gb of ram, I since bought more and the issue seems to have disappear (or is less visible).

I tried to reproduce but the processes are now finishing too quick to be able to kill orphan ones (there are still orphans but they seem to not last long, and I don't know if they die by themselves or are killed by the plugin).

When I have time this week I'll try to edit phpstan to add sleep functions to simulate longer processes, but I don't know if it will work.

Maybe @lukoshkin can help if he can reproduce the problem.

jsongerber avatar Jan 19 '25 18:01 jsongerber