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

痞子三分冷 提交于 2019-12-07 05:45:10

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/30519844/eventmachine-start-tcp-server-no-acceptor-port-is-in-use-or-requires-root-priv

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