Open petobens opened 4 years ago
Ran into this issue when I use asyncrun.vim to run python code in a split terminal window. When I closed the terminal, this error occured.
@numirias hi! Any chance/plans to look into this? Thanks in advance :)
I am seeing this often with vim-fugitive (https://github.com/tpope/vim-fugitive/issues/1634).
From adding some printing etc it appears the window is gone when Semshi asks for the cursor position there.
DBG: [37, 37] (WinLeave: abuf: 4, amatch: …foo.py, winnr():2, ft: python, bt: )
DBG: [37, 37] (WinEnter: abuf: 16, amatch: fugitive://…, winnr():1, ft: python, bt: )
DBG: [37, 37] (BufEnter: abuf: 16, amatch: fugitive://…, winnr():1, ft: python, bt: )
=== _update_step buf=<Buffer(handle=16)> ===
File "/usr/lib/python3.8/threading.py", line 890, in _bootstrap
self._bootstrap_inner()
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "…/vim/plugged/semshi/rplugin/python3/semshi/handler.py", line 158, in _update_loop
self._update_step()
File "…/vim/plugged/semshi/rplugin/python3/semshi/util.py", line 19, in wrapper
res = func(*args, **kwargs)
File "…/vim/plugged/semshi/rplugin/python3/semshi/handler.py", line 178, in _update_step
self._buf, "".join(traceback.format_stack())
semshi: _wait_for: (<function BufferHandler._update_step.<locals>.<lambda> at 0x7ff5ae1dd430>, False)
File "/usr/lib/python3.8/threading.py", line 890, in _bootstrap
self._bootstrap_inner()
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "…/vim/plugged/semshi/rplugin/python3/semshi/handler.py", line 158, in _update_loop
self._update_step()
File "…/vim/plugged/semshi/rplugin/python3/semshi/util.py", line 19, in wrapper
res = func(*args, **kwargs)
File "…/vim/plugged/semshi/rplugin/python3/semshi/handler.py", line 184, in _update_step
code = self._wait_for(lambda: lines_to_code(self._buf[:]), sync)
File "…/vim/plugged/semshi/rplugin/python3/semshi/handler.py", line 118, in _wait_for
"semshi: _wait_for", (func, sync), "".join(traceback.format_stack())
semshi: _wait_for: (<function BufferHandler._update_step.<locals>.<lambda> at 0x7ff5ae1ddaf0>, False)
File "/usr/lib/python3.8/threading.py", line 890, in _bootstrap
self._bootstrap_inner()
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "…/vim/plugged/semshi/rplugin/python3/semshi/handler.py", line 158, in _update_loop
self._update_step()
File "…/vim/plugged/semshi/rplugin/python3/semshi/util.py", line 19, in wrapper
res = func(*args, **kwargs)
File "…/vim/plugged/semshi/rplugin/python3/semshi/handler.py", line 206, in _update_step
cursor = self._wait_for(
File "…/vim/plugged/semshi/rplugin/python3/semshi/handler.py", line 118, in _wait_for
"semshi: _wait_for", (func, sync), "".join(traceback.format_stack())
DBG: [37, 37] (BufWinLeave: abuf: 16, amatch: fugitive://…, winnr():1, ft: python, bt: )
DBG: [37, 37] (BufUnload: abuf: 16, amatch: fugitive://…, winnr():1, ft: python, bt: )
DBG: [37, 37] (BufDelete: abuf: 16, amatch: fugitive://…, winnr():1, ft: python, bt: )
DBG: [37] (WinEnter: abuf: 4, amatch: …foo.py, winnr():1, ft: python, bt: )
Error detected while processing function SemshiBufEnter[1]..remote#define#request:
line 2:
error caught while executing async callback:
NvimError('Invalid window id: 1002')
Traceback (most recent call last):
File "…/vim/plugged/semshi/rplugin/python3/semshi/handler.py", line 124, in wrapper
res = func()
File "…/vim/plugged/semshi/rplugin/python3/semshi/handler.py", line 207, in <lambda>
lambda: self._vim.current.window.cursor, sync
File "/usr/lib/python3.8/site-packages/pynvim/api/window.py", line 22, in cursor
return self.request('nvim_win_get_cursor')
File "/usr/lib/python3.8/site-packages/pynvim/api/common.py", line 58, in request
return self._session.request(name, self, *args, **kwargs)
File "/usr/lib/python3.8/site-packages/pynvim/api/nvim.py", line 182, in request
res = self._session.request(name, *args, **kwargs)
File "/usr/lib/python3.8/site-packages/pynvim/msgpack_rpc/session.py", line 102, in request
raise self.error_wrapper(err)
pynvim.api.common.NvimError: Invalid window id: 1002
the call was requested at
File "…/vim/plugged/semshi/rplugin/python3/semshi/handler.py", line 158, in _update_loop
self._update_step()
File "…/vim/plugged/semshi/rplugin/python3/semshi/util.py", line 19, in wrapper
res = func(*args, **kwargs)
File "…/vim/plugged/semshi/rplugin/python3/semshi/handler.py", line 206, in _update_step
cursor = self._wait_for(
File "…/vim/plugged/semshi/rplugin/python3/semshi/handler.py", line 134, in _wait_for
self._vim.async_call(wrapper)
error while running <function BufferHandler._update_step.<locals>.<lambda> at 0x7ff5ae1ddaf0>: Invalid window id: 1002
Here the handler (0x7ff5ae1ddaf0
) was triggered for BufEnter
of buffer 16, and the error happens after WinEnter
of buffer 4, when buffer 16 was deleted/unloaded already.
I might look into this a bit more later, but it might also make sense to unregister via BufUnload
/BufDelete
, and/or just ignore this kind of expected error.
https://github.com/numirias/semshi/pull/94 should help here / fix this, please give it a try.
Bumping this up with #94! (Actually similar errors can happen somewhere else, such as self._update_step(self._options.always_update_all_highlights)
, etc.)
Consider the following minimal init.vim file:
Now open nvim and, as in the GIF, do:
:e a.py
and add a single line# foo
.:vsp
:lvim foo % | lopen
<Ctrl-w>
mappings)windo if &buftype == 'quickfix' | lclose | endif
After 6. an
invalid window id
error is triggered: