Files | Admin

Notes:

Release Name: 0.92.0

Notes:
Rainbows! is an HTTP server for sleepy Rack applications.  It is based on
Unicorn, but designed to handle applications that expect long
request/response times and/or slow clients.  For Rack applications not
heavily bound by slow external network dependencies, consider Unicorn
instead as it simpler and easier to debug.

* http://rainbows.rubyforge.org/
* rainbows-talk@rubyforge.org
* git://git.bogomips.org/rainbows.git

Changes:

Mostly internal cleanups and small improvements.

The only backwards incompatible change was the addition of the
"client_max_body_size" parameter to limit upload sizes to
prevent DoS.  This defaults to one megabyte (same as nginx), so
any apps relying on the limit-less behavior of previous will
have to configure this in the Unicorn/Rainbows! config file:

      Rainbows! do
	# nil for unlimited, or any number in bytes
	client_max_body_size nil
      end

The ThreadSpawn and ThreadPool models are now optimized for serving
large static files under Ruby 1.9 using IO.copy_stream[1].

The EventMachine model has always had optimized static file
serving (using EM::Connection#stream_file_data[2]).

The EventMachine model (finally) gets conditionally deferred app
dispatch in a separate thread, as described by Ezra Zygmuntowicz
for Merb, Ebb and Thin[3].

[1] - http://euruko2008.csrug.cz/system/assets/documents/0000/0007/tanaka-IOcopy_stream-euruko2008.pdf
[2] - http://eventmachine.rubyforge.org/EventMachine/Connection.html#M000312
[3] - http://brainspl.at/articles/2008/04/18/deferred-requests-with-merb-ebb-and-thin



Changes: .document | 2 +- .gitignore | 1 + DEPLOY | 26 +++--- Documentation/comparison.haml | 2 +- GIT-VERSION-GEN | 2 +- GNUmakefile | 25 ++++-- README | 9 +- Rakefile | 7 ++ SIGNALS | 6 +- TODO | 7 +- config/.gitignore | 1 + config/isolate.rb | 25 +++++ lib/rainbows.rb | 28 +++++- lib/rainbows/base.rb | 40 ++++++-- lib/rainbows/const.rb | 5 +- lib/rainbows/ev_core.rb | 44 ++++++++- lib/rainbows/event_machine.rb | 53 +++++++++- lib/rainbows/event_machine_defer.rb | 59 ----------- lib/rainbows/fiber/base.rb | 6 +- lib/rainbows/fiber/rev.rb | 2 +- lib/rainbows/http_response.rb | 41 ++++---- lib/rainbows/http_server.rb | 19 +++- lib/rainbows/max_body.rb | 82 +++++++++++++++ lib/rainbows/rev/deferred_response.rb | 21 ++-- lib/rainbows/revactor.rb | 42 +++++++- lib/rainbows/revactor/tee_input.rb | 52 ---------- lib/rainbows/tee_input.rb | 17 +++ local.mk.sample | 36 +++----- rainbows.gemspec | 4 +- t/app_deferred.ru | 23 +++++ t/async_examples/async_app.ru | 16 ++-- t/rack-fiber_pool/app.ru | 5 + t/simple-http_EventMachineDefer.ru | 11 -- ...ammer.sh => t0100-rack-input-hammer-chunked.sh} | 2 +- ...h => t0100-rack-input-hammer-content-length.sh} | 6 +- t/t0103-rack-input-limit.sh | 60 +++++++++++ t/t0104-rack-input-limit-tiny.sh | 62 ++++++++++++ t/t0105-rack-input-limit-bigger.sh | 105 ++++++++++++++++++++ t/t0401-em-async-tailer.sh | 2 +- t/t0600-rack-fiber_pool.sh | 49 +++++++++ t/t0700-app-deferred.sh | 45 +++++++++ t/test-lib.sh | 1 + 42 files changed, 795 insertions(+), 256 deletions(-) commit 0619e62285d25763ac1dee8a9aab18da7d39f80e Author: Eric Wong Date: Tue May 4 14:02:26 2010 -0700 Rainbows! 0.92.0 - inching towards the pot of gold Mostly internal cleanups and small improvements. The only backwards incompatible change was the addition of the "client_max_body_size" parameter to limit upload sizes to prevent DoS. This defaults to one megabyte (same as nginx), so any apps relying on the limit-less behavior of previous will have to configure this in the Unicorn/Rainbows! config file: Rainbows! do # nil for unlimited, or any number in bytes client_max_body_size nil end The ThreadSpawn and ThreadPool models are now optimized for serving large static files under Ruby 1.9 using IO.copy_stream[1]. The EventMachine model has always had optimized static file serving (using EM::Connection#stream_file_data[2]). The EventMachine model (finally) gets conditionally deferred app dispatch in a separate thread, as described by Ezra Zygmuntowicz for Merb, Ebb and Thin[3]. [1] - http://euruko2008.csrug.cz/system/assets/documents/0000/0007/tanaka-IOcopy_stream-euruko2008.pdf [2] - http://eventmachine.rubyforge.org/EventMachine/Connection.html#M000312 [3] - http://brainspl.at/articles/2008/04/18/deferred-requests-with-merb-ebb-and-thin commit ec50b892e5d3bc6f585780ebbbf071d489b2c3ae Author: Eric Wong Date: Tue May 4 14:56:44 2010 -0700 revactor: match IO behavior for readpartial wrapper IO#readpartial on zero bytes will always return an empty string, so ensure the emulator for Revactor does that as well. commit 3130edb35b3289149cbe7a36ce4e86406a39de35 Author: Eric Wong Date: Tue May 4 14:27:06 2010 -0700 TODO: fix rdoc link commit 47ab2c1e81251abc36ca83565292c3ecdfc33eeb Author: Eric Wong Date: Tue May 4 14:01:00 2010 -0700 tee_input: remember "encoding: binary" comment Even if it's just an empty file for now, it's critical in case we ever add any code that returns user-visible strings since Rack::Lint (and mere sanity) require binary encoding for "rack.input". commit 53be61846ad12d1ae243e287f81608b43fbdd318 Author: Eric Wong Date: Tue May 4 13:58:14 2010 -0700 gemspec: bump Unicorn dependency We expect no API changes in Unicorn for a while commit 588af09a7fa0a950d711c3828c93a6a9414daacf Author: Eric Wong Date: Tue May 4 13:54:23 2010 -0700 local.mk.sample: isolate needs the correct Rake commit 89841227d51977cc58e77b68309d4aef633fa61e Author: Eric Wong Date: Tue May 4 13:52:56 2010 -0700 doc: DEPLOY - more strongly recommend Rainbows!-only Paragraph ordering matters psychologically. commit 52b306c5cd47e34644f7ec5f7ab100855929b618 Author: Eric Wong Date: Tue May 4 13:47:11 2010 -0700 eventmachine: "rack.multithread" is always true when deferring Since deferred requests run in a separate thread, this affects the root (non-deferred) thread as well since it may share data with other threads. commit e8cedc2584d23a8ab214ff96a973dc37344c2796 Author: Eric Wong Date: Tue May 4 13:41:55 2010 -0700 drop EventMachineDefer concurrency model Since we have conditional deferred execution in the regular EventMachine concurrency model, we can drop this one. This concurrency model never fully worked due to lack of graceful shut downs, and was never promoted nor supported, either. commit e61f0f4f901848e59b7b756224c765afde217a71 Author: Eric Wong Date: Tue May 4 13:37:28 2010 -0700 SIGNALS: document app.deferred? caveat for graceful shutdown There doesn't appear to be a good/easy way to do this with the built-in EventMachine thread pool :/ commit def62fdc46f064ad61491021d46d223abe68100d Author: Eric Wong Date: Tue May 4 13:33:25 2010 -0700 TODO: update EventMachine-related bits commit 57909fb76dd0bcf95bed94ec41933ec85afda885 Author: Eric Wong Date: Tue May 4 13:23:38 2010 -0700 eventmachine: add app.deferred?(env) support as middleware Merb (and possibly other) frameworks that support conditionally deferred app dispatch can now use it just like Ebb and Thin. http://brainspl.at/articles/2008/04/18/deferred-requests-with-merb-ebb-and-thin commit dcf280239978e00435760470b5ddf67254312c75 Author: Eric Wong Date: Mon May 3 18:51:18 2010 -0700 event_machine: update documentation for async frameworks commit 96f06e8171a4145feca8c750011cdd1d84a7b948 Author: Eric Wong Date: Mon May 3 18:22:08 2010 -0700 doc: misc updates * avoid needless links to /Rainbows.html * keepalive_timeout has been 5 seconds by default for a while * update "Gemcutter" references to "RubyGems.org" commit 60c57382638c8be81fe6163d1728415c494ad4f8 Author: Eric Wong Date: Mon May 3 18:16:24 2010 -0700 doc: RDoc 2.5.x updates commit de3bcfe3ba9402bd510f7414df1763b6b99dae47 Author: Eric Wong Date: Mon May 3 17:56:00 2010 -0700 cleanup request size limiting for TeeInput users WAvoid mucking with Unicorn::TeeInput, since other apps may depend on that class, so we subclass it as Rainbows::TeeInput and modify as necessary in worker processes. For Revactor, remove the special-cased Rainbows::Revactor::TeeInput class and instead emulate readpartial for Revactor sockets instead. commit 54cae80e543a6f4ca6456fe07b88aba867d215a6 Author: Eric Wong Date: Mon May 3 17:17:13 2010 -0700 max_body: remove extraneous debug message commit 798f5e3a507c20b4abf03aa8313659d3f632a0fa Author: Eric Wong Date: Mon May 3 15:19:53 2010 -0700 t0100: rack-input-hammer tests identity encodings, too It turns out we were painfully lacking in tests for HTTP requests where the Content-Length header _is_ set. commit 9f1131f5972ba90c1c54c76cc97633447142b307 Author: Eric Wong Date: Mon May 3 15:19:53 2010 -0700 add client_max_body_size config directive Since Rainbows! is supported when exposed directly to the Internet, administrators may want to limit the amount of data a user may upload in a single request body to prevent a denial-of-service via disk space exhaustion. This amount may be specified in bytes, the default limit being 1024*1024 bytes (1 megabyte). To override this default, a user may specify `client_max_body_size' in the Rainbows! block of their server config file: Rainbows! do client_max_body_size 10 * 1024 * 1024 end Clients that exceed the limit will get a "413 Request Entity Too Large" response if the request body is too large and the connection will close. For chunked requests, we have no choice but to interrupt during the client upload since we have no prior knowledge of the request body size. commit 1f3de8f8940fc7805c54d3d27e2074632ab5a0b0 Author: Eric Wong Date: Mon May 3 15:19:45 2010 -0700 t0401: do not leave lingering tail(1) processes Since Rainbows! allows for graceful termination, let EM kill and reap the tail(1) processes it spawned. commit b1153164af2f51dd5994f0efac6ea81adffdfee1 Author: Eric Wong Date: Tue Apr 27 11:16:52 2010 -0700 gemspec: update comments for gem dependencies commit 1d3bd978aa990fdd01ec4cd15a1b7276b91ffef6 Author: Eric Wong Date: Tue Apr 27 11:14:47 2010 -0700 dev: isolate: bump Unicorn test dependency commit 7faf47b6bc50de4387697a90480e354acd0c9917 Author: Eric Wong Date: Tue Apr 27 02:04:25 2010 -0700 base: status == 100 check needs to_i conversion Rack allows anything as the status, as long as it returns a valid status integer on status.to_i. commit 85316b09eba1443508e78237b56e42292ab3b127 Merge: 72fdcf1 3d0558d Author: Eric Wong Date: Mon Apr 19 15:45:44 2010 -0700 Merge branch 'maint' * maint: Rainbows! 0.91.1 - use a less-broken parser from Unicorn commit 72fdcf1c39c2a143d7abd8d2609e92311edff341 Author: Eric Wong Date: Mon Apr 19 01:04:47 2010 -0700 add test for the rack-fiber_pool gem with EventMachine Although advertised as being Thin-only, the rack-fiber_pool gem works with our EventMachine concurrency model as well. Note that it's impossible to expose the streaming "rack.input" behavior of the native FiberSpawn/FiberPool models via middleware, but most people don't need streaming a "rack.input" See http://github.com/mperham/rack-fiber_pool for more details on the rack-fiber_pool gem. commit 98622a1c291277ff124a586929c675e9ae67692e Author: Eric Wong Date: Sun Apr 18 21:33:40 2010 -0700 use the excellent `isolate' gem for dev It should make life easier when dealing with and testing complex dependencies, especially ones like Cramp which depend on prerelease versions of gems. commit b6dcf1343a379f0fb5de5cc551dbbf85da2b4cdf Author: Eric Wong Date: Sun Apr 18 21:24:07 2010 -0700 rev/deferred_response: cleanup and simplification We can use the new HttpResponse.header_string method now instead of writing an empty body. commit ea36bb312bd9a35f9621d1cc406f8d07a37c2a2a Author: Eric Wong Date: Sat Apr 17 11:08:22 2010 -0700 use IO.copy_stream for Thread{Spawn,Pool} under 1.9 This should be faster for serving static files and proxying IO objects such as sockets/pipes. Unfortunately we cannot use this reliably with non-blocking frameworks since IO.copy_stream will release the GVL to block on I/O (rather than yielding a fiber or returning from a callback). Can't do HTTP/1.1 Range support, though :/ commit 77f1e141e75f27b81bef5c3bddd01948d6236ebf Author: Eric Wong Date: Sat Apr 17 10:33:43 2010 -0700 http_response: split out header stringification code This will make it easier to use body#to_path if possible since some concurrency models like EventMachine have optimized code paths for serving static files. commit b07004fc79867ba8f0cacde1508fb1e4fbf4c37d Author: Eric Wong Date: Fri Apr 2 01:49:39 2010 -0700 rainbows/http_*: remove unnecessary circular requires http_response and http_server are never NOT loaded when "rainbows" is required. commit e0f9fb7cb8d8d47c68a9ebb0cb391d5880ca66d1 Author: Eric Wong Date: Fri Apr 2 01:32:40 2010 -0700 use duck typing for REMOTE_ADDR detection This gives us the option to use non-TCPSocket-derived IO-ish objects in the future, whatever that may be... commit b04d465d65f896290d36538181d91dd264d10575 Author: Eric Wong Date: Sun Mar 28 17:35:10 2010 -0700 cleanup: avoid redundant REMOTE_ADDR logic Every concurrency model does this the same way. This removes the Rainbows::Const::LOCALHOST constant and may break some existing apps that rely on it. commit 12a4c53a47bb0c7bef5e2df732fa02532a969a54 Author: Eric Wong Date: Sun Mar 28 17:04:36 2010 -0700 fiber/base: do not modify hash during iteration (1.9.2dev) It's generally dangerous to do so regardless of language and Ruby 1.9.2dev is stricter about this sort of behaviour. commit 801ea41a8f183785827f659fd4c1d49189797f58 Author: Eric Wong Date: Sun Mar 28 16:17:08 2010 -0700 local.mk.sample: bump neverblock test dep to 0.1.6.2 It continues to work with the old espace version from GitHub repos, too. commit 4619d902fb16f8eca76ea45948849490238879f9 Author: Eric Wong Date: Fri Mar 26 20:00:18 2010 -0700 async_examples/async_app: avoid needless UTF-8 Unicorn stopped reading all config.ru files as binary starting with 0.97.0 for compatibility with rackup(1), so systems that defaulted to US-ASCII encoding would have trouble running this.