Skip to content

Error after binding to socket and port in one config #1986

@flaminestone

Description

@flaminestone

Puma can not to be configuring for work with socket and port in one time.
In previous version (4.1.1) all work fine.
Error:

Traceback (most recent call last):
	12: from /usr/local/bundle/bin/puma:23:in `<main>'
	11: from /usr/local/bundle/bin/puma:23:in `load'
	10: from /usr/local/bundle/gems/puma-4.2.0/bin/puma:10:in `<top (required)>'
	 9: from /usr/local/bundle/gems/puma-4.2.0/lib/puma/cli.rb:80:in `run'
	 8: from /usr/local/bundle/gems/puma-4.2.0/lib/puma/launcher.rb:172:in `run'
	 7: from /usr/local/bundle/gems/puma-4.2.0/lib/puma/single.rb:98:in `run'
	 6: from /usr/local/bundle/gems/puma-4.2.0/lib/puma/runner.rb:154:in `load_and_bind'
	 5: from /usr/local/bundle/gems/puma-4.2.0/lib/puma/binder.rb:89:in `parse'
	 4: from /usr/local/bundle/gems/puma-4.2.0/lib/puma/binder.rb:89:in `each'
	 3: from /usr/local/bundle/gems/puma-4.2.0/lib/puma/binder.rb:107:in `block in parse'
	 2: from /usr/local/bundle/gems/puma-4.2.0/lib/puma/binder.rb:107:in `each'
	 1: from /usr/local/bundle/gems/puma-4.2.0/lib/puma/binder.rb:111:in `block (2 levels) in parse'
/usr/local/bundle/gems/puma-4.2.0/lib/puma/binder.rb:111:in `ip_unpack': need IPv4 or IPv6 address (SocketError)

Puma config:

bind "unix:///puma.sock"
bind 'tcp://0.0.0.0:3000'

To Reproduce
File with application (app.rb):

require 'sinatra'
class App < Sinatra::Base
  get '/' do
    render 'ok!'
  end
end

File with puma config (config.puma.rb)

bind "unix:///puma.sock"
bind 'tcp://0.0.0.0:3000'

sinatra config (config.ru):

require_relative 'app'

run Rack::URLMap.new('/' => App)

configure do
  set :server, :puma
end

Gemfile:

source 'https://rubygems.org'
gem 'puma', '4.2.0'
# gem 'puma', '4.1.1'
gem 'sinatra'

Dockerfile:

FROM ruby:2.6.4
RUN mkdir /project
ADD . /project
WORKDIR /project
RUN bundler install
CMD puma -C config.puma.rb

I created a small project to reproduce this issue. It is attached to the issue.

I think this method has error.
@ios class instance is a array with TCPServer and UNIXServer objects
(addind TCPServer, addind UNIXServer), but this array is being processed only in tcp section (this).

project.zip

  • OS: Linux, Elementary OS Juno
  • Puma Version 4.1.1 and 4.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions