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

Python process get defunct for seconds when restarted inside #56

Closed
ysolis opened this issue Sep 9, 2016 · 15 comments
Closed

Python process get defunct for seconds when restarted inside #56

ysolis opened this issue Sep 9, 2016 · 15 comments

Comments

@ysolis
Copy link

ysolis commented Sep 9, 2016

Problems summary

I am using NeoVim 1.5 and use this when i do python programming. The python process invoked for deoplete-jedi get defunct, Deoplete continue to work but i don't get any suggestion for python autocomplete almost all the times for several seconds.

Expected

The python autocomplete must continue normally.

Environment Information

  • OS: Ubuntu 16.04 LTS
  • Neovim version: neovim 0.1.5ubuntu1+git201609060743+27 from NeoVim PPA.

Provide a minimal init.vim with less than 50 lines (Required!)

" Your minimal init.vim
set runtimepath+=~/tmp/deoplete.nvim/
set runtimepath+=~/tmp/deoplete-jedi/
let g:deoplete#enable_at_startup = 1
set completeopt=menu,preview

The reproduce ways from neovim starting (Required!)

  1. configure vim with option

    set completeopt=menu,preview

  2. edit your code and wait that a preview window appear
  3. check your process (pgrep -af python) you can find that the python process using jedi, invoked from deoplete is in defunct state
@Shougo
Copy link
Collaborator

Shougo commented Sep 10, 2016

I cannot reproduce the problem.

@ysolis
Copy link
Author

ysolis commented Sep 11, 2016

how is restarted the python process in deoplete-jedi ?

@ysolis
Copy link
Author

ysolis commented Sep 20, 2016

I check again the process. The python process launched for deoplete-jedi get in zombie mode, and after this get killed and a new process is created. So I assume that is restarted the process. But take some time to get completed the restart process. We can close this but we need to set an option to define how is restarted deoplete-jedi.

@zchee
Copy link
Member

zchee commented Sep 20, 2016

@ysolis sorry late reply. and thanks information.
Yes, maybe deoplete-jedi daemon have a bug.
I understand half, will read and understand tomorrow(now Japan is AM 4:30)
But it might be good information. Thanks.

@blueyed
Copy link
Collaborator

blueyed commented Sep 20, 2016

@ysolis
Maybe you can produce a log with more info?!

call deoplete#custom#set('jedi', 'debug_enabled', 1)
call deoplete#enable_logging('DEBUG', '/tmp/deoplete.log')

Also try export NVIM_PYTHON_LOG_FILE=/tmp/nvim-python-log NVIM_PYTHON_LOG_LEVEL=DEBUG before starting Neovim.

@zchee
Copy link
Member

zchee commented Sep 20, 2016

@blueyed Thanks. You're right.

@blueyed
Copy link
Collaborator

blueyed commented Sep 20, 2016

@zchee
Not sure about the method, but were just using this myself to debug Shougo/deoplete.nvim#336. (I/we should / will create a separate issue for that.)
See #60 for an improved issue template.

@ysolis
Copy link
Author

ysolis commented Sep 21, 2016

https://gist.github.com/ysolis/9af49c1e2afa7c8e873719e0418f11ad

log uploaded and attached

@blueyed
Copy link
Collaborator

blueyed commented Sep 21, 2016

Thanks!

Relevant part where it starts to misbehave:

2016-09-21 09:07:54,149 DEBUG    (deoplete.jedi.Thread-1) Worker error
Traceback (most recent call last):
  File "/home/yonsy/.config/nvim/dein/repos/github.com/zchee/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/worker.py", line 67, in run
    self.out_queue.put(self.completion_work(*work), block=False)
  File "/home/yonsy/.config/nvim/dein/repos/github.com/zchee/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/worker.py", line 34, in completion_work
    filename)
  File "/home/yonsy/.config/nvim/dein/repos/github.com/zchee/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/server.py", line 532, in completions
    return stream_read(self._server.stdout)
  File "/home/yonsy/.config/nvim/dein/repos/github.com/zchee/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/server.py", line 83, in stream_read
    raise StreamEmpty
