EventMachine: "`start_tcp_server': no acceptor (port is in use or requires root privileges)"

Will Sewell picture Will Sewell · Jan 9, 2015 · Viewed 23k times · Source

When I try and run the server with EventMachine::run I keep getting the error saying that the port is in use. This started ever since I ran the server in the background with the command nohup.

I am pretty sure I have killed the process I started:

  • I found the ruby process with ps, and killed it. It no longer shows up.
  • I also ran lsof -i :8081 (8081 is the port I ran it on) and nothing shows up.
  • Finally, I have changed the port in the ruby program a number of times to obscure ports, and still get the error!

I also thought it could be the lack of me being the root user, so tried it as root to no avail.

I have also restarted the server.

Please let me know if there's anything else I can try.

Note: this is on debian.

Answer

Hanmaslah picture Hanmaslah · Oct 11, 2016

Had the same problem.

Ran lsof -i :3000 (3000 is the port I ran it on).

I found out that the port was being used by ruby. I killed the process using kill -9 *pid*.

When I ran lsof -i :3000 again, nothing showed up.

I then ran rails s and everything works fine now.