Files | Admin

Notes:

Release Name: 0.95.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.

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

Changes:

In addition to the 1.9-only IO.copy_stream, the new sendfile
1.0.0 gem may optionally be used with most concurrency models
(even under 1.8).

See http://rainbows.rubyforge.org/Static_Files.html for more info

Other changes:

* 1.9 encoding bugfix for (Rev)FiberSpawn and FiberPool
* fixed potential rack.input corruption with Revactor
* ThreadPool graceful shutdown no longer blocks until timeout
* optional ServerToken middleware for to display Server: header
* Dependencies bumped to Rack 1.1+ and Unicorn 1.1.0+
* numerous internal cleanups, small bugfixes and speedups
* more concise website oriented at users



Changes: .document | 1 + GIT-VERSION-GEN | 2 +- GNUmakefile | 10 +- README | 18 ++- Static_Files | 71 +++++++ TODO | 12 ++ bin/rainbows | 5 +- lib/rainbows.rb | 61 ++----- lib/rainbows/actor_spawn.rb | 2 +- lib/rainbows/app_pool.rb | 2 +- lib/rainbows/base.rb | 168 ++++++++--------- lib/rainbows/byte_slice.rb | 17 ++ lib/rainbows/configurator.rb | 46 +++++ lib/rainbows/const.rb | 4 +- lib/rainbows/dev_fd_response.rb | 96 +++++----- lib/rainbows/error.rb | 1 + lib/rainbows/ev_core.rb | 5 +- lib/rainbows/event_machine.rb | 50 +++--- lib/rainbows/fiber.rb | 1 + lib/rainbows/fiber/base.rb | 70 +++---- lib/rainbows/fiber/body.rb | 34 ++++ lib/rainbows/fiber/io.rb | 36 +++- lib/rainbows/fiber/queue.rb | 1 + lib/rainbows/fiber/rev.rb | 6 +- lib/rainbows/fiber_pool.rb | 4 +- lib/rainbows/fiber_spawn.rb | 4 +- lib/rainbows/http_response.rb | 51 ++--- lib/rainbows/http_server.rb | 7 +- lib/rainbows/max_body.rb | 1 + lib/rainbows/never_block.rb | 9 +- lib/rainbows/never_block/event_machine.rb | 2 + lib/rainbows/queue_pool.rb | 1 + lib/rainbows/response.rb | 43 +++++ lib/rainbows/response/body.rb | 119 ++++++++++++ lib/rainbows/rev.rb | 2 + lib/rainbows/rev/client.rb | 88 ++++++++- lib/rainbows/rev/core.rb | 4 + lib/rainbows/rev/deferred_response.rb | 45 +----- lib/rainbows/rev/heartbeat.rb | 1 + lib/rainbows/rev/master.rb | 1 + lib/rainbows/rev/sendfile.rb | 26 +++ lib/rainbows/rev/thread.rb | 3 +- lib/rainbows/rev_fiber_spawn.rb | 4 +- lib/rainbows/rev_thread_pool.rb | 12 +- lib/rainbows/rev_thread_spawn.rb | 4 +- lib/rainbows/revactor.rb | 292 ++++++++++++++-------------- lib/rainbows/sendfile.rb | 31 +-- lib/rainbows/server_token.rb | 39 ++++ lib/rainbows/stream_file.rb | 14 ++ lib/rainbows/tee_input.rb | 1 + lib/rainbows/thread_pool.rb | 19 ++- lib/rainbows/thread_spawn.rb | 5 +- lib/rainbows/writer_thread_pool.rb | 20 ++- lib/rainbows/writer_thread_spawn.rb | 21 ++- rainbows.gemspec | 16 +- t/.gitignore | 2 +- t/GNUmakefile | 42 +++-- t/README | 2 +- t/async-response-no-autochunk.ru | 1 - t/async-response.ru | 1 - t/cramp/rainsocket.ru | 26 +++ t/fork-sleep.ru | 1 - t/my-tap-lib.sh | 5 +- t/simple-http_ActorSpawn.ru | 9 + t/t0009-broken-app.sh | 2 +- t/t0009.ru | 1 - t/t0011-close-on-exec-set.sh | 2 +- t/t0015-working_directory.sh | 56 ++++++ t/t0016-onenine-encoding-is-tricky.sh | 28 +++ t/t0016.rb | 15 ++ t/t0020-large-sendfile-response.sh | 141 ++++++++++++++ t/t0300-async_sinatra.sh | 6 - t/t0501-cramp-rainsocket.sh | 38 ++++ t/t9001-sendfile-to-path.sh | 9 +- t/t9002-server-token.sh | 37 ++++ t/t9002.ru | 4 + t/test-lib.sh | 2 +- t/test_isolate.rb | 25 ++- 78 files changed, 1437 insertions(+), 626 deletions(-) commit 5308c68e7e5b9d464f9f8c4252beff2d964bca1b Author: Eric Wong Date: Sat Jul 10 06:13:21 2010 +0000 Rainbows! 0.95.0 - sendfile() support! In addition to the 1.9-only IO.copy_stream, the new sendfile 1.0.0 gem may optionally be used with most concurrency models (even under 1.8). See http://rainbows.rubyforge.org/Static_Files.html for more info Other changes: * 1.9 encoding bugfix for (Rev)FiberSpawn and FiberPool * fixed potential rack.input corruption with Revactor * ThreadPool graceful shutdown no longer blocks until timeout * optional ServerToken middleware for to display Server: header * Dependencies bumped to Rack 1.1+ and Unicorn 1.1.0+ * numerous internal cleanups, small bugfixes and speedups * more concise website oriented at users commit d3b97d1114e2d23a9231fe889cd5bf6927d451ba Author: Eric Wong Date: Sat Jul 10 08:04:48 2010 +0000 doc: avoid documenting internals on RDoc website Since we suck at building websites, we just rely on RDoc as a website builder. And since Rainbows! is an application server (and not a programming library), our internal API should be of little interest to end users. Anybody interested in Rainbows! (or any other project) internals should be reading the source. commit 9838b614621bbbff27a91166406d833be85adbbd Author: Eric Wong Date: Sat Jul 10 07:26:33 2010 +0000 doc: Static_Files documentation Some folks may be interested in setting up Rainbows! as a static file server. commit 59f10a6dcf895b728bbc34546aebdb8bf25a1b0b Author: Eric Wong Date: Fri Jul 9 08:45:03 2010 +0000 event_machine: rename response_write => em_write_response For consistency with rev_write_response (and the existing "write_response"). commit e1c10949271a9cd3cbad86d05ce0436f2e79bc65 Author: Eric Wong Date: Fri Jul 9 08:30:15 2010 +0000 http_response: allow Cramp 0.11 to send proper WS headers Cramp needs to override our normal header sending for (old) WebSockets connections. commit 9abb447a573751b87e26ce35f4f05d58290f4c41 Author: Eric Wong Date: Thu Jul 8 23:21:18 2010 +0000 restore Rainbows::HttpResponse.write for Cramp Cramp monkey patches Rainbows internals for WebSockets support and we forgot about it. Add a new integration test to ensure this continues to work in the future (and force us to update the test for newer Cramp). commit 235985c6c4b37ed9a170c38052db3ef0772b1527 Author: Eric Wong Date: Thu Jul 8 19:26:33 2010 +0000 dev: bump isolate dependency to 2.1.0 commit 90933787f1a3cf5b8e2d0497b56a9541e2e492ad Author: Eric Wong Date: Thu Jul 8 09:33:21 2010 +0000 TODO: documentation needs work, so document it :P commit 772c7a486583630627f5de58aef82423487592e4 Author: Eric Wong Date: Thu Jul 8 09:29:18 2010 +0000 bump TCP_DEFER_ACCEPT default value Unicorn 1.1.0 lets us change this default, and we need it higher to avoid wasting workers against stupidly (or maliciously) slow clients. commit b07c3e00b390eebde32c762fd17ab387490c7552 Author: Eric Wong Date: Thu Jul 8 09:25:18 2010 +0000 bump unicorn dependencies commit 13baf8bd44683a376b79c01c3abbaa71e5b86a71 Author: Eric Wong Date: Wed Jul 7 08:30:22 2010 +0000 stream_file: split this out from rev/sendfile Other concurrency models will eventually be able to use it, too. commit 9ce364b079efdb3bcef504a84e2460a9b2b4b9ad Author: Eric Wong Date: Tue Jul 6 10:33:01 2010 +0000 byte_slice: String#[range] is faster than String#slice!(range) rb_str_slice_bang() allocates a new string internally and calls rb_str_aref_m() AND rb_str_aset_m(), too. String#[] just calls rb_str_aref_m() directly, so it's a much quicker code path. Also, "[]" methods dispatch faster under 1.9, too. commit 9ab356d3969779d7f8f4be6579bfa7570c703f21 Author: Eric Wong Date: Tue Jul 6 10:19:27 2010 +0000 doc: update TODO commit d2f240d7ea11738ba889668a669ffb7845d06e7b Author: Eric Wong Date: Tue Jul 6 09:58:40 2010 +0000 fix string slicing under 1.9 after short writes Fortunately this only affects the hardly-used FiberSpawn and FiberPool concurrency models, and also unreleased revisions of Rev. 1.9 encoding is tricky to handle right when doing I/O in Ruby... commit 0283928fca45a012b31662b30b49990dac2aae18 Author: Eric Wong Date: Tue Jul 6 08:53:54 2010 +0000 rev/client: more aggressive non-blocking write non-blocking write() may cause kernel buffers to be allocated behind the scenes, so retry the write() even if it's short because it may succeed the next time around. commit 8b65858a864aa0ecfa24ccf8f910c36af0ec1ad6 Author: Eric Wong Date: Tue Jul 6 04:01:30 2010 +0000 cleanup error handling for aborted downloads We shouldn't ever spew errors to the stderr/logger on client disconnects (ECONNRESET/EPIPE/etc...). commit d0a1fcaf25b10ff1d6894d50fa981f56169195f3 Author: Eric Wong Date: Tue Jul 6 02:05:01 2010 +0000 rev: avoid unnecessary seeking when using sendfile There's no need to ever change the underlying offset of a file descriptor when using sendfile(), so don't. This allows us to avoid contention in the kernel/filesystem and eventually reuse the same filesystem file descriptor for serving multiple requests. commit 70ad994ae8a854477e45c877cd0e9dda41389f86 Author: Eric Wong Date: Mon Jul 5 08:07:03 2010 +0000 rev: properly enable post-fork sendfile() usage We need to load sendfile-using parts after the "sendfile" library is loaded. commit 39b178cdebe275cbc8ce19cf269bea7cd15ff4ca Author: Eric Wong Date: Sun Jul 4 22:16:52 2010 +0000 refactor response body handling for sendfile(2) This hopefully allows the "sendfile" gem to be required anywhere in the Rainbows!/Unicorn config file, and not have to be required via RUBYOPT or the '-r' command-line switch. We also modularize HttpResponse and avoids singleton methods in the response path. This (hopefully) makes it easier for individual concurrency models to share code and override individual methods. commit 75f5aa9a0d6b37a94afbea3121fc2c16e70a2b1d Author: Eric Wong Date: Sun Jul 4 22:15:18 2010 +0000 rev/client: s/sendfile/rev_sendfile/ Avoid confusing people with an overloaded method name commit a5dc800d2e4b3a86466a03f45f64b97d29e4b11e Author: Eric Wong Date: Sun Jul 4 08:13:24 2010 +0000 revactor: properly zero buffer on zero reads While we're at it, fix a comment, too. commit e867a6d1a612baf7975b14f9bffa14ea8b05f35c Author: Eric Wong Date: Sun Jul 4 07:40:58 2010 +0000 thread_pool: force threads to wakeup on shutdown We may use a blocking accept() loop if there is only a single listener. In that case threads may not be able to exit if a SIGQUIT is received, so force them to run when joining. commit 7e3de7a12629423e911dae8955e7cc2035d6c401 Author: Eric Wong Date: Wed Jun 30 09:15:20 2010 +0000 rev: add sendfile support This should improve performance for static file responses. commit 280c6816ac4ebbfae8298871e125376d30ef5679 Author: Eric Wong Date: Wed Jun 30 08:13:07 2010 +0000 dev_fd_response: avoid redeclaring Rainbows module slowly cleaning up the generated RDoc commit 7495e0503f22f3cb89efcc3ae382f6544a6582e1 Author: Eric Wong Date: Wed Jun 30 08:06:06 2010 +0000 deferred_response: remove needless include commit c305d5efcd177d6516c7f0dd4f441b2605bdcdaa Author: Eric Wong Date: Mon Jun 28 09:02:34 2010 +0000 TODO: extra item for byte-range responses commit 8175a52c67fb9dfc9c04a7b0597b680699f43deb Author: Eric Wong Date: Mon Jun 28 08:06:32 2010 +0000 add preliminary sendfile (1.0.0) gem support This still needs work and lots of cleanup, but the basics are there. The sendfile 1.0.0 RubyGem is now safe to use under MRI 1.8, and is superior to current (1.9.2-preview3) versions of IO.copy_stream for static files in that it supports more platforms and doesn't truncate large files on 32-bit platforms. commit 86e9c7013308d77def5fe41b52a35dea60c7361c Author: Eric Wong Date: Mon Jun 28 06:29:54 2010 +0000 fiber/base: reuse process_client logic in base This fleshes out Rainbows::Fiber::IO with a few more methods for people using it. commit b75ad975856a681fe96651592b2bb24cc044fd50 Author: Eric Wong Date: Mon Jun 28 05:20:17 2010 +0000 (style) prefer "until" instead of "while !" commit eaf6cca3e1d38b7307c65c257b080041e65fd215 Author: Eric Wong Date: Mon Jun 28 05:14:23 2010 +0000 revactor: constant/namespace cleanups commit 5cde25e2fb6f7de9143a40da5bad4b91b582fcab Author: Eric Wong Date: Mon Jun 28 00:30:34 2010 +0000 base: constant/namespace cleanup commit 63d95ac64949a642596946b2b44b2d0bb7b9fefb Author: Eric Wong Date: Sun Jun 27 23:58:00 2010 +0000 http_response: make this a module, not a class No point in using a class here, there's no object commit 8756eac8c0e993caa6f704e27985405f6c9dfa7d Author: Eric Wong Date: Sun Jun 27 23:51:55 2010 +0000 http_response: (nitpick) simplify conditional logic commit 43745f26e201655f98351684e1d357cbd8c15b05 Author: Eric Wong Date: Sun Jun 27 23:36:51 2010 +0000 http_response: cleanup documentation No point in documenting our internals and overwhelming users. commit 4442a5f7d517645957d5a78911fec48010d3e6c7 Author: Eric Wong Date: Thu Jun 24 06:48:54 2010 +0000 sendfile: update docs for Rack::Sendfile Rack::Contrib::Sendfile moved into Rack in December 2009. commit 23551fb5241630e1c8d1ea3788defb4b5bcbe832 Author: Eric Wong Date: Mon Jun 21 08:03:01 2010 +0000 add Rainbows::Configurator module Make it easier to link to the Rainbows! configuration documentation without anchors. This also reduces the amount of code we spew into Unicorn::Configurator. commit c9a573e669e62e824f8e3cf37cd94162cd7a4170 Author: Eric Wong Date: Mon Jun 21 07:15:40 2010 +0000 tests: enable ActorSpawn test for rbx commit 4a132122eb4f931fa721a4ff5d2204486c0c3579 Author: Eric Wong Date: Mon Jun 21 07:15:22 2010 +0000 rev: documentation update for #write method commit f64a6781cbfbde40e4be6334520b1ff06a5e5626 Author: Eric Wong Date: Mon Jun 21 05:54:06 2010 +0000 dev_fd_response: disable under Rubinius for now We can't use it effectively in Rubinius yet, and it's broken due to the issue described in: http://github.com/evanphx/rubinius/issues/379 commit a4a3fbb761e5ae4f36e9dd84ad933c6df63975ba Author: Eric Wong Date: Mon Jun 21 05:48:45 2010 +0000 dev_fd_response: cleanup and reorganization There's no need to #dup the middleware object, just use a custom Rainbows::DevFdResponse::Body object. commit f2b75a59b54ec93e7fe0031d79127e2ed960725b Author: Eric Wong Date: Mon Jun 21 04:38:17 2010 +0000 test_isolate: bump unicorn dependency commit 212f60d37fdfe684dbaed047391b4276a30d200b Author: Eric Wong Date: Mon Jun 21 03:24:06 2010 +0000 test: no need for IO#sync=true in async-response tests We only read from the IO pipe and never write to it commit 5470d0688ec610861241408790d22b583e211ac5 Author: Eric Wong Date: Mon Jun 21 03:11:29 2010 +0000 tests: avoid embedded command-line switches in tests They're ugly and potentially non-portable to other servers. They also make Unicorn + Rubinius unhappy, which makes us unhappy as well. commit 51b2d65b081b0e802acdd25295e04889bbccaddc Author: Eric Wong Date: Mon Jun 21 03:00:30 2010 +0000 rev: restore Ruby 1.8.6 compatibility commit 82c93e28e743480d59c81406a3aaad3b6ba4269f Author: Eric Wong Date: Mon Jun 21 02:47:31 2010 +0000 bump async_sinatra test dependencies Everything should be working under Ruby 1.9.2(-preview3) now. commit 679a4b4673f66a299322facfe2acb8776bf61c00 Author: Eric Wong Date: Fri Jun 18 09:44:57 2010 +0000 rev: cleanup write method I was originally experimenting with setsockopt to increase the kernel buffer sizes in a loop, but the benefits were negligible at best. commit e5bd756d0a8ab73cab16facbd6f1b2275f6dfa21 Author: Eric Wong Date: Fri Jun 18 08:59:01 2010 +0000 rev: avoid extraneous data copy for small responses For small responses that can fit inside a kernel socket buffer, copying that data into an IO::Buffer object is a waste of precious memory bandwidth. commit b290a65eb735aa89bb071e27f8421cc864c78e8c Author: Eric Wong Date: Fri Jun 18 08:10:55 2010 +0000 fiber/{base,io}: use arrays instead of hashes for r/w accounting This gives a tiny performance improvement to the FiberSpawn and FiberPool concurrency models. commit b5a24fdbf928b675e478987393212651ef5909d6 Author: Eric Wong Date: Fri Jun 18 08:10:00 2010 +0000 fiber/base: more accurate sleep timeout Not that many people will actually call Rainbows.sleep outside of tests... commit fd1ec829c8c941143c8ae70b18e51838bc51da73 Author: Eric Wong Date: Fri Jun 18 06:47:52 2010 +0000 avoid needless HeaderHash#to_hash calls HeaderHash objects can only be used as headers without violating Rack::Lint in Rack 1.1.0 or later. commit ed9f3e90939cfa9efcc6e5e9382f1e1f40c49834 Author: Eric Wong Date: Fri Jun 18 06:41:58 2010 +0000 prefer Array#[] lookup to Array#first/Array#last Array#[] lookups are slightly faster under both rbx and 1.9, and easier to read. commit 0e4014888f4f7f17d45c96677d672a538c6e6d94 Author: Eric Wong Date: Wed Jun 16 09:53:32 2010 +0000 test_isolate: fix ruby engine usage Oops, looks like 1.9.1 exports the RUBY_ENGINE constant. commit 0a3e9cacd7ca2feb91bae23b0c678d5e986f866f Author: Eric Wong Date: Fri Jun 11 08:47:41 2010 +0000 update test infrastructure to support Rubinius Rubinius still has a few issues that prevent 100% support, but it basically works if log rotation or USR2 upgrades aren't required. Tickets for all known issues for Rubinius have been filed on the project's issue tracker. * rbx does not support -i/-p yet, so rely on MRI for that * "io/nonblock" is missing * avoiding any optional Gems for now (EM, Rev, etc..) commit 37687e027233072582c28bdd1530047a40ef7869 Author: Eric Wong Date: Fri Jun 11 02:27:49 2010 +0000 alt working_directory test from Unicorn commit aa402ca5c52ccf836d03e08a82c5a8392fca8f15 Author: Eric Wong Date: Fri Jun 11 02:24:00 2010 +0000 rely on Unicorn 0.991.0 for tests commit 0c08b142544e717ece5865869e14ead670f64eec Author: Eric Wong Date: Thu Jun 10 18:27:19 2010 -0700 bin/rainbows: sync up with latest Unicorn This will allow us to be working_directory-aware as far as config.ru goes. commit cf47d3e51d7b0aecdda8b0f27631161977900a47 Author: Eric Wong Date: Thu Jun 10 18:22:25 2010 -0700 add Rainbows::ServerToken middleware Some folks can now show off their Rainbows! installation commit b73218100032ead24360d33361fefa914074f30a Author: Eric Wong Date: Thu Jun 10 18:21:26 2010 -0700 my-tap-lib: fix race condition in verbose mode Don't try to redirect until we know our FIFO consumers are ready for us. This only seems to happen with bash and not ksh... commit d0a0883eaaeec37800ca5cd07647b7b66a00c453 in Unicorn commit d65fb5896d4c9d019b31834c131b5fb0306ba10e Author: Eric Wong Date: Wed Jun 9 21:44:43 2010 +0000 http_server: use super instead of alias_method duh! commit 3b4fa90bee97d2346644db004c37db5cb29cd9cf Author: Eric Wong Date: Tue Jun 8 09:52:27 2010 +0000 gemspec: bump unicorn dependency to 0.990.0 commit 6565060915266f053b5eb1c29a1cfbf825d430b0 Author: Eric Wong Date: Mon Jun 7 11:30:36 2010 -0700 README: update with Zbatery info commit e812eb864f88d88bb5e6bfdba617b03db2f07bfe Author: Eric Wong Date: Sun Jun 6 02:33:22 2010 +0000 tests: t9001: avoid needless filesystem activity commit b1315983056f91467b336aeb426759debc006a4e Author: Eric Wong Date: Sun Jun 6 02:14:58 2010 +0000 centralize body => IO conversion logic Since EventMachine and Rev shared the same logic for optimizing and avoiding extra file opens for IO/File-ish response bodies, so centralize that. For Ruby 1.9 users, we've also enabled this logic so ThreadPool, ThreadSpawn, WriterThreadPool, and WriterThreadSpawn can take advantage of Rainbows::DevFdResponse-generated bodies while proxying sockets.