0

Randomly, my nvim will hang.

Generally, it seems to happen in command mode.

The latest one has hung with:

:set paste! paste?

On the status line. I have map <F2> :set paste! paste?<CR> and I just pressed F2.

But this is just one example: it happens seemingly randomly, sometimes on cursor movement.

When hung, there is always a 100% CPU usage by the process.

This doesn't tell me too much:

% sudo strace -fs200 -p 18878  |& uniq
strace: Process 18878 attached with 2 threads
strace: [ Process PID=18878 runs in x32 mode. ]
[pid 18894] epoll_pwait(15, strace: [ Process PID=18878 runs in 64 bit mode. ]
 <unfinished ...>
[pid 18878] epoll_pwait(9, [], 1024, 0, NULL, 8) = 0
[pid 18878] madvise(0x7f54d8401000, 33562624, MADV_FREE) = 0
[pid 18878] madvise(0x7f54d8401000, 33562624, MADV_DONTNEED) = 0
[pid 18878] epoll_pwait(9, [], 1024, 0, NULL, 8) = 0
[pid 18878] madvise(0x7f54d7400000, 16781312, MADV_FREE) = 0
[pid 18878] epoll_pwait(9, [], 1024, 0, NULL, 8) = 0
[pid 18878] madvise(0x7f54d8401000, 33562624, MADV_FREE) = 0
[pid 18878] madvise(0x7f54d8401000, 33562624, MADV_DONTNEED) = 0
[pid 18878] epoll_pwait(9, [], 1024, 0, NULL, 8) = 0
[pid 18878] madvise(0x7f54d7400000, 16781312, MADV_FREE) = 0
[pid 18878] epoll_pwait(9, [], 1024, 0, NULL, 8) = 0
[pid 18878] madvise(0x7f54d8401000, 33562624, MADV_FREE) = 0
[pid 18878] madvise(0x7f54d8401000, 33562624, MADV_DONTNEED) = 0
[... <repeats>]

I checked out fd 9 in /proc/$PID/fd, and it was: 9 -> 'anon_inode:[eventpoll]'.

Is there a way I can have nvim dump stack?

How can I debug what is causing neovim to hang when it won't respond to any key presses?

I'd prefer to avoid needing to bisect through all my plugins to find out what's causing it. The random element means not knowing if I've waited long to declare a particular set of plugins "good".

  • Did you try just: nnoremap <F2> :set paste!<CR> Does it hang too? – user6408 Oct 25 '18 at 13:43
  • It hangs randomly in command mode, not just with F2. Perhaps I shouldn't have given such a specific example of this particular hang. – Tom Hale Oct 26 '18 at 17:35
  • You can run it under gdb debugger. If your distribution does not include it already, you ned to install gdb and neovim-debug package. Run nvim as usual. When it hangs, run in another terminal: gdb --pid $(pidof nvim) $(which nvim) to attach gdb. Issue bt<return> command and inspect the stack. – Juraj Dec 3 '18 at 21:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.