Closed doronbehar closed 4 years ago
The problem is the print
call in BackgroundSocketCreator.run(), as print communicates with vim/nvim, and nvim appears to only allow that from the main thread.
One way to fix the common case would be to not use an Exception when only exiting; however, in the case where an actual Exception might happen, it would still fail at the print and not actually report the exception.
When testing with Vim8, it appears as if the print call is just ignored if it does not happen in the main thread, so it would be the best to remove it altogether (and the second print call that happens in this function), as those would only be ignored in vim and throw an error in nvim, and both have proper logging set up either way.
(As an aside: It is possible to hook up vim.async_call for nvim; however, this then prints a rather ugly and useless "Exception caught" message to the status bar, hence my assumption that this print call should not be there in the first place, and that it is not worth using async_call, which only works with nvim.)
edit: Nevermind, my error was due to other service using port 9000, bound both xdebug
and vdebug
to 9690 instead and it worked. Leaving this comment here in case someone googles the error for the same reason.
Hi. Please confirm it's the same bug and if so, raise the severity, because this happens when I try to run :VdebugStart
:
Request from non-main thread.
Requests from different threads should be wrapped with nvim.async_call(cb, ...)
File "/home/mg/.config/nvim/plugged/vdebug/python3/vdebug/connection.py", line 197, in run
print("Socket is already in use")
File "/home/mg/.local/lib/python3.6/site-packages/pynvim/plugin/script_host.py", line 182, in write
self.redirect_handler(data)
File "/home/mg/.local/lib/python3.6/site-packages/pynvim/plugin/script_host.py", line 75, in <lambda>
sys.stdout = RedirectStream(lambda data: nvim.out_write(data))
File "/home/mg/.local/lib/python3.6/site-packages/pynvim/api/nvim.py", line 396, in out_write
return self.request('nvim_out_write', msg, **kwargs)
Press ENTER or type command to continue
And after pressing enter:
Exception in thread Thread-6:
Traceback (most recent call last):
File "/home/mg/.config/nvim/plugged/vdebug/python3/vdebug/connection.py", line 178, in run
s.bind((self.__host, self.__port))
OSError: [Errno 98] Address already in use
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/home/mg/.config/nvim/plugged/vdebug/python3/vdebug/connection.py", line 197, in run
print("Socket is already in use")
File "/home/mg/.local/lib/python3.6/site-packages/pynvim/plugin/script_host.py", line 182, in write
self.redirect_handler(data)
File "/home/mg/.local/lib/python3.6/site-packages/pynvim/plugin/script_host.py", line 75, in <lambda>
sys.stdout = RedirectStream(lambda data: nvim.out_write(data))
File "/home/mg/.local/lib/python3.6/site-packages/pynvim/api/nvim.py", line 396, in out_write
return self.request('nvim_out_write', msg, **kwargs)
File "/home/mg/.local/lib/python3.6/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
Press ENTER or type command to continue
Side question: how do I downgrade to get it working? Using vim-plug
.
@cprn This is indeed related, since without this error you would have gotten a simple "Socket is already in use" message.
should be fixed with #479
Note that the "Socket is already in use" error message will still trigger the nvim.async_call(cb, ...)
issue on neovim.
Since this is an error case, this is far less severe, especially since the relevant error message will be shown - if buried in stacktrace noise.
I use Komodo's pydbgp in order to debug Python scripts. I get the following harmless error when stopping the debugger:
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.