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

Can't bind to socket #824

Closed
MattWalston opened this issue Nov 14, 2015 · 5 comments
Closed

Can't bind to socket #824

MattWalston opened this issue Nov 14, 2015 · 5 comments

Comments

@MattWalston
Copy link

Attempted setting in config file and using args. Socket is not created and binds to tcp. I'm not sure where to go from here.

@Nowaker
Copy link

Nowaker commented Jan 2, 2016

I tried with rackup which didn't work either.

% x rackup -s puma -E development -o ./test.socket config.ru
Puma 2.15.3 starting...
* Min threads: 0, max threads: 16
* Environment: development
* Listening on tcp://./test.socket:9292
/home/nowaker/.rvm/gems/ruby-2.2.4/gems/puma-2.15.3/lib/puma/binder.rb:234:in `initialize': getaddrinfo: Name or service not known (SocketError)
        from /home/nowaker/.rvm/gems/ruby-2.2.4/gems/puma-2.15.3/lib/puma/binder.rb:234:in `new'
        from /home/nowaker/.rvm/gems/ruby-2.2.4/gems/puma-2.15.3/lib/puma/binder.rb:234:in `add_tcp_listener'
        from (eval):2:in `add_tcp_listener'
        from /home/nowaker/.rvm/gems/ruby-2.2.4/gems/puma-2.15.3/lib/rack/handler/puma.rb:33:in `run'
        from /home/nowaker/.rvm/gems/ruby-2.2.4/gems/rack-1.6.4/lib/rack/server.rb:286:in `start'
        from /home/nowaker/.rvm/gems/ruby-2.2.4/gems/rack-1.6.4/lib/rack/server.rb:147:in `start'
        from /home/nowaker/.rvm/gems/ruby-2.2.4/gems/rack-1.6.4/bin/rackup:4:in `<top (required)>'
        from /home/nowaker/.rvm/gems/ruby-2.2.4/bin/rackup:23:in `load'
        from /home/nowaker/.rvm/gems/ruby-2.2.4/bin/rackup:23:in `<main>'
        from /home/nowaker/.rvm/gems/ruby-2.2.4/bin/ruby_executable_hooks:15:in `eval'
        from /home/nowaker/.rvm/gems/ruby-2.2.4/bin/ruby_executable_hooks:15:in `<main>'

The same thing works with Thin without any problem:

% x rackup -s thin -E development -o ./test.socket config.ru
Thin web server (v1.6.4 codename Gob Bluth)
Maximum connections set to 1024
Listening on ./test.socket, CTRL+C to stop

This seems to work with Puma without any problem:

% cat config/puma.rb | grep bind
bind "unix://./puma.sock"
% x puma
[8420] Puma starting in cluster mode...
[8420] * Version 2.15.3 (ruby 2.2.4-p230), codename: Autumn Arbor Airbrush
[8420] * Min threads: 8, max threads: 32
[8420] * Environment: development
[8420] * Process workers: 1
[8420] * Preloading application
[8420] * Listening on unix://./puma.sock
[8420] Use Ctrl-C to stop
[8420] - Worker 0 (pid: 8423) booted, phase: 

@micfan
Copy link

micfan commented Jan 29, 2016

$ rackup -h
Rack options:
  -s, --server SERVER      serve using SERVER (thin/puma/webrick/mongrel)
  -o, --host HOST          listen on HOST (default: localhost)
...

@Nowaker I think your are using an args -o which has been overrode by thethinserver. Of cause,puma` do not offer this feature. Config your .socket file in config.rb https://github.com/puma/puma/blob/v2.16.0/examples/config.rb#L75

@Nowaker
Copy link

Nowaker commented Jan 29, 2016

The host can be a path to socket too, that's a well-recognized convention on Linux. Thin follows the convention. Example from PostgreSQL:

  -h, --host=HOSTNAME      database server host or socket directory (default: "local socket")

@micfan
Copy link

micfan commented Jan 29, 2016

Yeah, we assume this is a well-recognized convention on Linux.

But please check puma source code, you may find puma do not implement a rack/handler in the well-recognized convention.

And you will find thin's implement with override select_backend() and def select_backend()

Any PR?

@Nowaker
Copy link

Nowaker commented Feb 25, 2016

Thanks @evanphx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants