Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 26 17:47
    MSP-Greg commented #2413
  • Nov 26 03:53
    TechGiovanni commented #1200
  • Nov 25 14:03
    joaomarcos96 synchronize #3011
  • Nov 25 02:36
    vzajkov synchronize #2770
  • Nov 25 02:11
    vzajkov synchronize #2770
  • Nov 24 15:26
    MSP-Greg opened #3024
  • Nov 24 14:45

    MSP-Greg on master

    Fixup response processing, enum… (compare)

  • Nov 24 14:45
    MSP-Greg closed #3000
  • Nov 24 14:45
    MSP-Greg closed #3004
  • Nov 24 12:08
    dentarg commented #2290
  • Nov 24 12:07
    dentarg commented #2290
  • Nov 24 08:50
    aakashkaji commented #2290
  • Nov 24 07:19
    evaneykelen commented #2999
  • Nov 23 02:04
    nguyenngoc2505 opened #3023
  • Nov 22 22:29
    MSP-Greg commented #3007
  • Nov 22 18:29
    joaomarcos96 synchronize #3011
  • Nov 22 05:01

    nateberkopec on master

    SECURITY: Puma 4.x no longer su… (compare)

  • Nov 22 05:01

    nateberkopec on bump-versions-in-SECURITY

    (compare)

  • Nov 22 05:01
    nateberkopec closed #3017
  • Nov 20 18:19
    ioquatix commented #3007
Mike Pastore
@mwpastore
Sounds good!
Chris
@ipatch
hello i'm trying to deploy a rails app with puma using cap, and trying to bind puma to a specific port and have set that in config/deploy/production.rb but the app isn't loading :/
raelik
@raelik
Is there a best practice for embedding a puma server into a multi-threaded ruby app? Namely, not using the puma cli
also, this would be on jruby, so no worries about the GIL getting in the way
Mike Pastore
@mwpastore
@raelik If you install the puma gem under JRuby doesn’t it just run puma using JRuby?
@raelik And if you’re deploying to another application server, do you even need puma?
raelik
@raelik
The app in question is a standalone jruby application, and puma would just be used to provide a json endpoint for monitoring it.
so I don't want to run the app with the puma command, as it already has its own command-line
raelik
@raelik
I've got a way to start it (Events.new, Binder.new & add_tcp_listener, Server.new), just didn't know if there was a more streamlined way
raelik
@raelik
actually, looks like I can call add_tcp_listener directly on the Server, since it'll create it's own Binder instance if necessary
so that'll work
Mike Pastore
@mwpastore
Interesting! I’ve seen other ways to do what you’re doing but that’s pretty cool
raelik
@raelik
    def puma_init
      conf = @config[:puma]
      events = case options[:log].nil?
        when false
          Puma::Events::DEFAULT
        else
          f = File.open(options[:log],'a+')
          e = Puma::Events.new(f, f)
          e.register(:state) {|s| f.close if s == :done }
          e
      end
      server = Puma::Server.new(@monitor,events)
      server.add_tcp_listener(conf[:host] || '127.0.0.1', conf[:port] || '9292')
      server.min_threads = 0
      server.max_threads = conf[:threads] || 1
      server
    end
that's my method for manually initializing puma
raelik
@raelik
@monitor is a rack app initialized elsewhere, @config is a YAML config parsed into a hash, and options comes from methadone.
Mike Pastore
@mwpastore
Anybody working on running Puma on Ruby 2.3 with --enable=frozen-string-literal? I’m trying to fix up enough of the built-in gems in the preview just to get rake test to go :-\
James Moriarty
@jamesmoriarty
Hey, anyone know what dependencies I need to install puma on apline linux. Thanks. :)
James Moriarty
@jamesmoriarty
apk add --no-cache git imagemagick make gcc libc-dev libxml2-dev libxslt-dev libffi-dev yaml-dev openssl-dev zlib-dev readline-dev
Worked but I think I can eliminate some of those.
Philip Champon
@flah00
hi-o, i'm wondering if anyone has run into issues with puma master reconnecting to active record, using preload_app! and before_fork disconnect!. All of my rails app disconnect, except for redmine, which reconnects after 1 - 2 days.
this is with puma-2.16.0, rails-4.2.5, and pg-0.18.4
danilogarcia024
@danilogarcia024
I trying to run my app
When I started it the following message appear me
But it's just in Production

