Giter Site home page Giter Site logo

puma / puma Goto Github PK

View Code? Open in Web Editor NEW
7.6K 179.0 1.4K 11.16 MB

A Ruby/Rack web server built for parallelism

Home Page: https://puma.io

License: BSD 3-Clause "New" or "Revised" License

Ruby 84.77% Java 5.21% C 7.22% Ragel 1.13% Shell 1.06% PowerShell 0.41% Dockerfile 0.18% Lua 0.02% Batchfile 0.01%
ruby server multithreading rack

puma's Introduction

Puma: A Ruby Web Server Built For Parallelism

Actions Code Climate StackOverflow

Puma is a simple, fast, multi-threaded, and highly parallel HTTP 1.1 server for Ruby/Rack applications.

Built For Speed & Parallelism

Puma is a server for Rack-powered HTTP applications written in Ruby. It is:

  • Multi-threaded. Each request is served in a separate thread. This helps you serve more requests per second with less memory use.
  • Multi-process. "Pre-forks" in cluster mode, using less memory per-process thanks to copy-on-write memory.
  • Standalone. With SSL support, zero-downtime rolling restarts and a built-in request bufferer, you can deploy Puma without any reverse proxy.
  • Battle-tested. Our HTTP parser is inherited from Mongrel and has over 15 years of production use. Puma is currently the most popular Ruby webserver, and is the default server for Ruby on Rails.

Originally designed as a server for Rubinius, Puma also works well with Ruby (MRI) and JRuby.

On MRI, there is a Global VM Lock (GVL) that ensures only one thread can run Ruby code at a time. But if you're doing a lot of blocking IO (such as HTTP calls to external APIs like Twitter), Puma still improves MRI's throughput by allowing IO waiting to be done in parallel. Truly parallel Ruby implementations (TruffleRuby, JRuby) don't have this limitation.

Quick Start

$ gem install puma
$ puma

Without arguments, puma will look for a rackup (.ru) file in working directory called config.ru.

SSL Connection Support

Puma will install/compile with support for ssl sockets, assuming OpenSSL development files are installed on the system.

If the system does not have OpenSSL development files installed, Puma will install/compile, but it will not allow ssl connections.

Frameworks

Rails

Puma is the default server for Rails, included in the generated Gemfile.

Start your server with the rails command:

$ rails server

Many configuration options and Puma features are not available when using rails server. It is recommended that you use Puma's executable instead:

$ bundle exec puma

Sinatra

You can run your Sinatra application with Puma from the command line like this:

$ ruby app.rb -s Puma

In order to actually configure Puma using a config file, like puma.rb, however, you need to use the puma executable. To do this, you must add a rackup file to your Sinatra app:

# config.ru
require './app'
run Sinatra::Application

You can then start your application using:

$ bundle exec puma

Configuration

Puma provides numerous options. Consult puma -h (or puma --help) for a full list of CLI options, or see Puma::DSL or dsl.rb.

You can also find several configuration examples as part of the test suite.

For debugging purposes, you can set the environment variable PUMA_LOG_CONFIG with a value and the loaded configuration will be printed as part of the boot process.

Thread Pool

Puma uses a thread pool. You can set the minimum and maximum number of threads that are available in the pool with the -t (or --threads) flag:

$ puma -t 8:32

Puma will automatically scale the number of threads, from the minimum until it caps out at the maximum, based on how much traffic is present. The current default is 0:16 and on MRI is 0:5. Feel free to experiment, but be careful not to set the number of maximum threads to a large number, as you may exhaust resources on the system (or cause contention for the Global VM Lock, when using MRI).

Be aware that additionally Puma creates threads on its own for internal purposes (e.g. handling slow clients). So, even if you specify -t 1:1, expect around 7 threads created in your application.

Clustered mode

Puma also offers "clustered mode". Clustered mode forks workers from a master process. Each child process still has its own thread pool. You can tune the number of workers with the -w (or --workers) flag:

$ puma -t 8:32 -w 3

Or with the WEB_CONCURRENCY environment variable:

$ WEB_CONCURRENCY=3 puma -t 8:32

Note that threads are still used in clustered mode, and the -t thread flag setting is per worker, so -w 2 -t 16:16 will spawn 32 threads in total, with 16 in each worker process.

For an in-depth discussion of the tradeoffs of thread and process count settings, see our docs.

In clustered mode, Puma can "preload" your application. This loads all the application code prior to forking. Preloading reduces total memory usage of your application via an operating system feature called copy-on-write.

If the WEB_CONCURRENCY environment variable is set to a value > 1 (and --prune-bundler has not been specified), preloading will be enabled by default. Otherwise, you can use the --preload flag from the command line:

$ puma -w 3 --preload

Or, if you're using a configuration file, you can use the preload_app! method:

# config/puma.rb
workers 3
preload_app!

Preloading can’t be used with phased restart, since phased restart kills and restarts workers one-by-one, and preloading copies the code of master into the workers.

When using clustered mode, you can specify a block in your configuration file that will be run on boot of each worker:

# config/puma.rb
on_worker_boot do
  # configuration here
end

This code can be used to setup the process before booting the application, allowing you to do some Puma-specific things that you don't want to embed in your application. For instance, you could fire a log notification that a worker booted or send something to statsd. This can be called multiple times.

Constants loaded by your application (such as Rails) will not be available in on_worker_boot unless preloading is enabled.

You can also specify a block to be run before workers are forked, using before_fork:

# config/puma.rb
before_fork do
  # configuration here
end

You can also specify a block to be run after puma is booted using on_booted:

# config/puma.rb
on_booted do
  # configuration here
end

Error handling

