Repository: vim-vdebug/vdebug

Issue #426: Requests from different threads should be wrapped with nvim.async_call(cb, ...)
Created: 2019-09-20T12:17:10Z
I use Komodo's pydbgp in order to debug Python scripts. I get the following harmless error when stopping the debugger:
Request from non-main thread.
Requests from different threads should be wrapped with nvim.async_call(cb, ...)
  File "/home/doron/.config/nvim/pack/functional/start/vdebug/python3/vdebug/connection.py", line 199, in run
    print("Exception caught")
  File "/nix/store/as3nq2kzs8l9jsmhisq1l97rdbchzngg-python3-3.7.4-env/lib/python3.7/site-packages/pynvim/plugin/script_host.py", line 182, in write
    self.redirect_handler(data)
  File "/nix/store/as3nq2kzs8l9jsmhisq1l97rdbchzngg-python3-3.7.4-env/lib/python3.7/site-packages/pynvim/plugin/script_host.py", line 75, in <lambda>
    sys.stdout = RedirectStream(lambda data: nvim.out_write(data))
  File "/nix/store/as3nq2kzs8l9jsmhisq1l97rdbchzngg-python3-3.7.4-env/lib/python3.7/site-packages/pynvim/api/nvim.py", line 393, in out_write
    return self.request('nvim_out_write', msg, **kwargs)
Exception in thread Thread-7:
Traceback (most recent call last):
  File "/home/doron/.config/nvim/pack/functional/start/vdebug/python3/vdebug/connection.py", line 183, in run
    self.__peek_for_exit()
  File "/home/doron/.config/nvim/pack/functional/start/vdebug/python3/vdebug/connection.py", line 209, in __peek_for_exit
    self.__check_exit(self.__message_q.get_nowait())
  File "/home/doron/.config/nvim/pack/functional/start/vdebug/python3/vdebug/connection.py", line 216, in __check_exit
    raise Exception("Exiting")
Exception: Exiting
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/nix/store/zjzq4qp81z8qnnnchnkycmsq0impw173-python3-3.7.4/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/home/doron/.config/nvim/pack/functional/start/vdebug/python3/vdebug/connection.py", line 199, in run
    print("Exception caught")
  File "/nix/store/as3nq2kzs8l9jsmhisq1l97rdbchzngg-python3-3.7.4-env/lib/python3.7/site-packages/pynvim/plugin/script_host.py", line 182, in write
    self.redirect_handler(data)
  File "/nix/store/as3nq2kzs8l9jsmhisq1l97rdbchzngg-python3-3.7.4-env/lib/python3.7/site-packages/pynvim/plugin/script_host.py", line 75, in <lambda>
    sys.stdout = RedirectStream(lambda data: nvim.out_write(data))
  File "/nix/store/as3nq2kzs8l9jsmhisq1l97rdbchzngg-python3-3.7.4-env/lib/python3.7/site-packages/pynvim/api/nvim.py", line 393, in out_write
    return self.request('nvim_out_write', msg, **kwargs)
  File "/nix/store/as3nq2kzs8l9jsmhisq1l97rdbchzngg-python3-3.7.4-env/lib/python3.7/site-packages/pynvim/api/nvim.py", line 178, in request
    raise NvimError("request from non-main thread")
pynvim.api.nvim.NvimError: request from non-main thread
Vdebug stopped waiting for a connection

Not sure if it's easily fixable but I hope my report is useful.
EDIT: Thanks for creating this Vim Plugin BTW :) It seems very promising and much better then the very few alternatives.

Duplicate issue #453: Neovim: error when closing the connection
Created: 2020-04-24T18:36:05Z
Request from non-main thread.
Requests from different threads should be wrapped with nvim.async_call(cb, ...)
  File "/home/user/.vim/pack/bundle/opt/vdebug/python3/vdebug/connection.py", line 199, in run
    print("Exception caught")
  File "/home/user/.local/lib/python3.8/site-packages/pynvim/plugin/script_host.py", line 186, in write
    self.redirect_handler(data)
  File "/home/user/.local/lib/python3.8/site-packages/pynvim/plugin/script_host.py", line 77, in <lambda>
    sys.stdout = RedirectStream(lambda data: nvim.out_write(data))
  File "/home/user/.local/lib/python3.8/site-packages/pynvim/api/nvim.py", line 396, in out_write
    return self.request('nvim_out_write', msg, **kwargs)
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/home/user/.vim/pack/bundle/opt/vdebug/python3/vdebug/connection.py", line 183, in run
    self.__peek_for_exit()
  File "/home/user/.vim/pack/bundle/opt/vdebug/python3/vdebug/connection.py", line 209, in __peek_for_exit
    self.__check_exit(self.__message_q.get_nowait())
  File "/home/user/.vim/pack/bundle/opt/vdebug/python3/vdebug/connection.py", line 216, in __check_exit
    raise Exception("Exiting")
Exception: Exiting
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/home/user/.vim/pack/bundle/opt/vdebug/python3/vdebug/connection.py", line 199, in run
    print("Exception caught")
  File "/home/user/.local/lib/python3.8/site-packages/pynvim/plugin/script_host.py", line 186, in write
    self.redirect_handler(data)
  File "/home/user/.local/lib/python3.8/site-packages/pynvim/plugin/script_host.py", line 77, in <lambda>
    sys.stdout = RedirectStream(lambda data: nvim.out_write(data))
  File "/home/user/.local/lib/python3.8/site-packages/pynvim/api/nvim.py", line 396, in out_write
    return self.request('nvim_out_write', msg, **kwargs)
  File "/home/user/.local/lib/python3.8/site-packages/pynvim/api/nvim.py", line 178, in request
    raise NvimError("request from non-main thread")
pynvim.api.common.NvimError: request from non-main thread
Vdebug stopped waiting for a connection
Press ENTER or type command to continue

Closing comment (2020-05-07T14:55:55Z): This is a duplicate of #426 .