MacBook-Pro-de-Danilo:apc-directory danilogarcia024$ rails s puma -e production
/Users/danilogarcia024/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler.rb:289: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
/Users/danilogarcia024/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler.rb:289: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
=> Booting Puma
=> Rails 4.1.6 application starting in production on http://0.0.0.0:3000
=> Run rails server -h for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
Puma 2.13.4 starting...

  • Min threads: 0, max threads: 16
  • Environment: production
  • Listening on tcp://0.0.0.0:3000
    2016-03-16 21:35:04 -0500: HTTP parse error, malformed request (): #<Puma::HttpParserError: Invalid HTTP format, parsing fails.>2016-03-16 21:35:04 -0500: HTTP parse error, malformed request (): #<Puma::HttpParserError: Invalid HTTP format, parsing fails.>
    2016-03-16 21:35:04 -0500: ENV: {"rack.version"=>[1, 3], "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>false, "SCRIPT_NAME"=>"", "QUERY_STRING"=>"", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"2.13.4", "GATEWAY_INTERFACE"=>"CGI/1.2"}

2016-03-16 21:35:04 -0500: HTTP parse error, malformed request (): #<Puma::HttpParserError: Invalid HTTP format, parsing fails.>

2016-03-16 21:35:04 -0500: ENV: {"rack.version"=>[1, 3], "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>false, "SCRIPT_NAME"=>"", "QUERY_STRING"=>"", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"2.13.4", "GATEWAY_INTERFACE"=>"CGI/1.2"}

2016-03-16 21:35:04 -0500: ENV: {"rack.version"=>[1, 3], "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>false, "SCRIPT_NAME"=>"", "QUERY_STRING"=>"", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"2.13.4", "GATEWAY_INTERFACE"=>"CGI/1.2"}

2016-03-16 21:35:04 -0500: HTTP parse error, malformed request (): #<Puma::HttpParserError: Invalid HTTP format, parsing fails.>

2016-03-16 21:35:04 -0500: ENV: {"rack.version"=>[1, 3], "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>false, "SCRIPT_NAME"=>"", "QUERY_STRING"=>"", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"2.13.4", "GATEWAY_INTERFACE"=>"CGI/1.2"}

2016-03-16 21:35:04 -0500: HTTP parse error, malformed request (): #<Puma::HttpParserError: Invalid HTTP format, parsing fails.>

2016-03-16 21:35:04 -0500: ENV: {"rack.version"=>[1, 3], "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>false, "SCRIPT_NAME"=>"", "QUERY_STRING"=>"", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"2.13.4", "GATEWAY_INTERFACE"=>"CGI/1.2"}

2016-03-16 21:35:04 -0500: HTTP parse error, malformed request (): #<Puma::HttpParserError: Invalid HTTP format, parsing fails.>

2016-03-16 21:35:04 -0500: ENV: {"rack.version"=>[1, 3], "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>false, "SCRIPT_NAME"=>"", "QUERY_STRING"=>"", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"2.13.4", "GATEWAY_INTERFACE"=>"CGI/1.2"}

2016-03-16 21:35:04 -0500: HTTP parse error, malformed request (): #<Puma::HttpParserError: Invalid HTTP format, parsing fails.>

2016-03-16 21:35:04 -0500: ENV: {"rack.version"=>[1, 3], "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>false, "SCRIPT_NAME"=>"", "QUERY_STRING"=>"", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"2.13.4", "GATEWAY_INTERFACE"=>"CGI/1.2"}

2016-03-16 21:35:04 -0500: HTTP parse error, malformed request (): #<Puma::HttpParserError: Invalid HTTP format, parsing fails.>
2016-03-16 21:35:04 -0500: ENV: {"rack.version"=>[1, 3], "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>fals

This does not say a Hint of what could be
danilogarcia024
@danilogarcia024
MacBook-Pro-de-Danilo:apc-directory danilogarcia024$ rails s puma -e production /Users/danilogarcia024/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler.rb:289: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777 /Users/danilogarcia024/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler.rb:289: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777 => Booting Puma => Rails 4.1.6 application starting in production on http://0.0.0.0:3000 => Runrails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
Puma 2.13.4 starting...
  • Min threads: 0, max threads: 16
  • Environment: production
  • Listening on tcp://0.0.0.0:3000
    2016-03-16 21:35:04 -0500: HTTP parse error, malformed request (): #<Puma::HttpParserError: Invalid HTTP format, parsing fails.>2016-03-16 21:35:04 -0500: HTTP parse error, malformed request (): #<Puma::HttpParserError: Invalid HTTP format, parsing fails.>
    2016-03-16 21:35:04 -0500: ENV: {"rack.version"=>[1, 3], "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>false, "SCRIPT_NAME"=>"", "QUERY_STRING"=>"", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"2.13.4", "GATEWAY_INTERFACE"=>"CGI/1.2"}
    ---`
Peter Gao
@peteygao

@danilogarcia024 You might want to (in fact, I highly encourage you to) put long stack traces in a gist (https://gist.github.com) and link to it from here.

The warning is definitely something you want to address. You don't want to have your /usr/local/bin directory to be world readable (permission bits 777). The permissions 755 is much more reasonable for that directory (it says only the owner of that directory can write to it, but other users can read and execute binaries from within it). You can change the permissions via sudo chmod -r 755 /usr/local/bin.

Can't help with debugging Invalid HTTP format without knowing what exactly you're sending the server (do you have a sample curl request?)

Tim Abdulla
@timabdulla
it seems that PERSISTENT_TIMEOUT controls the timeout given to persistent connections, but there is no way to easily modify that variable. i need to increase it to match the keep alive timeout on our load balancers. any way to do this without just overriding the constant?
Evan Phoenix
@evanphx
@timabdulla Yes, there isn't a way o change that right now. I'd be happy to merge a PR that adds the ability to control it in the config file though!
@timabdulla i'm interested in why you need to change it though. Why do you need it to be the same as you load balancers?
raelik
@raelik
I could see it being a problem if his load balancers are configured with a longer timeout
Ryan Condron
@rebelweb
Does anyone have any pointers of setting up puma with runit? Thanks for any help that can be given.
Greg Jastrab
@gjastrab
any tips for debugging all my workers logging "! Detected parent died, dying" ?
https://gist.github.com/gjastrab/37d9e6f201be1be2165f65fad5df0182 is my puma config - we do not preload_app! so that we can do phased restarts
Greg Jastrab
@gjastrab
@rebelweb the repo is slightly old and not much activity, but I had noticed it last year and started exploring using it but never finished getting it across the finish line, it may help though https://github.com/capistrano-runit/puma
Ryan Condron
@rebelweb
I'm have to build something for a omnibus package, I'm using JRuby as well, so I am not sure if this will work but will take a look
Ryan Condron
@rebelweb
I think I have something, I tailored gitlab's unicorn script to puma. This includes erb since it is out of a chef cookbook. I can create a gist , fully compiled if anyone wants an example. https://gist.github.com/rebelweb/4701d91cf79ca78215f561069eeb9d7c
Cheng Zheng
@1c7
why I can't find any great tutorial or document about puma?
really? last message is almost a month ago??
raelik
@raelik
Not sure what you're looking for that you aren't finding in the README on github, or here: http://www.rubydoc.info/gems/puma/3.4.0
raelik
@raelik
@1c7 it's pretty straightforward to use, I'd say 95% of the use cases are covered just in the README.
Greg Jastrab
@gjastrab
@1c7 https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server is a pretty good writeup heroku did after recommending switching from unicorn to puma
raelik
@raelik
@gjastrab Good call, hadn't seen that one.
Andrew A Smith
@aasmith
Hello. I am using puma for multiple workers, not threads (i.e. --workers N --threads 1:1), as each worker is not threadsafe (or at least the work hasn't been done yet to confirm thread safety). My understanding is that if a request in each worker takes one second to complete, and I send in two requests concurrently, each client should have an overall response timing of near to one second. However, it seems that puma is blocking, as these two concurrent requests seem to take nearer to two seconds. Am I misunderstanding something, or is this a bug, or some GIL issue? (this is MRI). Either way, I'd like to understand more :)
I can also produce a small rack-based example of the problem if needed.
Andrew A Smith
@aasmith
(workers N in this case is >= 2).
Andrew A Smith
@aasmith
Digging in further, it seems the same child worker PID is getting selected, even it is unavailable/busy on a current request :/
*even if