about summary refs log tree commit homepage
path: root/lib/rainbows
DateCommit message (Collapse)
2020-01-09doc: switch bogomips.org to yhbt.net
bogomips.org is due to expire, soon, and I'm not willing to pay extortionists at Ethos Capital/PIR/ICANN to keep a .org. So it's at yhbt.net, for now... Identity is overrated. Tor users can use .onions and kick ICANN to the curb: torsocks w3m http://rainbows.ou63pmih66umazou.onion/ torsocks git clone http://ou63pmih66umazou.onion/rainbows.git/ torsocks w3m http://ou63pmih66umazou.onion/rainbows-public/ While we're at it, switch news.gmane.org => news.gmane.io (but I suspect that'll need to be resynched since our mail "List-Id:" header is changing).
2019-01-02quiet mismatched indentation warnings
Ruby trunk started warning about more mismatched indentations starting around r62836.
2017-01-12doc: additional disclaimers
Honestly, these disclaimers should've been there all along; and should apply to all servers handling multiple clients within a single process.
2017-01-09eventmachine: wait for deferred actions to finish em-deferred
Since EventMachine 1.0.0 in 2012, the EM.defers_finish? API exists to check for the existence of deferred actions. Support it if it exists in the running version of EM and update the note in our SIGNALS document. Thanks to <alex0375@gmail.com> on the mailing list for bringing this up: https://bogomips.org/rainbows-public/CAKwvcL-VH3we4qA1pkNAstTmWvqNA=Rir2N_YiWztV_qbaLQvA@mail.gmail.com/
2016-10-31doc: move homepage and update URLs to HTTPS
Let's Encrypt is working well for us and having fewer domains reduces subjectAltName bloat to speed up connection establishment HTTP will remain working indefinitely since some old systems do not have modern TLS stacks.
2015-11-24fix broken constant lookups in unmaintained bits
In case Revactor starts being maintained again... (heck, it was probably the reason I started Rainbows! in the first place...) Our ReverseProxy stuff was never complete nor marketed; and probably not worth keeping around at all.
2015-11-21response: simplify regexp
Redundant \z statements are ugly and wastes 4 bytes on x86-64 according to ObjectSpace.memsize_of
2015-11-21revactor: remove fcntl dependency
In the unlikely case somebody runs revactor, they won't need to load the extra fcntl.so library into their process anymore. In retrospect, we could've alway used IO#close_on_exec= since it appeared in 1.9.1 and (IIRC) revactor always required 1.9.1+
2015-11-21Ruby 1.9.3+-only cleanups
unicorn 5 will only support Ruby 1.9.3 and later, so remove some checks for Hash#compare_by_identity and IO.copy_stream which we know exist in Ruby 1.9. Favor &:sym proc dispatch to avoid unnecessary captures and bytecode size increases, too. Finally, ensure we fail fast by converting some literal hashes to use non-arrow syntax for symbolic keys.
2015-11-21tiny bytecode reductions for cold paths
Less code in cold paths can improve speed for hot paths. Single-byte strings for String#split is optimized in mainline Ruby, so it's not actually a performance loss for sendfile_range in response.rb Regexps are at least 400 bytes each, so prefer non-Regexps if possible, especially for cold sites where performance does not matter.
2015-11-21response: avoid garbage string entirely
Even with frozen string literals enabled in Ruby 2.3.0dev, dstrings still create garbage as the optimizer is not yet smart enough to optimize it despite the limited choice of internals being known. Maybe in the future Ruby will be smart enough, but not yet...
2015-11-21bump to unicorn 5.0.1, use monotonic clock
The timeout (mis)feature in unicorn uses the monotonic clock if available. We must follow suit to avoid having our timeout functionality completely broken.
2015-11-21stream_response_epoll: remove hijack_prepare call
unicorn 5.0.0 assumes Rack hijack is always available if the application tries to use it, so the wrapper method is removed.
2015-11-21http_server: add master_pid attribute
We'll need this for unicorn 5, as they dropped this publically accessible attribute while retaining the ivar. Eventually we may not have to check this attribute at all, instead detecting parent death via worker pipe.
2015-11-18http_parser: workaround hijack changes in unicorn 5
unicorn lost the hijack_setup method in version 5, so we must recreate it ourselves.
2015-11-18reduce constant lookup dependencies
Unicorn 5 removes some constants we were using, and constant lookups + inline caching are waste of time anyways on newer Rubies with the opt_str_freeze bytecode instruction. This may reduce performance for folks on older Rubies (probably not noticeable); but improves performance for folks on newer Rubies.
2015-11-18reflect changes in Rack::Utils::HTTP_STATUS_CODES
Applications may want to alter the message associated with HTTP status codes in Rack::Utils::HTTP_STATUS_CODES. Avoid memoizing status lines ahead-of-time Note: this introduces a minor performance regression, but ought to be unnoticeable unless you're running "Hello world"-type apps.
2015-11-18kill the moronic Status: header
Whatever compatibility reasons which existed in 2009 likely do not exist now. Other servers (e.g. thin, puma) seem to work alright without it, so there's no reason to waste precious bytes.
2015-11-18http_parser: handle keepalive_requests internally
unicorn 5 dropped support for this, essentially allowing unlimited persistent connections if we used the parser as-is. Since most of our concurrency models cannot handle infinite persistent connections without being vulnerable to DoS, we must support keepalive_requests like nginx does.
2015-10-14response: convert source arg to path before IO.copy_stream
This will allow us use the sendfile syscall under Linux on Ruby which favor #read/#readpartial methods for non-IO objects. This also allows us to revert changes made in commit db790ff3531acdfa23ab290998bba29360a6782b ("sync_close: This fix breakage from Ruby-trunk r50118")
2015-09-14sync_close: This fix breakage from Ruby-trunk r50118
By providing read+readpartial methods IO.copy_stream behaves slightly differently when operating on non-IO-subclassed objects nowadays. Ref: > * io.c (copy_stream_body): use the arguments without conversion if > having read, readpartial, and write methods, than conversion by > to_path method. [ruby-core:68676] [Bug #11015]
2015-09-14response: avoid unnecessary args to IO.copy_stream
Not all responses are seekable, so do not attempt to pass seek arguments to them since Ruby may attempt to seek (and fail!).
2014-05-12documentation updates for Rubyforge death
We're migrating to a new public-inbox[1] + mailing list rainbows-public@bogomips.org [1] http://public-inbox.org/
2014-01-29event_machine: update for unicorn 4.8.x
unicorn 4.8.x shutdown handling is different and no longer removes items from the event loop. So we must do that ourselves to enable graceful shutdown. Otherwise, we'll time out on shutdowns and the master will forcibly kill us.
2014-01-17unicorn 4.8 compatibility + test version bumps
Internal reworking of unicorn 4.8.0 completely broke us(!). This commit fixes things, but it means we no longer support unicorn <= 4.7. Sorry about that.
2014-01-17error: silence ETIMEDOUT and EHOSTUNREACH errors
There's nothing we can do about these errors due to network failures and bad clients, either, so do not spew a backtrace for them.
2013-03-01epoll+xepoll: clarify intent of these concurrency options
Via private communication, I learned of a user using XEpoll when he should not have been.
2013-02-26epoll/*: remove user-space array as active queue
This prevents pathological starvation cases where the user-space ready-list can be repopulated infinitely. With EPOLLONESHOT, epoll itself may be used for this task (at a slightly higher cost) by enabling read/write checks, as the epoll ready-list preserves event ordering when used with EPOLLONESHOT.
2013-02-26xepoll_thread_*/client: EPOLLONESHOT implies EPOLLET
No need to specify both flags for epoll (confirmed by reading fs/eventpoll.c in the Linux kernel).
2013-02-16GIT-VERSION-GEN: rewrite to manage RAINBOWS_VERSION const
This DRYs up versioning and makes packages easier to distribute.
2013-02-11hijacking support for Rack 1.5.x users
This requires Rack 1.5.x and unicorn 4.6.0 for hijacking support. Older versions of Rack continue to work fine, but we must use unicorn 4.6.0 features to support this.
2013-01-24epoll: ensure closing of pipelined clients if required
on_read normally relies on the close checking in on_readable, but on_deferred_write_complete may be called from on_writable instead (bypassing the close check of on_readable). This affects both Epoll and XEpoll users, but only if they were sending responses via body#to_path and triggering on_deferred_write_complete. While we're at it, favor non-recursive want_more instead of calling on_readable recursively in ev_write_responses to prevent stack growth.
2013-01-18Rainbows! 4.4.3 - bugfixes for EventMachine users v4.4.3
This release fixes two EventMachine bugfixes from Lin Jen-Shin and Mark J. Titorenko. There are also some minor cleanups. Lin Jen-Shin (1): event_machine: avoid close on deferred response Mark J. Titorenko (1): event_machine: join reactor_thread if it is already running Eric Wong (2): event_machine: cleanup confusing assignment t/GNUmakefile: cleanup test dependencies
2013-01-11event_machine: join reactor_thread if it is already running
...rather than falling through worker_loop Prior to the application of this patch, if an EventMachine reactor_thread has already been started elsewhere before the worker_loop is entered, the worker_loop exits as a second call to EM.run does not block the current thread. This patch causes the worker_loop thread to join the reactor_thread if it is running. [ew: commit message formatting] Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-12-19event_machine: cleanup confusing assignment
2012-12-18event_machine: avoid close on deferred response
close_connection_after_writing only if not deferred, as in cool.io Deferred responses may buffer more data down the line, so keep the connection alive if we have a deferred response body. [ew: clear @deferred when we really want to quit, updated commit message] Acked-by: Eric Wong <normalperson@yhbt.net>
2012-12-06Rainbows! 4.4.2 - EventMachine async.callback fix v4.4.2
One bugfix allows stream(:keep_open) in Sinatra to work properly. Thanks to W. Andrew Loe III for the informative bug report and reproducible test case. ref: http://mid.gmane.org/CA+-9oNd1EFqsniPkkPTwu5opTCinbM7-2KHoXov7+y3LE4s4Tg@mail.gmail.com
2012-12-05event_machine: properly defer body.close for async
Calling body.close in the normal write_response() code path is incorrect, and only worked out of sheer luck with Cramp and async_sinata. This change allows stream(:keep_open) in Sinatra to work properly. Thanks to W. Andrew Loe III for the informative bug report and reproducible test case. ref: http://mid.gmane.org/CA+-9oNd1EFqsniPkkPTwu5opTCinbM7-2KHoXov7+y3LE4s4Tg@mail.gmail.com
2012-08-31Rainbows! 4.4.1 - a minor bugfix for Fiber users v4.4.1
Fiber-based concurrency options avoids negative sleep intervals. Thanks to Lin Jen-Shin for pointing this out.
2012-08-27fiber/base: avoid negative sleep interval
Also clarify the code while we're at it. Thanks to Lin Jen-Shin for pointing this out. ref: http://mid.gmane.org/CAA2_N1unOXb7Z4Jr8oKoSLu266O9Ko4o=oWzAcMA1w3=9X74KA@mail.gmail.com
2012-08-18Rainbows! 4.4.0 - minor improvements v4.4.0
For epoll/Cool.io-based concurrency models, shutdown() is now used to timeout keepalive clients to avoid race conditions. Minor documentation improvements.
2012-07-19thread_timeout: document additional caveats
Again, for the one thousandth time, timing out threads is very tricky business :<
2012-07-01coolio+xepoll_thread*: use shutdown() for keepalive timeout
Triggering Errno::EBADF is tricky in multithreaded situations due to possible race conditions and yet-to-be discovered bugs. shutdown(2) is also safe against apps the fork() internally but do not execve(2) nor set FD_CLOEXEC. n.b. calling fork() after pthreads are spawned may not be safe on all platforms w.r.t. malloc, but /is/ the case for glibc on GNU/Linux. Follow-up-to: commit a5b987619f4b793203f6a50e424fe98c5b0794ba
2012-06-18epoll*: favor shutdown(2) for keepalive timeout
Triggering Errno::EBADF is tricky in multithreaded situations due to possible race conditions and yet-to-be discovered bugs. shutdown(2) is also safe against apps the fork() internally but do not execve(2) nor set FD_CLOEXEC. n.b. calling fork() after pthreads are spawned may not be safe on all platforms w.r.t. malloc, but /is/ the case for glibc on GNU/Linux.
2012-05-09fiber_pool: take Fibers from larger pools faster
Array#pop can be significantly faster than Array#shift on large arrays (especially since we push into the Array). This is because Array#shift needs to shift all elements in the array, and Array#pop only needs to shorten the array by one element. The Fiber stack may also be hotter in CPU caches when we choose the most-frequently used stack.
2012-05-09stream_response_epoll: fix for unicorn 4.3.x
unicorn 4.3.x now calls shutdown() explicitly on the socket, so we can't just rely on a dup()-ed FD to keep a socket around.
2012-04-12doc: some spelling fixes
Found with rdoc-spellcheck
2011-10-12http_server: fix log message if using Base (no concurrency)
Telling the user worker_connections=50 when using the Base concurrency model is misleading.
2011-09-02Rainbows! 4.3.1 - small bugfix v4.3.1
This release fixes a potential reentrancy deadlock when using the default logger from the Ruby standard library.
2011-08-30avoid potential Logger deadlock in SIGQUIT and SIGUSR1
If any combination of SIGQUIT and SIGUSR1 are sent to a Rainbows! worker in a /very/ short period of time, the Mutex used by the default Logger implementation may deadlock since Mutex synchronization is not reentrant-safe. Users of alternative logger implementations (or monkey-patched ones) are possibly not affected. Users of the logger_mp_safe.rb monkey-patch distributed[1] with unicorn are not affected. [1] http://unicorn.bogomips.org/examples/logger_mp_safe.rb