glacambre / firenvim

Embed Neovim in Chrome, Firefox & others.
GNU General Public License v3.0
4.57k stars 144 forks source link

[Bug] `nvim.exe` process is not killed when closing `Firenvim` `Neovim` instance #1596

Closed pidgeon777 closed 4 months ago

pidgeon777 commented 4 months ago

What I tried to do

I can edit a text area successfully with Firenvim, but once I close the embedded Neovim window, a nvim.exe process is still running in the background.

What happened

See above.

Also I noticed that when manually triggering a Firenvim Neovim instance for the first time, a nvim.exe process is created (around 7 MB in RAM), and I have to manually trigger again the Firenvim command in the text area, to actually show the Neovim window.

After doing that for the second time, a further nvim.exe process is created (this time around 30 MB), and it actually gets terminated when I exit Neovim (:q).

But after quitting, the first created nvim.exe process is still running in the background.

It is as if this initial Neovim process almost acted as a "preloader" for all subsequent nvim.exe processes. The problem is that no one terminates it, and I have to do it manually.

Also, I'm using Neovim with scoop package manager.

glacambre commented 4 months ago

Firenvim does pre-load a neovim process at all times, meaning that you should always have an nvim.exe process loaded when firefox is loaded. You should have two when editing a textarea: one pre-loaded nvim.exe + the one for the textarea you're currently editing. Is this consistent with what you see in your process manager?

pidgeon777 commented 4 months ago

Thanks for the info. I'm using Chrome currently.

So, if I understand correctly, this is what happens:

  1. Open the browser.
  2. Open a web page with a textarea.
  3. Activate firenvim and start editing the textarea.

➡️ This leads to the creation of two nvim.exe processes, one is "pre-loader" and the other is the actual editor.

  1. Close the firenvim editor.

➡️ The "pre-loader" process is still running, the other process is gone.

  1. Activate firenvim again and start editing the textarea.

➡️ This leads to the creation of just one nvim.exe process, the "pre-loader" process is still running.

  1. Close the firenvim editor.

At this point, the "pre-loader" process is still running.

My question is, when will the "pre-loader" process be closed? Is it supposed to be closed when the browser is closed? Or when the tab where the last firenvim editor was active is closed?

Finally, would there be a way to automatically close the "pre-loader" process when the last firenvim editor is closed? (I'm not sure if this would be a good idea, but I'm just asking).

glacambre commented 4 months ago

My question is, when will the "pre-loader" process be closed?

It will be closed when you shut down your browser.

Finally, would there be a way to automatically close the "pre-loader" process when the last firenvim editor is closed?

It would be possible for Firenvim to work without a pre-loaded neovim process, but it would increase the latency of the creation of Firenvim editors in your tabs, so this is not something I'll implement :).

pidgeon777 commented 4 months ago

Finally, would there be a way to automatically close the "pre-loader" process when the last firenvim editor is closed?

It would be possible for Firenvim to work without a pre-loaded neovim process, but it would increase the latency of the creation of Firenvim editors in your tabs, so this is not something I'll implement :).

I understand, I think it's a good trade-off 👍.