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

VimLeave not always triggered #49

Closed
glacambre opened this issue Aug 3, 2019 · 18 comments · Fixed by #441
Closed

VimLeave not always triggered #49

glacambre opened this issue Aug 3, 2019 · 18 comments · Fixed by #441

Comments

@glacambre
Copy link
Owner

glacambre commented Aug 3, 2019

After running close_server, nvim prompts Press ENTER or type command to continue on stderr. This might be related to neovim/neovim#9358.
Could also be related to neovim/neovim#11166.

@justinmk
Copy link
Contributor

justinmk commented Oct 6, 2019

Assuming this is the same problem, but just for reference:

  • Explicitly quitting Nvim via :wq, ZZ, ZQ seems to exit the process without issue.
  • "Navigating away" without explicit exit, seems to leave nvim.exe running.

@svermeulen
Copy link

Yeah I just noticed this too. After using it for awhile I find that I quickly end up with tons of nvim processes listed when I run ps aux | grep nvim.

@justinmk
Copy link
Contributor

justinmk commented Oct 19, 2019

One solution/workaround could be to use Nvim's "external window" feature:

  1. connect to the same nvim instance from each textbox
  2. instead of creating a new nvim, create a new external (floating) window on the connected nvim server.
    • nvim_open_win with external=true. Requires :help ui-multigrid to be enabled.
  3. focus the window (set the enter param of nvim_open_win)

Caveats:

  • this will create many windows in the Nvim server, but that should scale up to thousands without a problem.
  • if user somehow navigates out of the window, will be confusing.
  • user can't create split windows in an external window.

Alternative: "tabgrid" feature (not merged yet) neovim/neovim#7541

@glacambre
Copy link
Owner Author

I added a workaround to kill lingering neovim processes with os.exit() when :qall! doesn't work. This means that you should now see at most 2 neovim processes belonging to firenvim: one for the textarea you're editing and another for the next textarea you'll edit.

I might be wrong but I think that in cases where os.exit() is used, autocommands such as VimLeave won't be triggered.

@justinmk I'll probably implement your idea with #197 .

@glacambre glacambre changed the title nvim processes won't die VimLeave not always triggered Nov 2, 2019
@NilsIrl
Copy link
Contributor

NilsIrl commented Jan 26, 2020

This is also problematic as nvim prevents shutdowns.

@justinmk
Copy link
Contributor

nvim prevents shutdowns

? shutdown of what?

@NilsIrl
Copy link
Contributor

NilsIrl commented Jan 26, 2020

? shutdown of what?

The computer. If I run poweroff/shutdown/reboot/systemctl ....

I get the message A stop job is running for Session x of user xxxx (1min 30s) and have to wait 1min 30s for my computer to power off. This is caused by having lingering nvim instances.

Jan 02 21:16:49 nixos systemd[1]: session-1.scope: Stopping timed out. Killing.
Jan 02 21:16:49 nixos systemd[1]: session-1.scope: Killing process 10196 (nvim) with signal SIGKILL.

I can confirm that this is the case because when I manually kill the nvim instances, this doesn't happen. These instances are created by firenvim and never removed even when Firefox is closed.

So there is effectively a nvim instance leak by firenvim that prevents some computers to shutdown immediately.

@glacambre glacambre added the neovim-change This feature needs something to be implemented in neovim label Feb 16, 2020
@glacambre
Copy link
Owner Author

This should be fixed with neovim/neovim@a2efc9c - thanks @justinmk!

I'll keep this issue open for a few weeks, please let me know if you can still reproduce this bug with a neovim that has patch a2efc9c.

@glacambre
Copy link
Owner Author

Can still reproduce. This is weird, I could have sworn this was fixed.

@justinmk
Copy link
Contributor

@glacambre maybe neovim/neovim@ce15977 helps?

@glacambre glacambre removed the neovim-change This feature needs something to be implemented in neovim label Feb 19, 2020
@glacambre
Copy link
Owner Author

It was actually fixed for a brief instant, after neovim/neovim#11821 was merged and before I merged #382. I pushed a fix to master and this should now properly be fixed again. Keeping this issue open until I add a test that makes sure it stays fixed :)

@justinmk
Copy link
Contributor

justinmk commented Jul 5, 2022

Recently I've noticed that unsaved changes do not get written to the browser textbox when exiting via ZZ with firenvim. Using firenvim 0.2.12 and Nvim HEAD at neovim/neovim@d0835617facc .

Haven't bisected anything yet, just wondering if others are seeing this.

@glacambre
Copy link
Owner Author

@justinmk I can't reproduce on 1b235fe6c . I'll take a deeper look this week-end.

@glacambre glacambre reopened this Jul 5, 2022
@justinmk
Copy link
Contributor

Fixed by #1384 ?

@glacambre
Copy link
Owner Author

@justinmk Indeed, I can't repro on neovim master, so if you can't either let's assume this is fixed :)

@tricktux
Copy link

Exiting via ZZ does not save text for me. I have to :wq

firenvim version: Not sure how to see, installed from the firefox store
OS: Archlinux
Firefox version: 120.0.1 (64-bit)
nvim version:
NVIM v0.10.0-dev-1870+g8fb7419d7c
Build type: RelWithDebInfo
LuaJIT 2.1.1702233742
Run ":verbose version" for more info

@glacambre
Copy link
Owner Author

@tricktux Could you go in insert mode in Firenvim and run

:redir @a
:map Z
:map ZZ
:au VimLeave
:redir END

And then press "ap in order to insert your mappings/VimLeave autocommands in the buffer and then give me the results?

@tricktux
Copy link

Hi @glacambre

Thanks for the quick response! Amazing extension BTW!

Here's the output:

x  Z             <Plug>Sneak_S
o  Z             <Plug>Sneak_S

--- Autocommands ---
FirenvimAugroupChan3  VimLeave
    *         call rpcnotify(3, 'firenvim_vimleave') | call delete('github.com_glacambre-firenvim-issues-49_TEXTAREA-id-new-comment-field_2024-01-12T20-08-17-430Z.txt')

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

Successfully merging a pull request may close this issue.

5 participants