If Puma encounters an error outside of the context of your application, it will respond with a 400/500 and a simple textual error message (see Puma::Server#lowlevel_error or server.rb). You can specify custom behavior for this scenario. For example, you can report the error to your third-party error-tracking service (in this example, rollbar):

lowlevel_error_handler do |e, env, status|
  if status == 400
    message = "The server could not process the request due to an error, such as an incorrectly typed URL, malformed syntax, or a URL that contains illegal characters.\n"
  else
    message = "An error has occurred, and engineers have been informed. Please reload the page. If you continue to have problems, contact [email protected]\n"
    Rollbar.critical(e)
  end

  [status, {}, [message]]
end

Binding TCP / Sockets

Bind Puma to a socket with the -b (or --bind) flag:

$ puma -b tcp://127.0.0.1:9292

To use a UNIX Socket instead of TCP:

$ puma -b unix:///var/run/puma.sock

If you need to change the permissions of the UNIX socket, just add a umask parameter:

$ puma -b 'unix:///var/run/puma.sock?umask=0111'

Need a bit of security? Use SSL sockets:

$ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert'

Self-signed SSL certificates (via the localhost gem, for development use):

Puma supports the localhost gem for self-signed certificates. This is particularly useful if you want to use Puma with SSL locally, and self-signed certificates will work for your use-case. Currently, the integration can only be used in MRI.

Puma automatically configures SSL when the localhost gem is loaded in a development environment:

Add the gem to your Gemfile:

group(:development) do
  gem 'localhost'
end

And require it implicitly using bundler:

require "bundler"
Bundler.require(:default, ENV["RACK_ENV"].to_sym)

Alternatively, you can require the gem in your configuration file, either config/puma/development.rb, config/puma.rb, or set via the -C cli option:

require 'localhost'
# configuration methods (from Puma::DSL) as needed

Additionally, Puma must be listening to an SSL socket:

$ puma -b 'ssl://localhost:9292' -C config/use_local_host.rb

# The following options allow you to reach Puma over HTTP as well:
$ puma -b ssl://localhost:9292 -b tcp://localhost:9393 -C config/use_local_host.rb

Controlling SSL Cipher Suites

To use or avoid specific SSL cipher suites, use ssl_cipher_filter or ssl_cipher_list options.

Ruby:
$ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&ssl_cipher_filter=!aNULL:AES+SHA'
JRuby:
$ puma -b 'ssl://127.0.0.1:9292?keystore=path_to_keystore&keystore-pass=keystore_password&ssl_cipher_list=TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA'

See https://www.openssl.org/docs/man1.1.1/man1/ciphers.html for cipher filter format and full list of cipher suites.

Disable TLS v1 with the no_tlsv1 option:

$ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&no_tlsv1=true'

Controlling OpenSSL Verification Flags

To enable verification flags offered by OpenSSL, use verification_flags (not available for JRuby):

$ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&verification_flags=PARTIAL_CHAIN'

You can also set multiple verification flags (by separating them with coma):

$ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&verification_flags=PARTIAL_CHAIN,CRL_CHECK'

List of available flags: USE_CHECK_TIME, CRL_CHECK, CRL_CHECK_ALL, IGNORE_CRITICAL, X509_STRICT, ALLOW_PROXY_CERTS, POLICY_CHECK, EXPLICIT_POLICY, INHIBIT_ANY, INHIBIT_MAP, NOTIFY_POLICY, EXTENDED_CRL_SUPPORT, USE_DELTAS, CHECK_SS_SIGNATURE, TRUSTED_FIRST, SUITEB_128_LOS_ONLY, SUITEB_192_LOS, SUITEB_128_LOS, PARTIAL_CHAIN, NO_ALT_CHAINS, NO_CHECK_TIME (see https://www.openssl.org/docs/manmaster/man3/X509_VERIFY_PARAM_set_hostflags.html#VERIFICATION-FLAGS).

Controlling OpenSSL Password Decryption

To enable runtime decryption of an encrypted SSL key (not available for JRuby), use key_password_command:

$ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&key_password_command=/path/to/command.sh'

key_password_command must:

  1. Be executable by Puma.
  2. Print the decryption password to stdout.

For example:

#!/bin/sh

echo "this is my password"

key_password_command can be used with key or key_pem. If the key is not encrypted, the executable will not be called.

Control/Status Server

Puma has a built-in status and control app that can be used to query and control Puma.

$ puma --control-url tcp://127.0.0.1:9293 --control-token foo

Puma will start the control server on localhost port 9293. All requests to the control server will need to include control token (in this case, token=foo) as a query parameter. This allows for simple authentication. Check out Puma::App::Status or status.rb to see what the status app has available.

You can also interact with the control server via pumactl. This command will restart Puma:

$ pumactl --control-url 'tcp://127.0.0.1:9293' --control-token foo restart

To see a list of pumactl options, use pumactl --help.

Configuration File

You can also provide a configuration file with the -C (or --config) flag:

$ puma -C /path/to/config

If no configuration file is specified, Puma will look for a configuration file at config/puma.rb. If an environment is specified (via the --environment flag or through the APP_ENV, RACK_ENV, or RAILS_ENV environment variables) Puma looks for a configuration file at config/puma/<environment_name>.rb and then falls back to config/puma.rb.

If you want to prevent Puma from looking for a configuration file in those locations, include the --no-config flag:

$ puma --no-config

# or

$ puma -C "-"

The other side-effects of setting the environment are whether to show stack traces (in development or test), and setting RACK_ENV may potentially affect middleware looking for this value to change their behavior. The default puma RACK_ENV value is development. You can see all config default values in Puma::Configuration#puma_default_options or configuration.rb.

Check out Puma::DSL or dsl.rb to see all available options.

Restart

Puma includes the ability to restart itself. When available (MRI, Rubinius, JRuby), Puma performs a "hot restart". This is the same functionality available in Unicorn and NGINX which keep the server sockets open between restarts. This makes sure that no pending requests are dropped while the restart is taking place.

For more, see the Restart documentation.

Signals

Puma responds to several signals. A detailed guide to using UNIX signals with Puma can be found in the Signals documentation.

Platform Constraints

Some platforms do not support all Puma features.

  • JRuby, Windows: server sockets are not seamless on restart, they must be closed and reopened. These platforms have no way to pass descriptors into a new process that is exposed to Ruby. Also, cluster mode is not supported due to a lack of fork(2).
  • Windows: Cluster mode is not supported due to a lack of fork(2).
  • Kubernetes: The way Kubernetes handles pod shutdowns interacts poorly with server processes implementing graceful shutdown, like Puma. See the kubernetes section of the documentation for more details.

Known Bugs

For MRI versions 2.2.7, 2.2.8, 2.2.9, 2.2.10, 2.3.4 and 2.4.1, you may see stream closed in another thread (IOError). It may be caused by a Ruby bug. It can be fixed with the gem https://rubygems.org/gems/stopgap_13632:

if %w(2.2.7 2.2.8 2.2.9 2.2.10 2.3.4 2.4.1).include? RUBY_VERSION
  begin
    require 'stopgap_13632'
  rescue LoadError
  end
end

Deployment

  • Puma has support for Capistrano with an external gem.

  • Additionally, Puma has support for built-in daemonization via the puma-daemon ruby gem. The gem restores the daemonize option that was removed from Puma starting version 5, but only for MRI Ruby.

It is common to use process monitors with Puma. Modern process monitors like systemd or rc.d provide continuous monitoring and restarts for increased reliability in production environments:

Community guides:

Community Extensions

Plugins

  • puma-metrics β€”Β export Puma metrics to Prometheus
  • puma-plugin-statsd β€”Β send Puma metrics to statsd
  • puma-plugin-systemd β€”Β deeper integration with systemd for notify, status and watchdog. Puma 5.1.0 integrated notify and watchdog, which probably conflicts with this plugin. Puma 6.1.0 added status support which obsoletes the plugin entirely.
  • puma-plugin-telemetry - telemetry plugin for Puma offering various targets to publish
  • puma-acme - automatic SSL/HTTPS certificate provisioning and setup

Monitoring

  • puma-status β€”Β Monitor CPU/Mem/Load of running puma instances from the CLI

Contributing

Find details for contributing in the contribution guide.

License

Puma is copyright Evan Phoenix and contributors, licensed under the BSD 3-Clause license. See the included LICENSE file for details.

puma's People

Contributors

alexeevit avatar catsby avatar chulkilee avatar cjlarose avatar composerinteralia avatar deepj avatar dekellum avatar dentarg avatar eregon avatar evanphx avatar frodsan avatar grosser avatar headius avatar jacobherrington avatar jalevin avatar jc00ke avatar jesus avatar joshuay03 avatar juanitofatas avatar junaruga avatar lmarburger avatar luislavena avatar msp-greg avatar nateberkopec avatar olleolleolle avatar schneems avatar seven1m avatar spastorino avatar sumeka avatar wjordan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

puma's Issues

Socket 'already in use'

If there is a socket present, the server fails to start:

bundle exec puma -b unix:///var/run/website.sock
Puma 0.9.5 starting...
* Min threads: 0, max threads: 16
* Listening on unix:///var/run/website.sock
Address already in use - /var/run/website.sock

My first thought was to have Puma remove this socket file before it quits, but I'm not sure what the best-practices for UNIX socket file management are so I wanted to file a ticket before sending any pull requests so the bearded unix wizards could chime in.

This is being connected to an nginx proxy, so it's possible that nginx is holding this file open and that's what's causing the problem.

wrong number of arguments (4 for 3)

Getting this when shutting down:

Puma 1.1.1 starting...
* Min threads: 0, max threads: 16
* Listening on tcp://0.0.0.0:5000
Use Ctrl-C to stop
127.0.0.1 - - [31/Mar/2012 10:32:10] "GET /about/api HTTP/1.1" 200 ["44311"] 1.2284
^C - Gracefully stopping, waiting for requests to finish
wrong number of arguments (4 for 3)

Add -p and --port flag

It would be useful if puma supported the -p and --port flags like the rackup command so it can be run on any port.

Build error with JRuby 1.6.7 and XCode 4.3

$ jgem install puma
Building native extensions.  This could take a while...
ERROR:  Error installing puma:
    ERROR: Failed to build gem native extension.

        /Users/carl/.rvm/rubies/jruby-1.6.7/bin/jruby extconf.rb
WARNING: JRuby does not support native extensions or the `mkmf' library very well.
Check http://kenai.com/projects/jruby/pages/Home for alternatives.
creating Makefile

make
cc -I. -I/Users/carl/.rvm/rubies/jruby-1.6.7/lib/native/include -I/Users/carl/.rvm/rubies/jruby-1.6.7/lib/native/include/ruby -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE      -fPIC -DTARGET_RT_MAC_CFM=0  -fno-omit-frame-pointer -fno-strict-aliasing  -fexceptions    -arch i386 -c http11_parser.c
cc -I. -I/Users/carl/.rvm/rubies/jruby-1.6.7/lib/native/include -I/Users/carl/.rvm/rubies/jruby-1.6.7/lib/native/include/ruby -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE      -fPIC -DTARGET_RT_MAC_CFM=0  -fno-omit-frame-pointer -fno-strict-aliasing  -fexceptions    -arch i386 -c puma_http11.c
cc -dynamic -bundle -undefined dynamic_lookup  -o puma_http11.bundle http11_parser.o puma_http11.o -L"." -L"/Users/carl/.rvm/rubies/jruby-1.6.7/lib" -bundle -framework JavaVM -Wl,-syslibroot, -mmacosx-version-min=10.5   -arch i386  
ld: library not found for -lbundle1.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [puma_http11.bundle] Error 1


Gem files will remain installed in /Users/carl/.rvm/gems/jruby-1.6.7/gems/puma-1.0.0 for inspection.
Results logged to /Users/carl/.rvm/gems/jruby-1.6.7/gems/puma-1.0.0/ext/puma_http11/gem_make.out

Odd error on shutdown on JRuby

I'm seeing a peculiar error on shutdown in JRuby:

system /tmp/app $ puma config.ru 
Puma 0.9.3 starting...
* Min threads: 0, max threads: 16
* Listening on tcp://0.0.0.0:4567
== Sinatra/1.3.2 has taken the stage on 4567 for development with backup from Puma
^C
== Sinatra has ended his set (crowd applauds)
missing run or map statement

Investigating.

load error: puma/puma_http11 -- java.lang.UnsatisfiedLinkError

Hi,

I was interested in checking back to Puma since 1.0.0 got released. Locally it works fine and I am not experiencing any issues with JRuby or hanging processes anymore. I wanted to do some basic benchmarking on a fresh Ubuntu-Server install and when I try to boot up Puma in my Rails app, it aborts with the following error:

bundle exec puma
LoadError: load error: puma/puma_http11 -- java.lang.UnsatisfiedLinkError: failed to load shim library, error: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by /usr/local/rvm/rubies/jruby-1.6.7/lib/native/x86_64-Linux/libjruby-cext.so)
  require at org/jruby/RubyKernel.java:1033
   (root) at /usr/local/rvm/gems/jruby-1.6.7/gems/puma-1.0.0/lib/puma/server.rb:10
  require at org/jruby/RubyKernel.java:1033
   (root) at /usr/local/rvm/gems/jruby-1.6.7/gems/puma-1.0.0/lib/puma/server.rb:4
  require at org/jruby/RubyKernel.java:1033
   (root) at /usr/local/rvm/gems/jruby-1.6.7/gems/puma-1.0.0/lib/puma/cli.rb:6
     load at org/jruby/RubyKernel.java:1058
   (root) at /usr/local/rvm/gems/jruby-1.6.7/bin/puma:19

Any idea what might be causing this issue? Is it a missing package?

  • Latest JRuby
  • Latest Rails
  • Latest Puma

Thanks!

Provide an option to daemonize and better restart

I'm trying to integrate puma in a capistrano recipe, however puma does not offer, afaik, ways to daemonize the process.

When using nohup and stdout/stderr redirection in capistrano during a run command, depending on the pty setting the process may not start on the remote server.

Also using "cd #{current_path} && bundle exec pumactl -S /tmp/puma.state restart" pumactl assumes that the file exists, otherwise it will throw an error.

In capistrano this can be solved by :on_error => :continue on the directive, however I think that puma should try to restart in some way after it failed to find the puma.state file. Perhaps it can follow the thin example and accept again a -C flag.

Otherwise we can just issue stop and/or leave the job to monit or similar but losing the unicorn-like restart feature.

Ruby Implementations?

I was wondering, while posting a comment on another issue:

Was Puma developed for a specific Ruby implementation? What Ruby implementation do you recommend to use with Puma? Ruby 1.9.3? Rubinius? JRuby? Or any of them? What are the benefits of each?

When concurrency comes to mind, I think of threads. Looking at Puma's help screen I see that it utilizes them. I would assume an implementation where the global interpreter lock isn't present would benefit the most from this app server, in which case that would mean either Rubinius or JRuby. (Not sure whether JRuby would work using a non-Java app server, would it?)

In the past I've tried to utilize Rubinius's threading capabilities using other Ruby App servers like Rainbows using the ThreadPool/Spawn strategy, but without success. The processes kept hanging or time out and I'm not sure how or why that happened. I eventually gave up on it. Someone then later pointed out that what we need a new app server that was built for concurrency/threading from the ground up because existing solutions weren't really capable enough. Today I see Puma and I'm wondering: "Is this it?" :)

Trimming in thread pool can result in requests hanging

With default AutoTrim settings, there is potential for requests to get stuck waiting on an available worker:

  1. A long-running request is made, adding work to Queue and spawning a worker thread. There are now more than min workers alive.
  2. The autotrim thread wakes up and, seeing threads that could be trimmed, adds a Trim to the Queue.
  3. Second request is made while the first request is still working. New worker thread is spawned because there are no threads waiting on the Queue. Work is added to Queue.
  4. Newly spawned worker thread pops Trim off of Queue, and promptly kills itself
  5. Second request is still in Queue, but there is only 1 worker thread now, and it's still busy with the first request. Second request now hangs until first request completes (or another request comes in, spawning new thread).

"cannot load such file -- rack/handler/puma" unless launching Puma directly

Platform info:

$ uname -a
Linux roamer 3.3.1-1-ARCH #1 SMP PREEMPT Tue Apr 3 06:46:17 UTC 2012 x86_64 Intel(R) Core(TM) i7-2670QM CPU @ 2.20GHz GenuineIntel GNU/Linux
$ ruby -v
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux]
$ rails -v
Rails 3.2.3
$ puma -v
puma: version unknown

(The Puma version is the current most recent, 1.2.1)

Server launch attempts:

trevor@roamer:~/projects/brainbox (ruby-1.9.3-p125@brainbox) (master)
$ puma
Puma 1.2.1 starting...
* Min threads: 0, max threads: 16
* Listening on tcp://0.0.0.0:9292
Use Ctrl-C to stop
127.0.0.1 - - [13/Apr/2012 11:10:27] "GET %2Findex.html HTTP/1.1" 304 - 0.3744
127.0.0.1 - - [13/Apr/2012 11:10:27] "GET /rails.png HTTP/1.1" 304 - 0.3463
127.0.0.1 - - [13/Apr/2012 11:10:27] "GET %2Ffavicon.ico HTTP/1.1" 304 - 0.0009
127.0.0.1 - - [13/Apr/2012 11:10:29] "GET /rails/info/properties HTTP/1.1" 200 - 0.0723
^C - Gracefully stopping, waiting for requests to finish
 - Goodbye!
trevor@roamer:~/projects/brainbox (ruby-1.9.3-p125@brainbox) (master)
$ puma config.ru
Puma 1.2.1 starting...
* Min threads: 0, max threads: 16
* Listening on tcp://0.0.0.0:9292
Use Ctrl-C to stop
127.0.0.1 - - [13/Apr/2012 10:59:11] "GET %2Findex.html HTTP/1.1" 200 5906 0.4748
127.0.0.1 - - [13/Apr/2012 10:59:11] "GET /rails.png HTTP/1.1" 200 6646 0.3122
127.0.0.1 - - [13/Apr/2012 10:59:11] "GET %2Ffavicon.ico HTTP/1.1" 200 - 0.0011
127.0.0.1 - - [13/Apr/2012 10:59:14] "GET /rails/info/properties HTTP/1.1" 200 - 0.0755
^C - Gracefully stopping, waiting for requests to finish
 - Goodbye!
trevor@roamer:~/projects/brainbox (ruby-1.9.3-p125@brainbox) (master)
$ rails s puma
Exiting
/home/trevor/.rvm/gems/ruby-1.9.3-p125@brainbox/gems/rack-1.4.1/lib/rack/handler.rb:63:in `require': cannot load such file -- rack/handler/puma (LoadError)
        from /home/trevor/.rvm/gems/ruby-1.9.3-p125@brainbox/gems/rack-1.4.1/lib/rack/handler.rb:63:in `try_require'
        from /home/trevor/.rvm/gems/ruby-1.9.3-p125@brainbox/gems/rack-1.4.1/lib/rack/handler.rb:16:in `get'
        from /home/trevor/.rvm/gems/ruby-1.9.3-p125@brainbox/gems/rack-1.4.1/lib/rack/server.rb:269:in `server'
        from /home/trevor/.rvm/gems/ruby-1.9.3-p125@brainbox/gems/railties-3.2.3/lib/rails/commands/server.rb:59:in `start'
        from /home/trevor/.rvm/gems/ruby-1.9.3-p125@brainbox/gems/railties-3.2.3/lib/rails/commands.rb:55:in `block in <top (required)>'
        from /home/trevor/.rvm/gems/ruby-1.9.3-p125@brainbox/gems/railties-3.2.3/lib/rails/commands.rb:50:in `tap'
        from /home/trevor/.rvm/gems/ruby-1.9.3-p125@brainbox/gems/railties-3.2.3/lib/rails/commands.rb:50:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'
trevor@roamer:~/projects/brainbox (ruby-1.9.3-p125@brainbox) (master)
$ rackup -s puma
/home/trevor/.rvm/gems/ruby-1.9.3-p125@brainbox/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- rack/handler/puma (LoadError)
        from /home/trevor/.rvm/gems/ruby-1.9.3-p125@brainbox/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `block in require'
        from /home/trevor/.rvm/gems/ruby-1.9.3-p125@brainbox/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
        from /home/trevor/.rvm/gems/ruby-1.9.3-p125@brainbox/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
        from /home/trevor/.rvm/gems/ruby-1.9.3-p125@brainbox/gems/rack-1.4.1/lib/rack/handler.rb:63:in `try_require'
        from /home/trevor/.rvm/gems/ruby-1.9.3-p125@brainbox/gems/rack-1.4.1/lib/rack/handler.rb:16:in `get'
        from /home/trevor/.rvm/gems/ruby-1.9.3-p125@brainbox/gems/rack-1.4.1/lib/rack/server.rb:269:in `server'
        from /home/trevor/.rvm/gems/ruby-1.9.3-p125@brainbox/gems/rack-1.4.1/lib/rack/server.rb:208:in `block in logging_middleware'
        from /home/trevor/.rvm/gems/ruby-1.9.3-p125@brainbox/gems/rack-1.4.1/lib/rack/server.rb:292:in `call'
        from /home/trevor/.rvm/gems/ruby-1.9.3-p125@brainbox/gems/rack-1.4.1/lib/rack/server.rb:292:in `block in build_app'
        from /home/trevor/.rvm/gems/ruby-1.9.3-p125@brainbox/gems/rack-1.4.1/lib/rack/server.rb:291:in `reverse_each'
        from /home/trevor/.rvm/gems/ruby-1.9.3-p125@brainbox/gems/rack-1.4.1/lib/rack/server.rb:291:in `build_app'
        from /home/trevor/.rvm/gems/ruby-1.9.3-p125@brainbox/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app'
        from /home/trevor/.rvm/gems/ruby-1.9.3-p125@brainbox/gems/rack-1.4.1/lib/rack/server.rb:252:in `start'
        from /home/trevor/.rvm/gems/ruby-1.9.3-p125@brainbox/gems/rack-1.4.1/lib/rack/server.rb:137:in `start'
        from /home/trevor/.rvm/gems/ruby-1.9.3-p125@brainbox/gems/rack-1.4.1/bin/rackup:4:in `<top (required)>'
        from /home/trevor/.rvm/gems/ruby-1.9.3-p125@brainbox/bin/rackup:19:in `load'
        from /home/trevor/.rvm/gems/ruby-1.9.3-p125@brainbox/bin/rackup:19:in `<main>'

Large bodies without content-length header

Puma doesn't seem to handle large bodies (64k) when the response headers don't contain the content-length header. As a result I had a few pages of my application that ended with a "Failed to load resource" in Chrome (and apparently a truncated body sent to the browser) when served by Puma. They worked without issue when served by Thin.
After adding the Rack::ContentLength middleware it works fine with Puma as well.

uninitialized constant Rubinius::FROM_AGENT (NameError)

I've tried 0.9.3, 0.9.2 and 0.9.0 releases of the Puma gem on Rubinius in the hope that I could get around this. All requests to the app immediately make Puma die.

$ rails s puma
=> Booting Puma
=> Rails 3.2.0 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Puma 0.9.2 starting...
* Min threads: 0, max threads: 16
* Listening on tcp://0.0.0.0:3000
Exiting
An exception occurred running script/rails
    uninitialized constant Rubinius::FROM_AGENT (NameError)

User defined backtrace:

Backtrace:
  ActiveSupport::Dependencies(Module)#load_missing_constant at \
          /Users/mathiasx/Developer/.rvm/gems/rbx-head@peculiarity/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:520
  { } in ActiveSupport::Dependencies::ModuleConstMissing(Module)#const_missing at \
          /Users/mathiasx/Developer/.rvm/gems/rbx-head@peculiarity/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:192
                            Array#each at kernel/bootstrap/array.rb:68
  ActiveSupport::Dependencies::ModuleConstMissing(Module)#const_missing at \
          /Users/mathiasx/Developer/.rvm/gems/rbx-head@peculiarity/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:190
  { } in Rubinius::AgentRegistry.spawn_thread at kernel/delta/agent.rb:52
                        Thread#__run__ at kernel/bootstrap/thread.rb:146

Here's my RVM info:

$ rvm info

rbx-head@peculiarity:

  system:
    uname:       "Darwin banshee.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386"
    bash:        "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)"
    zsh:         "/bin/zsh => zsh 4.3.9 (i386-apple-darwin10.0)"

  rvm:
    version:      "rvm 1.10.2 by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.beginrescueend.com/]"
    updated:      "21 hours 54 minutes 21 seconds ago"

  ruby:
    interpreter:  "rubinius"
    version:      "2.0.0dev"
    date:         "rubinius 2.0.0dev (1.8.7 70773724 yyyy-mm-dd JI) [x86_64-apple-darwin10.8.0]"
    platform:     "x86_64-apple-darwin10.8.0"
    patchlevel:   "1.8.7 70773724 yyyy-mm-dd JI"
    full_version: "rubinius 2.0.0dev (1.8.7 70773724 yyyy-mm-dd JI) [x86_64-apple-darwin10.8.0]"

  homes:
    gem:          "/Users/mathiasx/Developer/.rvm/gems/rbx-head@peculiarity"
    ruby:         "/Users/mathiasx/Developer/.rvm/rubies/rbx-head"

  binaries:
    ruby:         "/Users/mathiasx/Developer/.rvm/rubies/rbx-head/bin/ruby"
    irb:          "/Users/mathiasx/Developer/.rvm/rubies/rbx-head/bin/irb"
    gem:          "/Users/mathiasx/Developer/.rvm/rubies/rbx-head/bin/gem"
    rake:         "/Users/mathiasx/Developer/.rvm/gems/rbx-head@global/bin/rake"

  environment:
    PATH:         "/Users/mathiasx/Developer/.rvm/gems/rbx-head@peculiarity/bin:/Users/mathiasx/Developer/.rvm/gems/rbx-head@global/bin:/Users/mathiasx/Developer/.rvm/rubies/rbx-head/bin:/Users/mathiasx/Developer/.rvm/bin:/Users/mathiasx/Developer/share/python:/Users/mathiasx/Developer/share/npm/bin:/Users/mathiasx/Developer/Cellar/python/2.7/bin:/Users/mathiasx/Developer/bin:/Users/mathiasx/Developer/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/local/MacGPG2/bin:/usr/X11/bin"
    GEM_HOME:     "/Users/mathiasx/Developer/.rvm/gems/rbx-head@peculiarity"
    GEM_PATH:     "/Users/mathiasx/Developer/.rvm/gems/rbx-head@peculiarity:/Users/mathiasx/Developer/.rvm/gems/rbx-head@global"
    MY_RUBY_HOME: "/Users/mathiasx/Developer/.rvm/rubies/rbx-head"
    IRBRC:        "/Users/mathiasx/Developer/.rvm/rubies/rbx-head/.irbrc"
    RUBYOPT:      ""
    gemset:       "peculiarity"

error on request in jruby. java extension doesn't compile with bundler & jruby?

I've been toying with this for a while and can't work out what I may be doing wrong. Perhaps some local java / rvm / bundler setting. At any rate, if I use bundler to install puma from github, it doesn't appear as though the java version of the parser is compiled. I often get the following when I make a request:

java(6924,0x1159b6000) malloc: *** error for object 0x7faba290d340: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

If I clone the gem locally, rake compile (using jruby) and point bundler at the path, I do not get the error. So, this Gemfile results in everything working:

gem 'puma', :path => "~/dev/puma"

While this one does not:

gem 'puma', :git => 'https://github.com/evanphx/puma.git'

I can also confirm that, in the bundled gem from github, there is no jar in the lib/puma/ folder. When I rake:compile locally, I do see a puma_http11.jar in the lib/puma folder.

I may not be doing something right - perhaps this is just a problem with my local settings? Thanks!

Loading Incorrect Images

Images (notably css background images) are entirely incorrect, showing a different image. This hasn't surfaced in Webrick or Unicorn. I've seen it a few times in development, but it happens consistently in staging. Taking a look in the inspector and in logs the urls appear to be correct, but there is no mistaking that the image itself is mixed upβ€”the logo being replaced with a background tile, for example.

Verified in Chrome, Safari, and Firefox (hard reload in each of them). The interchanged images aren't the same across browsers, but the effect is present in all of them.

Here is the basic stack, ff there is any additional info I can provide let me know.

Ruby 1.9.3-p125, Rails 3.2.2, Puma with default of 0-16 threads.

Java thread exception with concurrent requests

I'm trying to test out concurrent requests w/puma. I can successfully call each of the routes below individually. When I try to call the long one, then the short while the long is executing, one of two things seem to happen:

  1. The short one never returns
  2. The short one returns, then the long one (as I'd expect), but then I get a Java exception.

Code & exception below:

Ruby (w/RVM):

jruby 1.6.5 (ruby-1.9.2-p136) (2011-10-25 9dcd388) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_29) [darwin-x86_64-java]

Gemfile:

gem 'rack'
gem 'jruby-rack'
gem 'puma'
gem 'sinatra'
gem 'jdbc-mysql'
gem 'sequel'

config.ru:

require 'tester'
Tester.run!

tester.rb:

require 'sinatra/base'
require 'sequel'

class Tester < Sinatra::Base
  set :server, :puma

  get '/short' do
    db = Sequel.connect("jdbc:mysql://localhost/test?user=root")    
    db.run "select sleep(1)"
    "Hello!"
 end

  get '/long' do
    db = Sequel.connect("jdbc:mysql://localhost/test?user=root")
    db.run "select sleep(20)"
    "Long Hello!"
  end

end

Exception:

Exception in thread "RubyThread-5: /Users/bporterfield/.rvm/gems/jruby-1.6.5@2j/gems/puma-0.9.2-java/lib/puma/thread_pool.rb:49" java.nio.channels.IllegalBlockingModeException

Full rackup to stacktrace here: http://pastebin.com/PZ22bhx2

all requests on a single thread

I've just tried puma on a rails 3.1.1 app. I added 'config.threadsafe!' to 'config/environments/production.rb' and get the following output when I boot the app:

⚑ RAILS_ENV=production bundle exec puma --threads 0:3
Puma 0.9.1 starting...
* Min threads: 0, max threads: 3
* Listening on tcp://0.0.0.0:9292
Use Ctrl-C to stop

I then created a controller action that looks like this:

def index
    product.connection.select_all("select sleep(10)")
    render :text => "I should have taken 10 seconds! (id: #{Thread.current.object_id})"
end

If I make 2 concurrent requests they seem to execute serially and the thread ID is identical. Am I missing something?

Rails 3.1.3 - JRuby 1.6.5.1 - Sun Java 7: Does Not Respond To Requests

Hello,

I started a brand new app today and I wanted to try Puma out with JRuby but unfortunately I was unable to get it to respond to requests. Here is some info:

  • jruby 1.6.5.1 (ruby-1.8.7-p330) (2011-12-27 1bf37c2) (Java HotSpot(TM) 64-Bit Server VM 1.7.0) [linux-amd64-java]

  • Rails 3.1.3

  • puma 0.9.3

  • Rack 1.3.6

    I created a brand new application added puma to my GemFile and when I run the following command it starts up but when I try to hit the site from the browser nothing happens and it just sits there.

~/temp/test_app$ rails s puma
=> Booting Puma
=> Rails 3.1.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Puma 0.9.3 starting...

  • Min threads: 0, max threads: 16
  • Listening on tcp://0.0.0.0:3000

I also tried just running puma without the rails call and same issue. I'm not sure if there are any logs that I can help with but let me know.

Rack::Request.scheme should return https if running SSLServer

Appears as though 5abf158 makes Rack::Request.scheme return http in some cases when running sslserver.

To test - config.ru:

class Test
  def call(env)
    request = Rack::Request.new(env)
    return [200, {}, ["#{request.scheme}"]]
  end
end
run Test.new

Starting with: puma -b tcp://127.0.0.1:3000 config.ru and hitting http://localhost:3000 returns http.

Starting with

puma -b 'ssl://127.0.0.1:3000?key=puma/puma_keypair.pem&cert=puma/cert_puma.pem' config.ru

and hitting https://localhost:3000 still returns http.

Thanks!

Listen loop error: #<IOError: closed stream>

I'm experimenting with using puma to run my jruby rails tests via the capybara-puma gem.

On startup I get issue #32 and when the tests finish, I get a bunch of these errors:

Mon Mar 26 12:22:53 -0400 2012: Listen loop error: #<IOError: closed stream>
org/jruby/RubyIO.java:3362:in `select'
/Users/docwhat/.rvm/gems/jruby-1.6.7@cxo/gems/puma-0.9.5-java/lib/puma/server.rb:159:in `run'
org/jruby/RubyProc.java:270:in `call'
org/jruby/RubyProc.java:224:in `call'

Code Reloading

A small code review led me to one interesting feature of the Puma control server: the /reload action.

When I've set up Puma with the following command:

% bundle exec puma --control 'tcp://127.0.0.1:1337' --control-token 'foo'
Puma 1.1.1 starting...
* Min threads: 0, max threads: 16
* Listening on tcp://0.0.0.0:9292
* Starting status server on tcp://127.0.0.1:1337
Use Ctrl-C to stop

and executed the following command:

% curl 'http://127.0.0.1:1337/restart?token=foo'

I got no output from curl among with the following strange output from Puma process:

* Restarting...
Puma 1.1.1 starting...
* Min threads: 0, max threads: 16
* Listening on tcp://0.0.0.0:9292
* Starting status server on tcp://127.0.0.1:1337
Address already in use - bind(2)

The Puma process was terminated. Is this bug or feature?

Won't work with Rails 3.0.x because of Rack 1.2.x bug

Problem

  1. If you use Rails 3.0.12, you are stuck with Rack 1.2.5
  2. Rack 1.2.5 blows up if env['CONTENT_TYPE'] == "" and you call Rack::Request#media_type (or any other method that calls it, such as the very common pattern Rack::Request.new(env).params) per a bug that was fixed in later versions
  3. At the same time, Rack::Lint complains if you set env['CONTENT_TYPE'] to nil.

Possible solution

I think unicorn (accidentially? intentionally?) solves this by defaulting to text/html... but I could be wrong:

# https://github.com/defunkt/unicorn/blob/master/lib/unicorn/cgi_wrapper.rb#L95
@head[CONTENT_TYPE] ||= "text/html"

So puma could default to text/html (?).

RACK_ENV not defaulted to 'development' until after config.ru loads

While RACK_ENV defaults to development properly, it's not set until after the config.ru is evaluated, meaning you can't, eg, conditionally load middleware.

Consider the following rackup file. Other servers, including rackup will print development while puma spits out nil.

p ENV['RACK_ENV']
run ->(e){[200,{},[]]}

(PS: puma is awesome. thank you!)

JRuby 1.6.6 + Rails 3.2.1 | Lots of errors?

Using JRuby 1.6.6, Rails 3.2.1

Running: bundle exec puma -b tcp://0.0.0.0:3000

On a bare Rails 3.2.1 app, on the basic Rails index.html with the rails.png image, when you hold CMD+R and spam refresh on the browser, eventually within about 10 seconds the following exception will be raised:

java(9162,0x10f01e000) malloc: *** error for object 0x7f9739c22bb0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

Also occasionally see this:

Exception in thread "RubyThread-9: /Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/thread_pool.rb:55" java.nio.channels.IllegalBlockingModeException
    at java.nio.channels.spi.AbstractSelectableChannel.configureBlocking(AbstractSelectableChannel.java:257)
    at org.jruby.util.io.SelectBlob.tidyUp(SelectBlob.java:335)
    at org.jruby.util.io.SelectBlob.goForIt(SelectBlob.java:86)
    at org.jruby.RubyIO.select_static(RubyIO.java:3351)
    at org.jruby.RubyIO.select(RubyIO.java:3347)
    at org.jruby.RubyIO$s$0$3$select.call(RubyIO$s$0$3$select.gen:65535)
    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:69)
    at org.jruby.ast.CallManyArgsNode.interpret(CallManyArgsNode.java:59)
    at org.jruby.ast.LocalAsgnNode.interpret(LocalAsgnNode.java:123)
    at org.jruby.ast.IfNode.interpret(IfNode.java:111)
    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
    at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    at org.jruby.ast.IfNode.interpret(IfNode.java:119)
    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
    at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    at org.jruby.ast.IfNode.interpret(IfNode.java:117)
    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
    at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    at org.jruby.ast.WhileNode.interpret(WhileNode.java:131)
    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
    at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    at org.jruby.ast.WhileNode.interpret(WhileNode.java:131)
    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
    at org.jruby.ast.RescueNode.executeBody(RescueNode.java:216)
    at org.jruby.ast.RescueNode.interpretWithJavaExceptions(RescueNode.java:120)
    at org.jruby.ast.RescueNode.interpret(RescueNode.java:110)
    at org.jruby.ast.EnsureNode.interpret(EnsureNode.java:96)
    at org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
    at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    at org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
    at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:190)
    at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:199)
    at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:312)
    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:169)
    at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
    at org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
    at org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:212)
    at org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:200)
    at org.jruby.runtime.Interpreted19Block.call(Interpreted19Block.java:131)
    at org.jruby.runtime.Block.call(Block.java:89)
    at org.jruby.RubyProc.call(RubyProc.java:270)
    at org.jruby.RubyProc.call19(RubyProc.java:258)
    at org.jruby.RubyProc$i$0$0$call19.call(RubyProc$i$0$0$call19.gen:65535)
    at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:211)
    at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:207)
    at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:312)
    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:169)
    at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
    at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    at org.jruby.ast.WhileNode.interpret(WhileNode.java:131)
    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
    at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    at org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
    at org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:212)0:0:0:0:0:0:0:1%0 - - [10/Feb/
    at org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:200)
