Thin web server: `start_tcp_server': no acceptor (RuntimeError) after git branch checkout

橙三吉。 提交于 2019-11-27 02:36:21

This works for me. Find (zombie?) server (can happen when quitting terminal with server running):

$ ps ax | grep rails

If it returns something like:

33467 s002 S+ 0:00.00 grep rails
33240 s003 S+ 0:15.05 /Users/Arta/.rbenv/versions/1.9.2-p290/bin/ruby script/rails s -p 3000

kill it, and run anew:

$ kill -9 33240
$ rails s

The port 3000 may already be in use. Look at http://mrjaba.posterous.com/starttcpserver-no-acceptor-runtimeerror

pgrep ruby to see what servers are running and then

kill -9 serverNumber

;)

If there's any other process locking the port, you can find out which PID it has like this:

$ lsof -i :3000
COMMAND     PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
Passenger 40466 josh    5u  IPv4 0x7cae9332073ed4df      0t0  TCP *:hbci (LISTEN)
Passenger 40467 josh    5u  IPv4 0x7cae9332073ed4df      0t0  TCP *:hbci (LISTEN)

Then simply kill it/them:

$ kill -9 40466
$ kill -9 40467

rvmsudo rails server thin -p 3000

Does it for me

I has this error because i was running rails-dev-box with Rails inside of it.

Port 3000 in the host computer is forwarded to port 3000 in the virtual machine. 
Thus, applications running in the virtual machine can be accessed via 
localhost:3000 in the host computer.

So is logged out from Vagrant and shutted down it:

vagrant@rails-dev-box:/vagrant/rails$ exit
$ vagrant halt

That helped me.

I had this error because I was already running rails in another terminal. Closing my other project fixed this.

I ran into a similar issue after getting back to the office from vacation. I run my server on the local IP as:

rails s thin -b <my_ip>

The problem was that my IP had changed, I just needed to use the new one.

Execute this in the terminal

sudo netstat -lpn |grep rails

And then

sudo kill <job id>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!