mhinz / neovim-remote

:ok_hand: Support for --remote and friends.
MIT License
1.75k stars 83 forks source link

nvr --serverlist throws ProcessLookupError: No such process #126

Closed IceCreamWW closed 4 years ago

IceCreamWW commented 4 years ago

Everything works great except when I tried to reproduce the demo. I'm using python 3.7.4 on a mac

In one shell

  1. I typed NVIM_LISTEN_ADDRESS=/tmp/nvimsocket nvim
  2. :echo v:servername gives /tmp/nvimsocket

In another shell

  1. nvr --remote file1 file2 works as expected
  2. nvr --remote-send 'iabc<esc>' works as expected
  3. nvr --remote-expr 'bufname("")' gives /Users/icecreamww/file2
  4. nvr --serverlist gives some error

I'm using this plugin to backward search latex in pdf. Everything I need works great. I'm just confused why nvr --serverlist doesn't work

nvr --serverlist error messages are as follow:

Traceback (most recent call last): File "/Users/icecreamww/opt/anaconda3/lib/python3.7/site-packages/psutil/_psosx.py", line 359, in catch_zombie yield File "/Users/icecreamww/opt/anaconda3/lib/python3.7/site-packages/psutil/_psosx.py", line 425, in cmdline return cext.proc_cmdline(self.pid) ProcessLookupError: [Errno 3] No such process

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/icecreamww/opt/anaconda3/bin/nvr", line 10, in sys.exit(main()) File "/Users/icecreamww/opt/anaconda3/lib/python3.7/site-packages/nvr/nvr.py", line 398, in main print_sockaddrs() File "/Users/icecreamww/opt/anaconda3/lib/python3.7/site-packages/nvr/nvr.py", line 362, in print_sockaddrs if proc.name() == 'nvim': File "/Users/icecreamww/opt/anaconda3/lib/python3.7/site-packages/psutil/init.py", line 737, in name cmdline = self.cmdline() File "/Users/icecreamww/opt/anaconda3/lib/python3.7/site-packages/psutil/init.py", line 790, in cmdline return self._proc.cmdline() File "/Users/icecreamww/opt/anaconda3/lib/python3.7/site-packages/psutil/_psosx.py", line 339, in wrapper return fun(self, *args, **kwargs) File "/Users/icecreamww/opt/anaconda3/lib/python3.7/site-packages/psutil/_psosx.py", line 425, in cmdline return cext.proc_cmdline(self.pid) File "/Users/icecreamww/opt/anaconda3/lib/python3.7/contextlib.py", line 130, in exit self.gen.throw(type, value, traceback) File "/Users/icecreamww/opt/anaconda3/lib/python3.7/site-packages/psutil/_psosx.py", line 370, in catch_zombie raise ZombieProcess(proc.pid, proc._name, proc._ppid) psutil.ZombieProcess: psutil.ZombieProcess process still exists but it's a zombie (pid=9180)

mhinz commented 4 years ago
psutil.ZombieProcess: psutil.ZombieProcess process still exists but it's a zombie (pid=9180)

This looks suspicious. I can't reproduce it with Python 3 from Homebrew, though. The psutil package had quite some problems with ZombieProcess in the past: https://github.com/giampaolo/psutil/search?q=ZombieProcess&type=Issues

I get that Anaconda is an entire environment, so for the sake of being stable, maybe they ship an outdated psutil package?

When you start a Python REPL using Anaconda, do this:

import pkg_resources
pkg_resources.require('psutil')

The output for my system is:

[psutil 5.6.5 (/usr/local/lib/python3.7/site-packages)]
IceCreamWW commented 4 years ago

My output is

[psutil 5.6.3 (/Users/icecreamww/opt/anaconda3/lib/python3.7/site-packages)]

And conda update psutil says:

Updating psutil is constricted by
anaconda -> requires psutil==5.6.3=py37h1de35cc_0

Seems OK :(

mhinz commented 4 years ago

Try this with a few nvim processes running:

python3 -c 'import psutil; [print(f"{p.name()}: {p.status()}") for p in psutil.process_iter() if p.name() == "nvim"]'

Does this throw an error as well or are all nvim processes shown as "running"?

IceCreamWW commented 4 years ago

I think you got it, it is caused by a zombie process which does not have a 'name'. I made a pull request which worked for me. Please check it :)