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

Solution 1:

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

Solution 2:

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

Solution 3:

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

Solution 4:

pgrep ruby to see what servers are running and then

kill -9 serverNumber

;)

Solution 5:

rvmsudo rails server thin -p 3000

Does it for me