spatie / ray

Debug with Ray to fix problems faster
https://myray.app
MIT License
574 stars 102 forks source link

Ray was unable to bind to the remote server's port #606

Closed thelaarn closed 2 years ago

thelaarn commented 2 years ago

Describe the bug Cannot connect to a remote server and get the error message 'Ray was unable to bind to the remote server's port. Is the port in use or is someone else using ray on this server?'

Versions Ray version (you can see this in "About Ray"): Version 1.19.0

You can use composer show to get the version numbers of:

PHP version: 7.4 Laravel version (if applicable): n/a

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Servers' tab (top right corner)
  2. Click on 'Add server'
  3. Setup a remote server with sftp using username/password
  4. Click on 'plug icon'
  5. See error 'Ray was unable to bind to the remote server's port. Is the port in use or is someone else using ray on this server?'

Expected behavior make a connection to the remote server

Screenshots image

Desktop (please complete the following information):

AdrianMrn commented 2 years ago

Does restarting the server fix this? Have you been able to connect Ray to the server before?

I'm going to close this issue because it's been inactive for a while. Let me know if you still need help with this problem!

nlemoine commented 2 years ago

@AdrianMrn I'm having the same issue here. Is there any way to access some logs about what's going wrong in the SSH connection?

AdrianMrn commented 2 years ago

@nlemoine I've had this issue myself as well and haven't been able to debug it, sadly we're currently not keeping any logs for errors at this moment, we might add this in the future.

The only reliable solution I've found is to -however unpractical- reboot the remote server.

nlemoine commented 2 years ago

Thanks for the prompt reply! :) It's actually impossible because I'm having this issue on a cheap shared hosting... (I don't have any other choice on a particular project) so reboot isn't an option.

But SSH works on that host from my terminal, so I wonder why Ray can't establish connection to it. And besides "ray was unable to bind..." I can't get any valuable information. Let me know when some kinds of logging lands in Ray.

benjamin74 commented 2 years ago

Having the exact same problem here:

Ray was unable to bind to the remote server's port. Is the port in use or is someone else using ray on this server?

The port is not in use afaik and for sure nobody is using ray on that server.

Rebooting the server is an absolutely aweful solution... why has this been closed?

tonkoshkurik commented 2 years ago

Also, looking for a solution here.

gixxy22 commented 2 years ago

same issue here

JoshMoreno commented 2 years ago

I ran into this issue when I was connected and my internet connection dropped. From my understanding, the ssh session was still active on the server, but not locally. Restarting sshd with service sshd restart did not fix it.

So I looked for idle ssh processes with

pstree -p

Which output a tree of processes like this

├─sshd(2239522)───sshd(2239594)───bash(2239595)
├─sshd(2240717)───sshd(2240796)
├─sshd(2240820)───sshd(2240911)
├─sshd(2240912)───sshd(2241003)───bash(2241004)───pstree(2241795)
├─sshd(2241041)─┬─sshd(2241042)───sshd(2241114)───bash(2241115)
│               ├─sshd(2241288)───sshd(2241378)
│               ├─sshd(2241386)───sshd(2241476)
│               ├─sshd(2241477)───sshd(2241561)
│               ├─sshd(2241584)───sshd(2241673)
│               └─sshd(2241685)───sshd(2241774)

These looked "idle" to me since they weren't tied to any other processes

├─sshd(2240717)───sshd(2240796)
├─sshd(2240820)───sshd(2240911)

So I started killing the parent processes (1st level of the tree)

sudo kill 2240717
sudo kill 2240820

and checking if ray could connect again. And it worked! 🎉 There might be an easier way to go about this, but 100% this works and you don't have to reboot the server.

angorb commented 2 years ago

Solid solution @JoshMoreno - I run into this all the time with my AWS-hosted development server and a flaky VPN connection and this is so much easier than rebooting the EC2 instance from the AWS Console and waiting for my box to come back up. 👍🏼

Mwalek commented 10 months ago

Same problem here. Is this being worked on?