2012 18:14:20] "GET /index.html HTTP/1.1" 304 - 0.0120
    at org.jruby.runtime.Interpreted19Block.call(Interpreted19Block.java:131)
    at org.jruby.runtime.Block.call(Block.java:89)
    at org.jruby.RubyProc.call(RubyProc.java:270)
    at org.jruby.RubyProc.call(RubyProc.java:224)
    at org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:95)
    at java.lang.Thread.run(Thread.java:680)

Another thing I noticed is when running Puma through Bundler, two processes seem to stay running. Is this normal? What is the other process doing? One is using about 200mb ram, the other is using 130mb ram. When running Puma without using Bundler I get this:

/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:6 warning: already initialized constant HTTP_STATUS_CODES
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:47 warning: already initialized constant STATUS_WITH_NO_ENTITY_BODY
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:66 warning: already initialized constant PERSISTENT_TIMEOUT
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:68 warning: already initialized constant DATE
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:70 warning: already initialized constant SCRIPT_NAME
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:73 warning: already initialized constant REQUEST_URI
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:74 warning: already initialized constant REQUEST_PATH
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:76 warning: already initialized constant PATH_INFO
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:78 warning: already initialized constant VERSION
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:78 warning: already initialized constant PUMA_VERSION
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:80 warning: already initialized constant PUMA_TMP_BASE
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:83 warning: already initialized constant ERROR_404_RESPONSE
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:85 warning: already initialized constant CONTENT_LENGTH
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:88 warning: already initialized constant ERROR_503_RESPONSE
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:91 warning: already initialized constant CHUNK_SIZE
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:95 warning: already initialized constant MAX_HEADER
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:98 warning: already initialized constant MAX_BODY
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:101 warning: already initialized constant STATUS_FORMAT
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:103 warning: already initialized constant CONTENT_TYPE
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:105 warning: already initialized constant LAST_MODIFIED
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:106 warning: already initialized constant ETAG
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:107 warning: already initialized constant SLASH
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:108 warning: already initialized constant REQUEST_METHOD
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:109 warning: already initialized constant GET
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:110 warning: already initialized constant HEAD
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:112 warning: already initialized constant ETAG_FORMAT
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:113 warning: already initialized constant LINE_END
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:114 warning: already initialized constant REMOTE_ADDR
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:115 warning: already initialized constant HTTP_X_FORWARDED_FOR
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:116 warning: already initialized constant HTTP_IF_MODIFIED_SINCE
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:117 warning: already initialized constant HTTP_IF_NONE_MATCH
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:118 warning: already initialized constant REDIRECT
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:119 warning: already initialized constant HOST
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:121 warning: already initialized constant SERVER_NAME
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:122 warning: already initialized constant SERVER_PORT
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:123 warning: already initialized constant HTTP_HOST
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:124 warning: already initialized constant PORT_80
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:126 warning: already initialized constant SERVER_PROTOCOL
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:127 warning: already initialized constant HTTP_11
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:128 warning: already initialized constant HTTP_10
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:130 warning: already initialized constant SERVER_SOFTWARE
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:131 warning: already initialized constant GATEWAY_INTERFACE
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:132 warning: already initialized constant CGI_VER
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:134 warning: already initialized constant STOP_COMMAND
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:135 warning: already initialized constant HALT_COMMAND
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:137 warning: already initialized constant RACK_INPUT
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:138 warning: already initialized constant RACK_URL_SCHEME
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:139 warning: already initialized constant RACK_AFTER_REPLY
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:141 warning: already initialized constant HTTP
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:142 warning: already initialized constant HTTPS
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:144 warning: already initialized constant HTTPS_KEY
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:146 warning: already initialized constant HTTP_VERSION
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:147 warning: already initialized constant HTTP_CONNECTION
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:149 warning: already initialized constant HTTP_11_200
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:150 warning: already initialized constant HTTP_10_200
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:152 warning: already initialized constant CLOSE
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:153 warning: already initialized constant KEEP_ALIVE
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:155 warning: already initialized constant CONTENT_LENGTH2
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:156 warning: already initialized constant CONTENT_LENGTH_S
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:157 warning: already initialized constant TRANSFER_ENCODING
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:159 warning: already initialized constant CONNECTION_CLOSE
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:160 warning: already initialized constant CONNECTION_KEEP_ALIVE
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:162 warning: already initialized constant TRANSFER_ENCODING_CHUNKED
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:163 warning: already initialized constant CLOSE_CHUNKED
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:165 warning: already initialized constant COLON
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/const.rb:167 warning: already initialized constant NEWLINE
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/events.rb:45 warning: already initialized constant DEFAULT
/Users/Michael/.rvm/gems/jruby-1.6.6/bundler/gems/puma-256970e0487b/lib/puma/server.rb:324 warning: already initialized constant EmptyBody
LoadError: no such file to load -- openssl/digest
        require at org/jruby/RubyKernel.java:1036
         (root) at /Users/Michael/.rvm/gems/jruby-1.6.6/gems/net-ssh-2.3.0/lib/net/ssh/transport/hmac/abstract.rb:2
        require at org/jruby/RubyKernel.java:1036
         (root) at /Users/Michael/.rvm/gems/jruby-1.6.6/gems/net-ssh-2.3.0/lib/net/ssh/transport/hmac/abstract.rb:1
        require at org/jruby/RubyKernel.java:1036
         (root) at /Users/Michael/.rvm/gems/jruby-1.6.6/gems/net-ssh-2.3.0/lib/net/ssh/transport/hmac/md5.rb:2
        require at org/jruby/RubyKernel.java:1036
         (root) at /Users/Michael/.rvm/gems/jruby-1.6.6/gems/net-ssh-2.3.0/lib/net/ssh/transport/hmac.rb:6
        require at org/jruby/RubyKernel.java:1036
         (root) at /Users/Michael/.rvm/gems/jruby-1.6.6/gems/net-ssh-2.3.0/lib/net/ssh/transport/algorithms.rb:7
        require at org/jruby/RubyKernel.java:1036
         (root) at /Users/Michael/.rvm/gems/jruby-1.6.6/gems/net-ssh-2.3.0/lib/net/ssh/transport/session.rb:10
        require at org/jruby/RubyKernel.java:1036
         (root) at /Users/Michael/.rvm/gems/jruby-1.6.6/gems/net-ssh-2.3.0/lib/net/ssh.rb:2
        require at org/jruby/RubyKernel.java:1036
         (root) at /Users/Michael/.rvm/gems/jruby-1.6.6/gems/net-ssh-gateway-1.1.0/lib/net/ssh/gateway.rb:2
        require at org/jruby/RubyKernel.java:1036
         (root) at /Users/Michael/.rvm/gems/jruby-1.6.6/gems/capistrano-2.9.0/lib/capistrano/configuration/connections.rb:4
        require at org/jruby/RubyKernel.java:1036
         (root) at /Users/Michael/.rvm/gems/jruby-1.6.6/gems/capistrano-2.9.0/lib/capistrano/configuration.rb:1
        require at org/jruby/RubyKernel.java:1036
        require at /Users/Michael/.rvm/gems/jruby-1.6.6/gems/capistrano-2.9.0/lib/capistrano.rb:68
           each at org/jruby/RubyArray.java:1614
        require at /Users/Michael/.rvm/gems/jruby-1.6.6/gems/bundler-1.0.21/lib/bundler/runtime.rb:66
           each at org/jruby/RubyArray.java:1614
        require at /Users/Michael/.rvm/gems/jruby-1.6.6/gems/bundler-1.0.21/lib/bundler/runtime.rb:55
        require at /Users/Michael/.rvm/gems/jruby-1.6.6/gems/bundler-1.0.21/lib/bundler.rb:122
         (root) at /Users/Michael/Desktop/hirefire-2/config/application.rb:13
        require at org/jruby/RubyKernel.java:1036
        require at /Users/Michael/.rvm/rubies/jruby-1.6.6/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36
         (root) at /Users/Michael/Desktop/hirefire-2/config/application.rb:2
        require at org/jruby/RubyKernel.java:1036
        require at /Users/Michael/.rvm/rubies/jruby-1.6.6/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36
     parse_file at /Users/Michael/Desktop/hirefire-2/config/environment.rb:4
  instance_eval at org/jruby/RubyBasicObject.java:1726
     initialize at /Users/Michael/.rvm/gems/jruby-1.6.6/gems/rack-1.4.1/lib/rack/builder.rb:51
     parse_file at config.ru:1
           eval at org/jruby/RubyKernel.java:1082
     parse_file at /Users/Michael/.rvm/gems/jruby-1.6.6/gems/rack-1.4.1/lib/rack/builder.rb:40
            app at /Users/Michael/.rvm/gems/jruby-1.6.6/gems/puma-0.9.3-java/lib/puma/configuration.rb:56
            run at /Users/Michael/.rvm/gems/jruby-1.6.6/gems/puma-0.9.3-java/lib/puma/cli.rb:215
         (root) at /Users/Michael/.rvm/gems/jruby-1.6.6/gems/puma-0.9.3-java/bin/puma:11
           load at org/jruby/RubyKernel.java:1062
         (root) at /Users/Michael/.rvm/gems/jruby-1.6.6/bin/puma:19

