pynvim
pynvim copied to clipboard
`nvim.next_message` returns None without EOF
// cc @rafaeln
Recently I changed the event loop style into nvim.next_message in order to simplify the async architecture and avoid concurrent issue. But somehow the nvim.next_message returns None unexpectedly which cause the loop to exit.
This issue is reproduced by @rafaeln and here's the log files with DEBUG LEVEL:
https://www.dropbox.com/sh/cq41u8afyop4yth/AABwC1bmBLNWzgRk2JgA2WLXa?dl=0
Here's the interesting part I've extracted:
2017-03-03 11:15:14,512 [DEBUG @ base.py:run:138] 6073 - Entering event loop
2017-03-03 11:15:14,512 [DEBUG @ base.py:run:140] 6073 - Exited event loop
2017-03-03 11:15:14,512 [ERROR @ cm_start.py:run_event_loop:167] 6073 - Error processing notification <['notification', 'cm_complete_timeout', [{'cm-keyword-continue': {'channel': {'id': 6, 'module': 'cm_sources.cm_keyword_continue', 'type': 'python3', 'events': []}, 'word_pattern': '\\S+', 'abbreviation': '', 'cm_refresh_patterns': ['\\s+$', '^$'], 'priority': 4, 'enable': True, 'early_cache': 1, 'sort': 0, 'name': 'cm-keyword-continue', 'cm_refresh_min_word_len': 4}, 'cm-gocode': {'name': 'cm-gocode', 'scopes': ['go'], 'channel': {'module': 'cm_sources.cm_gocode', 'type': 'python3', 'events': []}, 'abbreviation': 'Go', 'cm_refresh_patterns': ['\\.(\\w*)$'], 'priority': 9, 'enable': True, 'early_cache': 1, 'sort': 1, 'scoping': True, 'cm_refresh_min_word_len': 3}, 'cm-bufkeyword': {'channel': {'id': 3, 'module': 'cm_sources.cm_bufkeyword', 'type': 'python3', 'events': ['CursorHold', 'CursorHoldI', 'BufEnter', 'BufWritePost', 'TextChangedI']}, 'abbreviation': 'Key', 'priority': 5, 'enable': True, 'early_cache': 1, 'sort': 1, 'name': 'cm-bufkeyword', 'cm_refresh_min_word_len': 4}, 'cm-ultisnips': {'cm_refresh': 'cm#sources#ultisnips#cm_refresh', 'abbreviation': 'Snip', 'priority': 7, 'word_pattern': '\\S+', 'enable': 1, 'early_cache': 0, 'sort': 1, 'name': 'cm-ultisnips', 'cm_refresh_min_word_len': 3}, 'cm-tags': {'channel': {'id': 4, 'module': 'cm_sources.cm_tags', 'type': 'python3', 'events': ['WinEnter']}, 'abbreviation': 'Tag', 'priority': 6, 'enable': True, 'early_cache': 1, 'sort': 1, 'name': 'cm-tags', 'cm_refresh_min_word_len': 4}, 'cm-filepath': {'channel': {'id': 5, 'module': 'cm_sources.cm_filepath', 'type': 'python3', 'events': []}, 'abbreviation': 'path', 'cm_refresh_patterns': ['[0-9a-zA-Z_\\-\\.\\\\\\/~\\$]{4,}$', '(\\.[\\/\\\\]|[a-zA-Z]:\\\\|~\\/)[0-9a-zA-Z_\\-\\.\\\\\\/~\\$]*$'], 'priority': 6, 'enable': True, 'early_cache': 1, 'sort': 1, 'name': 'cm-filepath', 'cm_refresh_min_word_len': 4}, 'cm-tmux': {'channel': {'id': 7, 'module': 'cm_sources.cm_tmux', 'type': 'python3', 'events': ['CursorHold', 'CursorHoldI', 'FocusGained', 'BufEnter']}, 'abbreviation': 'Tmux', 'priority': 4, 'enable': True, 'early_cache': 1, 'sort': 1, 'name': 'cm-tmux', 'cm_refresh_min_word_len': 4}, 'cm-jedi': {'name': 'cm-jedi', 'scopes': ['python'], 'channel': {'module': 'cm_sources.cm_jedi', 'type': 'python3', 'events': []}, 'abbreviation': 'Py', 'cm_refresh_patterns': ['^(import|from).*?\\s(\\w*)$', '\\.\\w*$', '\\(\\s?(\\w*)$', ',\\s?(\\w*)$'], 'priority': 9, 'enable': True, 'early_cache': 1, 'sort': 1, 'scoping': True, 'cm_refresh_min_word_len': 3}, 'cm-css': {'name': 'cm-css', 'scopes': ['css', 'scss'], 'cm_refresh': {'omnifunc': 'csscomplete#CompleteCSS'}, 'abbreviation': 'css', 'cm_refresh_patterns': [':\\s+\\w*$'], 'priority': 9, 'enable': 1, 'early_cache': 0, 'sort': 1, 'scoping': 1, 'cm_refresh_min_word_len': 3}}, {'force': 0, 'lnum': 3, 'filetype': 'text', 'bufnr': 1, 'scope': 'text', 'filepath': '/home/rafael/test.txt', 'typed': 'some', 'col': 5, 'changedtick': 7, 'curpos': [0, 3, 5, 0, 5]}]]>, msg:
Traceback (most recent call last):
File "/home/rafael/.config/nvim/bundle/nvim-completion-manager/pythonx/cm_start.py", line 165, in run_event_loop
on_notification(method,msg[2])
File "/home/rafael/.config/nvim/bundle/nvim-completion-manager/pythonx/cm_start.py", line 145, in on_notification
func(*args)
File "/home/rafael/Dropbox/dotfiles/.vim/bundle/nvim-completion-manager/pythonx/cm_core.py", line 215, in cm_complete_timeout
self._refresh_completions(ctx)
File "/home/rafael/Dropbox/dotfiles/.vim/bundle/nvim-completion-manager/pythonx/cm_core.py", line 481, in _refresh_completions
self._complete(ctx, startcol, matches)
File "/home/rafael/Dropbox/dotfiles/.vim/bundle/nvim-completion-manager/pythonx/cm_core.py", line 531, in _complete
self._nvim.call('cm#_core_complete', ctx, startcol, matches, not_changed)
File "/usr/local/lib/python3.4/dist-packages/neovim/api/nvim.py", line 230, in call
return self.request('nvim_call_function', name, args, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/neovim/api/nvim.py", line 131, in request
res = self._session.request(name, *args, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/neovim/msgpack_rpc/session.py", line 94, in request
raise IOError('EOF')
OSError: EOF
2017-03-03 11:15:14,513 [DEBUG @ base.py:run:138] 6073 - Entering event loop
2017-03-03 11:15:14,513 [DEBUG @ msgpack_stream.py:_on_data:54] 6073 - waiting for message...
2017-03-03 11:15:14,513 [DEBUG @ msgpack_stream.py:_on_data:56] 6073 - received message: [1, 21, None, 0]
2017-03-03 11:15:14,513 [DEBUG @ async_session.py:_on_response:95] 6073 - received response: None, 0
2017-03-03 11:15:14,513 [DEBUG @ base.py:stop:149] 6073 - Stopped event loop
2017-03-03 11:15:14,513 [DEBUG @ msgpack_stream.py:_on_data:54] 6073 - waiting for message...
2017-03-03 11:15:14,513 [DEBUG @ msgpack_stream.py:_on_data:59] 6073 - unpacker needs more data...
2017-03-03 11:15:14,513 [DEBUG @ base.py:run:140] 6073 - Exited event loop
2017-03-03 11:15:14,513 [INFO @ cm_start.py:run_event_loop:158] 6073 - received falsy value[None], exitting
There's an EOF exception inside session.py when nvim-completion-manager process is trying to self._nvim.call('cm#_core_complete', ctx, startcol, matches, not_changed)
The interesting part is the received message: [1, 21, None, 0] after the EOF, which seems to be the response of previous neovim function call. I'm not sure whether I'm using this library the right way, but IMO this implies that the EOF is not a correct message.