cannot start sinatra process - eventmachine “no acceptor”

Deadly 提交于 2019-12-08 19:39:46

问题


I have a Sinatra app that I run as a daemon, using Apache port-forwarding to mediate between port 80 and port 7655. This has been working fine in the past. Today, not so well. I cannot figure out why.

Problem: sudo ruby my_process.rb returns:

/var/lib/gems/1.9.1/gems/eventmachine-1.0.0/lib/eventmachine.rb:526:in `start_tcp_server': no acceptor (port is in use or requires root privileges) (RuntimeError)

Tried: updating all system packages, updating all gems. No help (except for the more clear error message from eventmachine).

When I run sudo lsof -i :7655 I get nothing back. When I run sudo ps aux I don't see any Ruby processes at all. Which I find highly irregular, given the nature of the error message!

So is there something I'm missing in finding out why the port is unavailable?


Also:

Tried changing ports, nothing. I wonder if it is related to "localhost"? When I ping localhost I get all dropped packets. That doesn't seem normal.


回答1:


Turns out these two lines in the main Sinatra script provided the most information:

set bind: "localhost"
set port: 7655

The problem was with localhost. The loopback interface was not properly configured. ifconfig showed the lo interface, but it hadn't been assigned the IP 127.0.0.1. To resolve, ran the following commands in the shell (on an Ubuntu Linux system):

ifdown lo
ifup lo


来源:https://stackoverflow.com/questions/12661941/cannot-start-sinatra-process-eventmachine-no-acceptor

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