0

I currently get this error when starting my dev server on Cloud9:

`trimakas:~/workspace (master) $ rails s -p $PORT -b $IP
=> Booting Puma
=> Rails 4.2.3 application starting in development on http://0.0.0.0:8080
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[39230] Puma starting in cluster mode... 
[39230] * Version 3.4.0 (ruby 2.3.0-p0), codename: Owl Bowl Brawl 
[39230] * Min threads: 5, max threads: 5
[39230] * Environment: development
[39230] * Process workers: 2
[39230] * Preloading application
[39230] * Listening on tcp://0.0.0.0:8080
Exiting
/usr/local/rvm/gems/ruby-2.3.0/gems/puma-3.4.0/lib/puma/binder.rb:255:in 
`initialize': Address already in use - bind(2) 
for "0.0.0.0" port 8080 (Errno::EADDRINUSE)`

I then try and find why its in use with: lsof -wni tcp:8080

But nothing is found??!

I then try the following with absolutely no luck:

puma -C config/puma.rb

rails server -b http://0.0.0.0:8080

rails s -b 0.0.0.0 -p 8080

rails s -p $PORT -b $IP

My puma.config file is simple and looks like this:

environment 'development'

workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['MAX_THREADS'] || 5)
threads threads_count, threads_count

preload_app!

rackup      DefaultRackup
port        8080
environment 'development'

daemonize true

on_worker_boot do
  ActiveSupport.on_load(:active_record) do
  ActiveRecord::Base.establish_connection
end
end

Thanks Todd

ToddT
  • 3,084
  • 4
  • 39
  • 83

1 Answers1

1

Had the exact same problem.
A solution has already been given here.

You have to kill all ruby processes:

killall ruby

After that just restart the server

rails server -b $IP -p $PORT

Hope it helps if you haven't already find a solution.

Community
  • 1
  • 1
Edy Espinal
  • 145
  • 12
  • 1
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/low-quality-posts/13181310) – Everettss Jul 31 '16 at 21:00
  • Thanks! Will follow the suggestions. – Edy Espinal Aug 04 '16 at 21:36