"Deprecation warning: Database connections will not be closed automatically"

I'm using Puma with Sinatra and ActiveRecord, and I've noticed a few lines being written to STDERR which I'm stuck with:

DEPRECATION WARNING: Database connections will not be closed automatically, please close your
database connection at the end of the thread by calling `close` on your
connection.  For example: ActiveRecord::Base.connection.close
. (called from mon_synchronize at /usr/local/lib/ruby/1.9.1/monitor.rb:211)

I'm using MRI, I can't test this on jRuby because less.rb demands therubyracer, which won't compile ⚑ 😞 ⚑

Is there a fix for this?

all Sinatra routes are accessed twice

Starting the samle Sinatra app

# myapp.rb
require 'sinatra'

get '/' do
  'Hello world!'
end

will result in this:

% ruby sinatra.rb -s puma                                                                                                                    
Puma 0.9.1 starting...
* Min threads: 0, max threads: 16
* Listening on tcp://0.0.0.0:4567
== Sinatra/1.3.1 has taken the stage on 4567 for development with backup from Puma
127.0.0.1 - - [13/Dec/2011 17:55:19] "GET / HTTP/1.1" 200 12 0.0045
127.0.0.1 - - [13/Dec/2011 17:55:19] "GET / HTTP/1.1" 200 12 0.1636
127.0.0.1 - - [13/Dec/2011 17:55:20] "GET /favicon.ico HTTP/1.1" 404 447 0.0028
127.0.0.1 - - [13/Dec/2011 17:55:20] "GET /favicon.ico HTTP/1.1" 404 447 0.0030

