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

RuntimeError: This event loop is already running #326

Open
blueyed opened this issue Apr 24, 2018 · 13 comments
Open

RuntimeError: This event loop is already running #326

blueyed opened this issue Apr 24, 2018 · 13 comments
Labels

Comments

@blueyed
Copy link
Contributor

blueyed commented Apr 24, 2018

I am seeing a RuntimeError: This event loop is already running when using
`log.exception from deoplete-jedi's server.

This appears to be caused by DeopleteLogFilter.filter using
self.vim.call('deoplete#util#print_error', record.getMessage(), record.name).

Full traceback (the code in deoplete-jedi (from the first exception) is new ):

[deoplete.jedi.client] Caught BrokenPipeError(32, 'Broken pipe') during handling completions
Exception in thread Thread-5:
Traceback (most recent call last):
  File "/home/user/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/server.py", line 560, in completions
    stream_write(self._server.stdin, args)
  File "/home/user/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/server.py", line 109, in stream_write
    pipe.flush()
BrokenPipeError: [Errno 32] Broken pipe

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 "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/user/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/worker.py", line 34, in completion_work
    filename, options)
  File "/home/user/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/server.py", line 563, in completions
    log.exception('Caught %r during handling completions', exc)
  File "/usr/lib/python3.6/logging/__init__.py", line 1341, in exception
    self.error(msg, *args, exc_info=exc_info, **kwargs)
  File "/usr/lib/python3.6/logging/__init__.py", line 1335, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/usr/lib/python3.6/logging/__init__.py", line 1442, in _log
    self.handle(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 1452, in handle
    self.callHandlers(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 1514, in callHandlers
    hdlr.handle(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 859, in handle
    rv = self.filter(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 718, in filter
    result = f.filter(record)
  File "/home/user/.vim/plugged/deoplete.nvim/rplugin/python3/deoplete/logger.py", line 144, in filter
    record.name)
  File "/usr/lib/python3.6/site-packages/neovim/api/nvim.py", line 254, in call
    return self.request('nvim_call_function', name, args, **kwargs)
  File "/usr/lib/python3.6/site-packages/neovim/api/nvim.py", line 140, in request
    res = self._session.request(name, *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/session.py", line 91, in request
    v = self._blocking_request(method, args)
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/session.py", line 169, in _blocking_request
    self._enqueue_notification)
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/async_session.py", line 66, in run
    self._msgpack_stream.run(self._on_message)
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/msgpack_stream.py", line 44, in run
    self.loop.run(self._on_data)
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/event_loop/base.py", line 143, in run
    self._run()
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/event_loop/asyncio.py", line 112, in _run
    self._loop.run_forever()
  File "/usr/lib/python3.6/asyncio/base_events.py", line 409, in run_forever
    raise RuntimeError('This event loop is already running')
RuntimeError: This event loop is already running

Another instance:

[deoplete.jedi.client] Caught BrokenPipeError(32, 'Broken pipe') during handling completions
[deoplete] Traceback (most recent call last):
  File "/home/user/.vim/plugged/deoplete.nvim/rplugin/python3/deoplete/child.py", line 236, in _gather_results
    ctx['candidates'] = source.gather_candidates(ctx)
  File "/home/user/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/profiler.py", line 39, in wrapper
    ret = func(self, *args, **kwargs)
  File "/home/user/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi.py", line 201, in gather_candidates
    cache_key, extra_modules = cache.cache_context(buf.name, context, src,
  File "/usr/lib/python3.6/site-packages/neovim/api/buffer.py", line 116, in name
    return self.request('nvim_buf_get_name')
  File "/usr/lib/python3.6/site-packages/neovim/api/common.py", line 44, in request
    return self._session.request(name, self, *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/neovim/api/nvim.py", line 140, in request
    res = self._session.request(name, *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/session.py", line 91, in request
    v = self._blocking_request(method, args)
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/session.py", line 169, in _blocking_request
    self._enqueue_notification)
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/async_session.py", line 66, in run
    self._msgpack_stream.run(self._on_message)
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/msgpack_stream.py", line 44, in run
    self.loop.run(self._on_data)
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/event_loop/base.py", line 143, in run
    self._run()
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/event_loop/asyncio.py", line 112, in _run
    self._loop.run_forever()
  File "/usr/lib/python3.6/asyncio/base_events.py", line 409, in run_forever
    raise RuntimeError('This event loop is already running')
RuntimeError: This event loop is already running
Error from jedi: RuntimeError('This event loop is already running',).  Use :messages / see above for error details.

Code in cpython: https://github.com/python/cpython/blob/20d68dfcc07bd389ce2ea7b0773c44d97ebeb68d/Lib/asyncio/base_events.py#L507-L508

It appears to be a race, since is_running() only looks at the thread_id, and
not _stopping (which is what stop() sets).

Events:

2018-04-24 18:29:59.639905 asyncio: loop: <_UnixSelectorEventLoop running=False closed=False debug=False> (140257753452784) (pid: 13763)
logging.callHandlers: handle: <LogRecord: deoplete.jedi.client, 40, /home/daniel/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/server.py, 563, "Caught %r during handling completions">: Caught BrokenPipeError(32, 'Broken pipe') during handling completions
2018-04-24 18:29:59.641060 logger: <LogRecord: deoplete.jedi.client, 40, /home/daniel/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/server.py, 563, "Caught %r during handling completions">: Caught BrokenPipeError(32, 'Broken pipe') during handling completions
2018-04-24 18:29:59.641272 asyncio: stopping (pid: 13763)
2018-04-24 18:29:59.641933 asyncio: loop: <_UnixSelectorEventLoop running=True closed=False debug=False> (140257753452784) (pid: 13763)

So neovim stops the loop ("stopping"), but then calls self._loop.run_forever again, since the internal is_running is false, but run_forever will then raise the RuntimeError.

I've tried using self.loop._loop.is_running directly/alone, but then the greenlet parent might be None:

  File "/home/user/.vim/plugged/deoplete.nvim/rplugin/python3/deoplete/logger.py", line 148, in filter
    record.name)
  File "…/Vcs/neovim-python-client/neovim/api/nvim.py", line 252, in call
    return self.request('nvim_call_function', name, args, **kwargs)
  File "…/Vcs/neovim-python-client/neovim/api/nvim.py", line 140, in request
    res = self._session.request(name, *args, **kwargs)
  File "…/Vcs/neovim-python-client/neovim/msgpack_rpc/session.py", line 90, in request
    v = self._yielding_request(method, args)
  File "…/Vcs/neovim-python-client/neovim/msgpack_rpc/session.py", line 157, in _yielding_request
    return parent.switch()
AttributeError: 'NoneType' object has no attribute 'switch'
@blueyed
Copy link
Contributor Author

blueyed commented Apr 24, 2018

Tried the following patch:

diff --git i/neovim/msgpack_rpc/event_loop/asyncio.py w/neovim/msgpack_rpc/event_loop/asyncio.py
index 656f552..5289957 100644
--- i/neovim/msgpack_rpc/event_loop/asyncio.py
+++ w/neovim/msgpack_rpc/event_loop/asyncio.py
@@ -106,12 +106,26 @@ def _start_reading(self):
     def _send(self, data):
         self._transport.write(data)
 
+    def is_running(self):
+        return self._loop.is_running() and not self._loop._stopping
+
     def _run(self):
         while self._queued_data:
             self._on_data(self._queued_data.popleft())

diff --git i/neovim/msgpack_rpc/session.py w/neovim/msgpack_rpc/session.py
index b300f8d..1f93c6f 100644
--- i/neovim/msgpack_rpc/session.py
+++ w/neovim/msgpack_rpc/session.py
@@ -87,7 +87,7 @@ def request(self, method, *args, **kwargs):
             raise ValueError("request got unsupported keyword argument(s): {}"
                              .format(', '.join(kwargs.keys())))
 
-        if self._is_running:
+        if self._is_running and self.loop.is_running():
             v = self._yielding_request(method, args)
         else:
             v = self._blocking_request(method, args)

But that does not fix it. I guess it might miss events, and I've also seen this then:

Exception in thread Thread-5:
Traceback (most recent call last):
  File "/home/user/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/server.py", line 560, in completions
    stream_write(self._server.stdin, args)
  File "/home/user/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/server.py", line 109, in stream_write
    pipe.flush()
BrokenPipeError: [Errno 32] Broken pipe
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 "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/user/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/worker.py", line 34, in completion_work
    filename, options)
  File "/home/user/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/server.py", line 563, in completions
    log.error('Caught %r during handling completions', exc)
  File "/usr/lib/python3.6/logging/__init__.py", line 1335, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/usr/lib/python3.6/logging/__init__.py", line 1442, in _log
    self.handle(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 1452, in handle
    self.callHandlers(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 1517, in callHandlers
    hdlr.handle(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 859, in handle
    rv = self.filter(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 718, in filter
    result = f.filter(record)
  File "/home/user/.vim/plugged/deoplete.nvim/rplugin/python3/deoplete/logger.py", line 148, in filter
    record.name)
  File "…/Vcs/neovim-python-client/neovim/api/nvim.py", line 254, in call
    return self.request('nvim_call_function', name, args, **kwargs)
  File "…/Vcs/neovim-python-client/neovim/api/nvim.py", line 140, in request
    res = self._session.request(name, *args, **kwargs)
  File "…/Vcs/neovim-python-client/neovim/msgpack_rpc/session.py", line 96, in request
    raise IOError('EOF')
OSError: EOF

@bfredl
Copy link
Member

bfredl commented Apr 24, 2018

Hmm, it looks like nvim methods are invoked directly from a separate thread, that is definietly not safe.

@blueyed
Copy link
Contributor Author

blueyed commented Apr 24, 2018

Related? #324 / tweekmonster/deoplete-clang2#30

@blueyed
Copy link
Contributor Author

blueyed commented Jul 5, 2018

@bfredl
Can you provide more insight with regard to your last comment?

@blueyed
Copy link
Contributor Author

blueyed commented Jul 5, 2018

With deoplete-jedi it currently looks like this:

[deoplete.jedi.client] Caught BrokenPipeError(32, 'Broken pipe') during handling completions
[deoplete] Traceback (most recent call last):
  File "/home/user/.vim/plugged/deoplete.nvim/rplugin/python3/deoplete/child.py", line 226, in _gather_results
    ctx['candidates'] = source.gather_candidates(ctx)
  File "/home/user/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/profiler.py", line 39, in wrapper
    ret = func(self, *args, **kwargs)
  File "/home/user/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi.py", line 184, in gather_candidates
    src = getlines(self.vim)
  File "/home/user/.vim/plugged/deoplete.nvim/rplugin/python3/deoplete/util.py", line 220, in getlines
    end = len(vim.current.buffer)
  File "/usr/lib/python3.6/site-packages/neovim/api/nvim.py", line 487, in buffer
    return self._session.request('nvim_get_current_buf')
  File "/usr/lib/python3.6/site-packages/neovim/api/nvim.py", line 170, in request
    res = self._session.request(name, *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/session.py", line 96, in request
    raise IOError('EOF')
OSError: EOF
Error from jedi: OSError('EOF',).  Use :messages / see above for error details.
[deoplete] Traceback (most recent call last):
  File "/home/user/.vim/plugged/deoplete.nvim/rplugin/python3/deoplete/child.py", line 226, in _gather_results
    ctx['candidates'] = source.gather_candidates(ctx)
  File "/home/user/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/profiler.py", line 39, in wrapper
    ret = func(self, *args, **kwargs)
  File "/home/user/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi.py", line 184, in gather_candidates
    src = getlines(self.vim)
  File "/home/user/.vim/plugged/deoplete.nvim/rplugin/python3/deoplete/util.py", line 220, in getlines
    end = len(vim.current.buffer)
  File "/usr/lib/python3.6/site-packages/neovim/api/nvim.py", line 487, in buffer
    return self._session.request('nvim_get_current_buf')
  File "/usr/lib/python3.6/site-packages/neovim/api/nvim.py", line 170, in request
    res = self._session.request(name, *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/session.py", line 96, in request
    raise IOError('EOF')
OSError: EOF

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "…/vim/plugged/deoplete.nvim/rplugin/python3/deoplete/dp_main.py", line 52, in main
    child.main_loop(stdout)
  File "/home/user/.vim/plugged/deoplete.nvim/rplugin/python3/deoplete/child.py", line 67, in main_loop
    ret = self.main(name, args, queue_id)
  File "/home/user/.vim/plugged/deoplete.nvim/rplugin/python3/deoplete/child.py", line 86, in main
    ret = self._merge_results(args[0], queue_id)
  File "/home/user/.vim/plugged/deoplete.nvim/rplugin/python3/deoplete/child.py", line 151, in _merge_results
    results = self._gather_results(context)
  File "/home/user/.vim/plugged/deoplete.nvim/rplugin/python3/deoplete/child.py", line 257, in _gather_results
    error_tb(self._vim, 'Error from %s: %r' % (source.name, exc))
  File "/home/user/.vim/plugged/deoplete.nvim/rplugin/python3/deoplete/util.py", line 98, in error_tb
    vim.err_write('[deoplete] %s\n' % '\n'.join(lines))
  File "/usr/lib/python3.6/site-packages/neovim/api/nvim.py", line 382, in err_write
    return self.request('nvim_err_write', msg, **kwargs)
  File "/usr/lib/python3.6/site-packages/neovim/api/nvim.py", line 170, in request
    res = self._session.request(name, *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/session.py", line 96, in request
    raise IOError('EOF')
OSError: EOF
Error in child: OSError('EOF',).  Use :messages / see above for error details.
Exception in thread Thread-5:
Traceback (most recent call last):
  File "/home/user/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/server.py", line 571, in completions
    stream_write(self._server.stdin, args)
  File "/home/user/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/server.py", line 112, in stream_write
    pipe.flush()
BrokenPipeError: [Errno 32] Broken pipe

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 "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/user/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/worker.py", line 34, in completion_work
    filename, options)
  File "/home/user/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/server.py", line 574, in completions
    log.error('Caught %r during handling completions', exc)
  File "/usr/lib/python3.6/logging/__init__.py", line 1335, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/usr/lib/python3.6/logging/__init__.py", line 1442, in _log
    self.handle(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 1452, in handle
    self.callHandlers(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 1514, in callHandlers
    hdlr.handle(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 859, in handle
    rv = self.filter(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 718, in filter
    result = f.filter(record)
  File "/home/user/.vim/plugged/deoplete.nvim/rplugin/python3/deoplete/logger.py", line 144, in filter
    record.name)
  File "/usr/lib/python3.6/site-packages/neovim/api/nvim.py", line 284, in call
    return self.request('nvim_call_function', name, args, **kwargs)
  File "/usr/lib/python3.6/site-packages/neovim/api/nvim.py", line 170, in request
    res = self._session.request(name, *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/session.py", line 93, in request
    v = self._blocking_request(method, args)
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/session.py", line 171, in _blocking_request
    self._enqueue_notification)
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/async_session.py", line 66, in run
    self._msgpack_stream.run(self._on_message)
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/msgpack_stream.py", line 44, in run
    self.loop.run(self._on_data)
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/event_loop/base.py", line 143, in run
    self._run()
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/event_loop/asyncio.py", line 112, in _run
    self._loop.run_forever()
  File "/usr/lib/python3.6/asyncio/base_events.py", line 409, in run_forever
    raise RuntimeError('This event loop is already running')
RuntimeError: This event loop is already running
Unhandled exception in thread started by <bound method Thread._bootstrap of <Thread(Thread-5, started daemon 140536899958528)>>
Traceback (most recent call last):


During handling of the above exception, another exception occurred:



During handling of the above exception, another exception occurred:


Traceback (most recent call last):


During handling of the above exception, another exception occurred:



During handling of the above exception, another exception occurred:

@bfredl
Copy link
Member

bfredl commented Jul 5, 2018

Can you provide more insight with regard to your last comment?

I don't think I can. Deoplete doesn't use threading anymore.

@blueyed
Copy link
Contributor Author

blueyed commented Jul 5, 2018

deoplete-jedi does though.

It basically can be triggered by using deoplete's logger from the thread.

deoplete's logger has a filter to call into Neovim via deoplete#util#print_error then for errors:

[deoplete.jedi.worker.Thread-1] Worker error
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/home/user/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/worker.py", line 68, in run
    if t._exc is not None:
AttributeError: 'Thread' object has no attribute '_exc'
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/user/.vim/plugged/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/worker.py", line 89, in run
    self.log.exception('Worker error')
  File "/usr/lib/python3.6/logging/__init__.py", line 1341, in exception
    self.error(msg, *args, exc_info=exc_info, **kwargs)
  File "/usr/lib/python3.6/logging/__init__.py", line 1335, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/usr/lib/python3.6/logging/__init__.py", line 1442, in _log
    self.handle(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 1452, in handle
    self.callHandlers(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 1514, in callHandlers
    hdlr.handle(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 859, in handle
    rv = self.filter(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 718, in filter
    result = f.filter(record)
  File "/home/user/.vim/plugged/deoplete.nvim/rplugin/python3/deoplete/logger.py", line 144, in filter
    record.name)
  File "/usr/lib/python3.6/site-packages/neovim/api/nvim.py", line 284, in call
    return self.request('nvim_call_function', name, args, **kwargs)
  File "/usr/lib/python3.6/site-packages/neovim/api/nvim.py", line 170, in request
    res = self._session.request(name, *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/session.py", line 93, in request
    v = self._blocking_request(method, args)
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/session.py", line 171, in _blocking_request
    self._enqueue_notification)
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/async_session.py", line 66, in run
    self._msgpack_stream.run(self._on_message)
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/msgpack_stream.py", line 44, in run
    self.loop.run(self._on_data)
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/event_loop/base.py", line 143, in run
    self._run()
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/event_loop/asyncio.py", line 112, in _run
    self._loop.run_forever()
  File "/usr/lib/python3.6/asyncio/base_events.py", line 409, in run_forever
    raise RuntimeError('This event loop is already running')
RuntimeError: This event loop is already running
Unhandled exception in thread started by <bound method Thread._bootstrap of <Worker(Thread-1, started 139779458807552)>>

@blueyed
Copy link
Contributor Author

blueyed commented Jul 5, 2018

I wonder if deoplete-jedi should also switch to using asyncio instead of threads, but that might not be trivial. /cc @Shougo

@blueyed
Copy link
Contributor Author

blueyed commented Jul 5, 2018

As for deoplete-jedi I will change it to get the exceptions from the threads into the caller, and then logging should happen from there.

@Shougo
Copy link
Contributor

Shougo commented Jul 6, 2018

I wonder if deoplete-jedi should also switch to using asyncio instead of threads, but that might not be trivial. /cc @Shougo

Hm. If possible.

@justinmk
Copy link
Member

justinmk commented Jul 6, 2018

Can we close this? Can someone suggest a small documentation update?

@blueyed
Copy link
Contributor Author

blueyed commented Jul 6, 2018

What would be a documentation update?
Mentioning that remote calls cannot be made from threads?!
(the problem is not really clear to me)

@blueyed
Copy link
Contributor Author

blueyed commented Jul 6, 2018

This is what I've done for deoplete-jedi: deoplete-plugins/deoplete-jedi#178 - it stores exceptions in the threads, and collects them for non-alive threads then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants