-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Description
After some coding got this error on running rails s:
puma-3.5.0/lib/puma/binder.rb:268:in `initialize': Address already in use - bind(2) for "127.0.0.1" port 3000 (Errno::EADDRINUSE)
My environment is:
$ rails -v
Rails 5.0.0
$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
I've tried:
- Create a new project - the same
- Checked Rails 4.2 - problem solved
- Reinstall rails 5 and ruby - the same problem
lsof -wni tcp:3000returns me nothing- ps aux | grep "rails" - nothing
- ps aux | grep "puma" - nothing
- ps aux | grep "ruby" -nothing
- Use
pumainstead ofrails s- problem solved - Use
RAILS_ENV=production bundle exec rails s- problem solved - Use
rails s -p 3001- same problem, for other ports too
Monkey-patched https://github.com/puma/puma/blob/master/lib/puma/binder.rb and added pry.
Found that TCPServer.new is called few times with 127.0.0.1:3000
[3] pry(#<Puma::Binder>)> TCPSocket.gethostbyname "localhost"
=> ["localhost",
[my hosts?],
2,
"127.0.0.1",
"127.0.0.1",
"127.0.0.1",
"127.0.0.1",
"127.0.0.1"]
I think this commit broke something for my machine 9b1de10#diff-4fd9276d9f86d7f4827e6ca4ab6b82b8
And I think this is related to the #782