akinsho / toggleterm.nvim

A neovim lua plugin to help easily manage multiple terminal windows
GNU General Public License v3.0
4.06k stars 170 forks source link

[BUG] Nvim sometimes freezes when toggleterm is in background as if throttling #552

Closed life00 closed 4 months ago

life00 commented 4 months ago

Is there an existing issue for this?

Current Behavior

When I run some moderately intensive build process using toggleterm and then hide the split with :q there is a high chance that my whole neovim session may freeze for some time and occasionally unfreezes until build is complete. This issue is not reproducible with light tasks (e.g. sleep 100) or if I do not hide toggleterm. My main guess is that when toggleterm is in the background it has some different process characteristics and the running build process may throttle neovim itself, while this does not occur in foreground.

Expected Behavior

Process with any intensity should not result in neovim being throttled when toggleterm is hidden.

Steps To Reproduce

It is rather difficult to reproduce, but I may say with near certainty that it is not plugin interference related because I sometimes was or was not able to reproduce it with different parts of my config enabled/disabled. But I found a tendency that when I enable more intensive parts of my config the probability of neovim being frozen is higher. This makes me more confident that it is related to throttling.

I use lazyvim with a bunch on top, but I was not able to reproduce it with default lazyvim and had to add my chunky config.

Here are the steps that might help you to reproduce it:

  1. have a chunky setup
  2. have some code for an intensive build process
  3. run the build process from toggleterm and hide toggleterm

This may or may not work because if its throttling then it may be system dependent.

Environment

- OS: Fedora Linux Asahi Remix 39 aarch64
- neovim version: v0.9.5
- Shell: zsh 5.9

Anything else?

If necessary I may provide video demonstration, but I think the description is self explanatory. I also may provide logs, but please tell where to look at.

I understand that this is quite a vague issue report, but I am not sure what else I can provide. I am open to any solutions.

life00 commented 4 months ago

OK so the issue is even more interesting because I am able to reproduce it with the default lazyvim terminals. Does it mean its a neovim issue with whatever backend both terminals use? What do I do next?

life00 commented 4 months ago

I am not able to reproduce this with default neovim terminal because it does not support hiding the terminal and moving the process to background.

akinsho commented 4 months ago

@life00 this seems a great deal like an interaction of your system or config framework. Unfortunately this plugin is just me and the 15mins I have some weeks so definitely not a good place to find in depth answers for issues like this. For the most part on a minimal config of neovim this works as intended so I don't think this is an issue with the logic in this plugin.