PIDFile Support

You should drop pid files, or give an option to. Otherwise people are forced to use evil methods to generate a pid file or do more stupid actions.

cannot load such file -- puma/compat

I get the following when running rails s puma on 1.1.0 -- 1.0.0 works fine.

~/code/vm[master]% rails s puma 
/Users/jkmiller/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- puma/compat (LoadError)
    from /Users/jkmiller/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/jkmiller/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/jkmiller/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require'
    from /Users/jkmiller/.rvm/gems/ruby-1.9.3-p125/gems/puma-1.1.0/lib/puma/server.rb:8:in `<top (required)>'
    from /Users/jkmiller/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require'
    from /Users/jkmiller/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/jkmiller/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/jkmiller/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require'
    from /Users/jkmiller/.rvm/gems/ruby-1.9.3-p125/gems/puma-1.1.0/lib/puma.rb:14:in `<top (required)>'
    from /Users/jkmiller/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.3/lib/bundler/runtime.rb:68:in `require'
    from /Users/jkmiller/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.3/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from /Users/jkmiller/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.3/lib/bundler/runtime.rb:66:in `each'
    from /Users/jkmiller/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.3/lib/bundler/runtime.rb:66:in `block in require'
    from /Users/jkmiller/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in `each'
    from /Users/jkmiller/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in `require'
    from /Users/jkmiller/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.3/lib/bundler.rb:119:in `require'
    from /Users/jkmiller/code/vm/config/application.rb:7:in `<top (required)>'
    from /Users/jkmiller/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.2/lib/rails/commands.rb:53:in `require'
    from /Users/jkmiller/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.2/lib/rails/commands.rb:53:in `block in <top (required)>'
    from /Users/jkmiller/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.2/lib/rails/commands.rb:50:in `tap'
    from /Users/jkmiller/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.2/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Can't use sockets with rails

