Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a Meaningful error msg for control server port taken #3204

Merged
6 changes: 5 additions & 1 deletion lib/puma/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ def start_control
control = Puma::Server.new app, nil,
{ min_threads: 0, max_threads: 1, queue_requests: false, log_writer: @log_writer }

control.binder.parse [str], nil, 'Starting control server'
begin
control.binder.parse [str], nil, 'Starting control server'
rescue Errno::EADDRINUSE => e
raise "Error: Control server address '#{str}' is already in use. You're trying to start a control server but the control server port is taken."
end
nateberkopec marked this conversation as resolved.
Show resolved Hide resolved

control.run thread_name: 'ctl'
@control = control
Expand Down
5 changes: 5 additions & 0 deletions test/config/activate_control_app.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
activate_control_app "tcp://0.0.0.0:9393"

app do |env|
[200, {}, ["OK"]]
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this file added? Can't see in the diff that it is being used