vim-denops / denops.vim

🐜 An ecosystem of Vim/Neovim which allows developers to write cross-platform plugins in Deno
https://vim-denops.github.io/denops-documentation/
MIT License
682 stars 36 forks source link

Failing to connect to denops server #192

Closed lukelbd closed 1 year ago

lukelbd commented 2 years ago

Recently I keep getting [denops] Failed to connect denops server: Failed to connect 127.0.0.1:port error messages and autocomplete stops working. Here's the full message after :let g:denops#debug = 1 | call denops#server#restart():

[denops] Server spawned: ['deno', 'run', '-q', '--no-check', '--unstable', '-A', '/Users/ldavis/dotfiles/.vim
/plugged/denops.vim/denops/@denops-private/cli.ts', '--mode=vim']
[denops] DenopsStarted
[denops] Connecting to `127.0.0.1:53944`
[denops] Failed to connect denops server: Failed to connect `127.0.0.1:53944`
[denops] Server stopped: -1
[denops] DenopsStopped

I tried switching from deno 1.17.0 to the latest version 1.22.0 but this did nothing. I'm using macOS 12.4 (Monterey). I've also updated to the latest version of denops.vim with :PlugUpdate and the latest version of vim: 8.2.3901.

Anything else I can do to try to debug this? I tried manually running the command deno run -q --no-check --unstable -A /Users/ldavis/dotfiles/.vim/plugged/denops.vim/denops/@denops-private/cli.ts --mode=vim and it seems to work fine... for some reason vim is just unable to connect with ch_open... it's really strange.

lambdalisue commented 2 years ago

Colud you try if you can use denops on Neovim instead of Vim? I'd like to clarify that if the problem is Vim's recent change or not.

lukelbd commented 2 years ago

Sorry I only use vim not neovim... not sure how to install denops in neovim?

I tried downgrading to vim 8.2.3582, and I tried commenting out all vim-plug lines except Plug 'vim-denops/denops.vim', but these did not work. Maybe there's something else I can restart/reinstall? Could try restarting the laptop.

Shougo commented 2 years ago

Hm. The port may be blocked by security. Can you check it in another machine or VM?

And deno is running?

Shougo commented 2 years ago

I have tested ddc.vim with Vim latest version. It works for me.

Shougo commented 2 years ago

Sorry I only use vim not neovim... not sure how to install denops in neovim?

Please install neovim from source and use denops without extra config.

lukelbd commented 2 years ago

I didn't test in neovim but simply restarting my macbook solved the problem. Still not sure why it happened... but hopefully this thread will be useful for someone else.

dwolfhub commented 2 years ago

restarting my macbook solved the problem

I had to do this as well after installing deno and plugins

Shougo commented 2 years ago

I think the port is used or blocked by other applications.

stevematney commented 1 year ago

I think the port is used or blocked by other applications.

I'm experiencing this as well. I think @Shougo is correct that it's being blocked. The only thing that has solved it so far is rebooting. Here are the other things I've tried:

  1. Restarting Vim
  2. Changing networks
  3. Turning network/wifi on and off again
  4. Running :call denops#server#restart() — This fails every time on different ports
  5. Manually running the denops server and using :call denops#server#connect Same issue:
    [denops] Failed to connect `127.0.0.1:32123`: Failed to connect `127.0.0.1:32123`
  6. Manually running ch_open and then ch_status on 127.0.0.1:32123 while the server runs. ch_status returns fail.

I'll continue investigating what's blocking this connection.

lambdalisue commented 1 year ago

[denops] Failed to connect 127.0.0.1:32123: Failed to connect 127.0.0.1:32123

It seems you accidentally set let g:denops_server_addr = '127.0.0.1:32123'? That's for shared server feature so without using shared server, the connection will fail as expected.

stevematney commented 1 year ago

It seems you accidentally set let g:denops_server_addr = '127.0.0.1:32123'? That's for shared server feature so without using shared server, the connection will fail as expected.

I forgot to mention! This was not accidental. I wanted a consistent IP for the denops server for debugging, so I set that IP and ran the server manually. Then I tried running the connect command with the same results.

So, to be clear, the server was running while I was doing this (and it could receive commands from other processes).

stevematney commented 1 year ago

One thing to note: other Vim plugins that use connections (like ALE with LSPs running) continue to work. I’ve been doing some investigating to try to derive why these work while denops does not, but I haven’t reached any conclusions yet.

Shougo commented 1 year ago

@stevematney What is your environment? I think you should test it with other environment.

stevematney commented 1 year ago

@stevematney What is your environment? I think you should test it with other environment.

@Shougo my work machine is a managed Macbook Pro with an Intel processor. I'm fairly certain it has something to do with the firewall that I can't modify or disable, and possibly some of the VPN integration stuff. I know there's not much I can do at the network level to isolate the issue. This is why I'd like to get to the bottom of why other plugins work and denops doesn't. If I can find that, maybe I can figure out how to keep denops running for me.

I also have been using denops and ddc on a personal M1 Macbook Pro, and haven't seen the same issue. It seems pretty clear that it has something to do with the setup on my other machine.

Shougo commented 1 year ago

Oh, OK. So it seems VPN or security soft or the firewall blocks denops connection. Unfortunately, we cannot fix the problem from denops side.

This is why I'd like to get to the bottom of why other plugins work and denops doesn't. If I can find that, maybe I can figure out how to keep denops running for me.

The other software is popular, but denops is not. So they may block. It is terrible. You can request denops connection should not be blocked though.

lambdalisue commented 1 year ago

It seems more investigation is required so reopen it.

lambdalisue commented 1 year ago

I haven't heard related issue recently so close it. Please create a new one if you face similar issue.