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

Failed to connect to server -- Operation timed out #129

Closed
vm-wylbur opened this issue Feb 23, 2024 · 4 comments
Closed

Failed to connect to server -- Operation timed out #129

vm-wylbur opened this issue Feb 23, 2024 · 4 comments

Comments

@vm-wylbur
Copy link

vm-wylbur commented Feb 23, 2024

I think this is related to #126 but there seem to be two differences. First, the error is a timeout rather than a deserialization. Second, distant can do something on the remote server, so the ssh handshaking is working, and distant is able to execute the server remotely. But the connection doesn't happen.

On local:

pball@porky:~ 19s481ms
❯ distant launch ssh://[email protected]:2222 --distant /home/pball/.local/bin/distant
Failed to connect to server

Caused by:
    Operation timed out (os error 60)

The timeout is consistently ~19s. I see on remote:

# before the launch attempt
pball@snowball🌐:~
❯ ps ax | grep distant
 361013 pts/3    S+     0:00 grep distant

# after an attempt without the --distant /home/pball/.local/bin
pball@snowball🌐:~
❯ ps ax | grep distant
 364401 ?        Sl     0:00 distant server listen --daemon --host ssh
 364620 pts/3    S+     0:00 grep distant

# after an attempt with the remote path to distant 
pball@snowball🌐:~
❯ ps ax | grep distant
 364401 ?        Sl     0:00 distant server listen --daemon --host ssh
 370549 ?        Sl     0:00 /home/pball/.local/bin/distant server listen --daemon --host ssh
 371096 pts/3    S+     0:00 grep distant

Update: the note in #94 about the open port on the remote machine may be the key for me. I have an extra port open, so from inside Neovim, I tried :DistantLaunch ssh://ssh://[email protected]:2222 distant.args="port 2022" and I got a connection. I could see the remote machine with :Distant. However, it hung on DistantOpen <path>. Keeping at it.

@vm-wylbur
Copy link
Author

I think it's ok now.

  • I can :DistantShell (as a test, I have too many multiplexing options already).
  • also :DistantSystemInfo is good.
  • I see two sessions in :DistantSessionInfo. Is there a way to delete/kill a session? There's only one server daemon running remotely, which seems exactly right.
  • Navigation works! I like that a lot. It would be really amazing to integrate distant with neotree or nvim-tree. I think making remote paths available to file navigators was the idea in netman.nvim but I wan't able to make it connect.
  • :DistantSearch "something" gave a "search is unsupported" error.

Thanks for this! I'll keep a close eye on developments. I do a lot of remote editing over unstable connections, and it's really annoying to have to choose between nvim-ing in a remote ssh terminal with laggy response; or mounting a remote path locally, editing, and then hanging every time :w spawns a synchronous copy. Have you solved this? Maybe! I hope so.

@chipsenkbeil
Copy link
Owner

chipsenkbeil commented Feb 23, 2024

I see two sessions in :DistantSessionInfo. Is there a way to delete/kill a session? There's only one server daemon running remotely, which seems exactly right.

You can kill a connection by moving your cursor over it and pressing K (shift + k).

Navigation works! I like that a lot. It would be really amazing to integrate distant with neotree or nvim-tree. I think making remote paths available to file navigators was the idea in netman.nvim but I wan't able to make it connect.

TLDR; it's difficult unless the navigation plugin is very extensible.

The way the distant.nvim plugin works, you need to be able to override at least the following:

  1. When the navigation plugin wants to load a directory, feed the directory to distant.nvim and then present the results.
  2. When the navigation plugin wants to load a file, feed the file name to distant.nvim OR use a filename prefixed with distant:// at minimum. The distant.nvim plugin supports more than one connection, so it'll include the connection details as part of the prefix as well, otherwise it will load the currently-selected connection.

Beyond that, if you want to rename a file/directory, deleting a file/directory, create a new file, or create a new directory then you'd need to leverage distant's API as well.

A plugin like lir.nvim would just about let you do this as you can provide a function to be executed for each mapping, but it still handles loading a directory and querying file details in a way that we cannot overwrite.

:DistantSearch "something" gave a "search is unsupported" error.

It looks like you were connecting via a distant server, so search should be supported, but the Lua wrapper is a bit unstable .

Have you solved this? Maybe! I hope so.

I use it at work, but there are definitely rough edges. The next improvement to this plugin actually is related to some unfinished work on the distant Rust project, specifically the branch to switch ssh to native rust and introduce a better plugin API.

But my time as of late has been limited, so I haven't finished the branch. Once that's done, you can both expect more ways to connect (Docker is first on the list) and better feedback when issues occur (connection problems, reconnecting, suggestions on port forwarding, etc).

@vm-wylbur
Copy link
Author

Thanks a lot for your detailed replies! I'm enjoying distant and look forward to next pieces.

One other question: in my just-getting-started workflow with distant, I've been using neovim in one terminal pane and an ssh session to a shell on the remote machine in the adjoining pane. The remote machine is running distant server. I find myself digging around in the ssh session, finding a file, then going back to the other pane while trying to remember the path, etc.

I wonder if there would be a way to give a command to the server to load a file from the remote machine to a buffer in neovim on the local machine. I imagine semantics something like this:

# this is a remote server 
pball@snowball🌐:~
❯ distant server nvim-open path/to/myfile 

And a buffer for path/to/myfile opens in the local Neovim. This would be in some sense the inverse of distant spawn. Interesting? SublimeText has a version of this but it has the "hang while a synchronous copy happens"/sshfs issue.

@chipsenkbeil
Copy link
Owner

chipsenkbeil commented Feb 27, 2024

No feature like that exists at the moment. Would you mind moving this to a new discussion? We can follow up from there

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

No branches or pull requests

2 participants