deoplete_jedi.server.StreamEmpty
2016-09-21 09:07:57,698 DEBUG    (deoplete.jedi.cache) Input: "i"
2016-09-21 09:07:57,699 DEBUG    (deoplete.jedi) Key: ('add4d4c65ffb2275f5a0bfdc9c72543b', ('views', 'unique'), 'vars'), Refresh: True, Wait: False
2016-09-21 09:07:57,701 INFO     (deoplete.jedi) �[34mgather_candidates�[m t = �[32m6.441123�[mms, µ = �[39m16.541704�[mms, σ = �[39m23.852977�[mms)
2016-09-21 09:07:57,707 DEBUG    (deoplete.jedi.Thread-1) Got work
2016-09-21 09:07:57,708 DEBUG    (deoplete.jedi.Thread-1) Worker error
Traceback (most recent call last):
  File "/home/yonsy/.config/nvim/dein/repos/github.com/zchee/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/worker.py", line 67, in run
    self.out_queue.put(self.completion_work(*work), block=False)
  File "/home/yonsy/.config/nvim/dein/repos/github.com/zchee/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/worker.py", line 34, in completion_work
    filename)
  File "/home/yonsy/.config/nvim/dein/repos/github.com/zchee/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/server.py", line 531, in completions
    stream_write(self._server.stdin, args)
  File "/home/yonsy/.config/nvim/dein/repos/github.com/zchee/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/server.py", line 101, in stream_write
    pipe.flush()
BrokenPipeError: [Errno 32] Broken pipe

The StreamEmpty gets raised in stream_read (called in Client.completions): https://github.com/zchee/deoplete-jedi/blob/ba6c29144f69ede846ebc3a7e4000eed5f5a76a6/rplugin/python3/deoplete/sources/deoplete_jedi/server.py#L532.

It is not caught there, like it's done in the Server's _loop.

@ysolis
Can you try #65, please?

Can you reliably trigger the crash?

You wrote:

edit your code and wait that a preview window appear

For me it does not crash the Python process, but that might be related to the code/preview?

Can you provide a small snippet to reproduce it, too?

(Looking at that made me find the fix for #61: #63 (AFAICS).)

blueyed added a commit to blueyed/deoplete-jedi that referenced this issue Sep 22, 2016
@ysolis
Copy link
Author

ysolis commented Sep 22, 2016

@blueyed the preview window is not relevant, i think that was the initial case but no, the problem happens with or without preview window.

@blueyed
Copy link
Collaborator

blueyed commented Sep 22, 2016

@ysolis
So how do you trigger the crash then?
Have you tried #65?

@ysolis
Copy link
Author

ysolis commented Sep 22, 2016

i do a pgrep python when i invoke neovim, i can see the python process called for deoplete and deoplete-jedi. After some time i can check the pid for the python process called by deoplete-jedi and i see that is in zombie mode (defunct) after some minutes get restarted.

i will try #65 in one hour.

@blueyed
Copy link
Collaborator

blueyed commented Sep 22, 2016

After some time i can check the pid for the python process called by deoplete-jedi and i see that is in zombie mode (defunct)

It would be useful to have the debug log(s) when this happens. With #65 there should be a bit more logging for example.

@ysolis
Copy link
Author

ysolis commented Sep 23, 2016

#65 tried ... and the python process that is launched from deoplete-jedi don't go to zombie and defunct in the restart, get restarted without any problem

check my pgrep report:

(analysis) ~/devops/analysis   master  pgrep -af python
22347 /usr/bin/python3.5 -c import sys; sys.path.remove(""); import neovim; neovim.start_host() /home/yonsy/.config/nvim/dein/.dein/rplugin/python3/deoplete
22461 /home/yonsy/.pyenv/versions/pypy2-5.4.1/envs/analysis/bin/python -u /home/yonsy/.config/nvim/dein/repos/github.com/blueyed/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/server.py --desc-length 0
(analysis) ~/devops/analysis   master  pgrep -af python
22347 /usr/bin/python3.5 -c import sys; sys.path.remove(""); import neovim; neovim.start_host() /home/yonsy/.config/nvim/dein/.dein/rplugin/python3/deoplete
24248 /home/yonsy/.pyenv/versions/pypy2-5.4.1/envs/analysis/bin/python -u /home/yonsy/.config/nvim/dein/repos/github.com/blueyed/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/server.py --desc-length 0
(analysis) ~/devops/analysis   master 

the first one was when i open a *.py file. the second one was after i edit the same file and add some python code in few minutes. Previously the python process invoked for deoplete-jedi get defunct before get restarted, and in this time the plugin don't work (no python completion, only name completion). With #65 the process get restarted and the edition and python completion don't get affected, work flawlessly.

@ysolis
Copy link
Author

ysolis commented Sep 23, 2016

@ysolis ysolis changed the title Python process get defunct if I have enabled preview in completeopt Python process get defunct for seconds when restarted inside Sep 25, 2016
blueyed added a commit to blueyed/deoplete-jedi that referenced this issue Oct 4, 2016
tweekmonster pushed a commit that referenced this issue Oct 13, 2016
blueyed added a commit to blueyed/deoplete-jedi that referenced this issue Feb 6, 2019
Update submodule rplugin/python3/deoplete/vendored/parso a2b153e...f1ee761

    * rplugin/python3/deoplete/vendored/parso a2b153e...f1ee761 (6):
      > Release of 0.3.3
      > Rename a test
      > Remove some unused code
      > Fix working with async functions in the diff parser, fixes deoplete-plugins#56
      > Fix bytes/fstring mixing when using iter_errors, fixes deoplete-plugins#57.
      > Improve a docstring, fixes deoplete-plugins#55.
blueyed added a commit that referenced this issue Feb 6, 2019
Update submodule rplugin/python3/deoplete/vendored/parso a2b153e...f1ee761

    * rplugin/python3/deoplete/vendored/parso a2b153e...f1ee761 (6):
      > Release of 0.3.3
      > Rename a test
      > Remove some unused code
      > Fix working with async functions in the diff parser, fixes #56
      > Fix bytes/fstring mixing when using iter_errors, fixes #57.
      > Improve a docstring, fixes #55.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants