Eventmachine start_tcp_server no acceptor - port is in use or requires root privileges (RuntimeError)

colmtuite picture colmtuite · May 29, 2015 · Viewed 8.3k times · Source

I haven't been able to run my local server for 3 days now. Restarting my computer doesn't help. A couple of time, after trying repeatedly about 40-50 times, it randomly worked - I can't figure out why. I tried a different port once and that worked, but since then, no port works. Every time I try to run my rails server I get this.

/Users/colmtuite/.rvm/gems/ruby-2.2.0/gems/eventmachine-1.0.5/lib/eventmachine.rb:526:in `start_tcp_server': no acceptor (port is in use or requires root privileges) (RuntimeError)
    from /Users/colmtuite/.rvm/gems/ruby-2.2.0/gems/eventmachine-1.0.5/lib/eventmachine.rb:526:in `start_server'
    from /Users/colmtuite/.rvm/gems/ruby-2.2.0/gems/thin-1.5.1/lib/thin/backends/tcp_server.rb:16:in `connect'
    from /Users/colmtuite/.rvm/gems/ruby-2.2.0/gems/thin-1.5.1/lib/thin/backends/base.rb:55:in `block in start'
    from /Users/colmtuite/.rvm/gems/ruby-2.2.0/gems/eventmachine-1.0.5/lib/eventmachine.rb:187:in `call'
    from /Users/colmtuite/.rvm/gems/ruby-2.2.0/gems/eventmachine-1.0.5/lib/eventmachine.rb:187:in `run_machine'
    from /Users/colmtuite/.rvm/gems/ruby-2.2.0/gems/eventmachine-1.0.5/lib/eventmachine.rb:187:in `run'
    from /Users/colmtuite/.rvm/gems/ruby-2.2.0/gems/thin-1.5.1/lib/thin/backends/base.rb:63:in `start'
    from /Users/colmtuite/.rvm/gems/ruby-2.2.0/gems/thin-1.5.1/lib/thin/server.rb:159:in `start'
    from /Users/colmtuite/.rvm/gems/ruby-2.2.0/gems/rack-1.6.1/lib/rack/handler/thin.rb:19:in `run'
    from /Users/colmtuite/.rvm/gems/ruby-2.2.0/gems/rack-1.6.1/lib/rack/server.rb:286:in `start'
    from /Users/colmtuite/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands/server.rb:80:in `start'
    from /Users/colmtuite/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:80:in `block in server'
    from /Users/colmtuite/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap'
    from /Users/colmtuite/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server'
    from /Users/colmtuite/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /Users/colmtuite/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

When I run ps aux | grep rails I get this output:

colmtuite        6422   0.0  0.0  2441988    668 s002  S+    2:44am   0:00.00 grep rails

When I run ps aux | grep ruby I get this output:

colmtuite       13305   0.0  0.0  2423356    200 s000  R+    8:15pm   0:00.00 grep ruby

Are my ports closed for some reason?

Answer

Amol Udage picture Amol Udage · Aug 15, 2015

I also had same problem

This works for me

$ ps ax | grep rails

then kill process using process id

$ kill -9 [process Id]

..

Example

$ kill -9 20496

..

start server again