rails s puma works fine, but I get the following when appending -b unix://tmp/sockets/puma.sock:

=> Booting Puma
=> Rails 3.2.2 application starting in development on http://unix://tmp/sockets/puma.sock:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Puma 0.9.4 starting...

  • Min threads: 0, max threads: 16
  • Listening on tcp://unix://tmp/sockets/puma.sock:3000
    Exiting
    /usr/lib/ruby/gems/1.9.1/gems/puma-0.9.4/lib/puma/server.rb:103:in `initialize': getaddrinfo: Name or service not known (SocketError)

HTTP Parse Error

=> Booting Puma
=> Rails 3.1.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Puma 0.9.2 starting...
* Min threads: 0, max threads: 16
* Listening on tcp://0.0.0.0:3000
2012-01-06 08:55:26 -0800: HTTP parse error, malformed request (): #<Puma::HttpParserError: HTTP element FIELD_VALUE is longer than the 80 * 1024 allowed length.>
2012-01-06 08:55:26 -0800: ENV: {"rack.version"=>[1, 1], "rack.errors"=>#\>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>true, "SCRIPT_NAME"=>"", "CONTENT_TYPE"=>"", "QUERY_STRING"=>"", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"0.9.2", "GATEWAY_INTERFACE"=>"CGI/1.2"}

---
2012-01-06 08:55:29 -0800: HTTP parse error, malformed request (): #<Puma::HttpParserError: HTTP element FIELD_VALUE is longer than the 80 * 1024 allowed length.>
2012-01-06 08:55:29 -0800: ENV: {"rack.version"=>[1, 1], "rack.errors"=>#>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>true, "SCRIPT_NAME"=>"", "CONTENT_TYPE"=>"", "QUERY_STRING"=>"", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"0.9.2", "GATEWAY_INTERFACE"=>"CGI/1.2"}

---
2012-01-06 08:55:47 -0800: HTTP parse error, malformed request (): #<Puma::HttpParserError: HTTP element FIELD_VALUE is longer than the 80 * 1024 allowed length.>
2012-01-06 08:55:47 -0800: ENV: {"rack.version"=>[1, 1], "rack.errors"=>#>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>true, "SCRIPT_NAME"=>"", "CONTENT_TYPE"=>"", "QUERY_STRING"=>"", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"0.9.2", "GATEWAY_INTERFACE"=>"CGI/1.2"}

---

cannot install puma into rbx

This might be a rubinius or rubygems issue, but I'll start here. I'm trying to install puma into rubinius but it doesn't install the dependencies automatically:

$ ruby -v
rubinius 2.0.0dev (1.8.7 e3a8a1ca yyyy-mm-dd JI) [x86_64-apple-darwin11.1.0]
$ gem install puma
Fetching: puma-0.8.1.gem (100%)
ERROR:  Error installing puma:
    puma requires rack (~> 1.3, runtime)

In ruby193 it installs the dependency as you'd expect:

$ gem install puma
Fetching: rack-1.3.5.gem (100%)
Fetching: puma-0.8.1.gem (100%)
Building native extensions.  This could take a while...
Successfully installed rack-1.3.5
Successfully installed puma-0.8.1
2 gems installed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.