about summary refs log tree commit homepage
path: root/lib
DateCommit message (Collapse)
2009-10-09unicorn 0.93.3 v0.93.3
This release fixes compatibility with OpenBSD (and possibly other Unices with stricter fchmod(2) implementations) thanks to Jeremy Evans. Additionally there are small documentation changes all around. Eric Wong (11): doc: expand on the SELF_PIPE description fchmod heartbeat flips between 0/1 for compatibility examples/init.sh: remove "set -u" configurator: update with nginx fail_timeout=0 example PHILOSOPHY: clarify experience other deployments PHILOSOPHY: plug the Rainbows! spin-off project README: remove unnecessary and extraneous dash DESIGN: clarification and possibly improve HTML validity README: remove the "non-existent" part README: emphasize the "fast clients"-only part drop the whitespace cleaner for Ragel->C
2009-10-09configurator: update with nginx fail_timeout=0 example
It has come to our attention that this setting is not very well-known to the rest of the world...
2009-10-08fchmod heartbeat flips between 0/1 for compatibility
This removes the Time.now.to_i comparison that was used to avoid multiple, no-op fchmod() syscalls[1] within the same second. This should allow us to run on OpenBSD where it can raise EINVAL when Time.now.to_i is passed to it. Reported-by: Jeremy Evans <jeremyevans0@gmail.com> [1] - gettimeofday() from Time.now is not a real syscall on VDSO-enabled x86_64 GNU/Linux systems where Unicorn is primarily developed.
2009-10-07doc: expand on the SELF_PIPE description
There seems to be a small amount of confusion regarding how it's used (and some of the code is not very obvious). So explain our usage of it and distinguish its use in the master vs worker(s).
2009-10-07unicorn 0.93.2 v0.93.2
Avoid truncated POST bodies from with URL-encoded forms in Rails by switching TeeInput to use read-in-full semantics (only) when a Content-Length: header exists. Chunked request bodies continue to exhibit readpartial semantics to support simultaneous bidirectional chunking. The lack of return value checking in Rails to protect against a short ios.read(length) is entirely reasonable even if not pedantically correct. Most ios.read(length) implementations return the full amount requested except right before EOF. Also there are some minor documentation improvements. Eric Wong (7): Fix NEWS generation on single-paragraph tag messages Include GPLv2 in docs doc: make it clear contributors retain copyrights TODO: removed Rainbows! (see rainbows.rubyforge.org) Document the START_CTX hash contents more-compatible TeeInput#read for POSTs with Content-Length tests for read-in-full vs readpartial semantics
2009-10-06more-compatible TeeInput#read for POSTs with Content-Length
There are existing applications and libraries that don't check the return value of env['rack.input'].read(length) (like Rails :x). Those applications became broken under the IO#readpartial semantics of TeeInput#read when handling larger request bodies. We'll preserve the IO#readpartial semantics _only_ when handling chunked requests (as long as Rack allows it, it's useful for real-time processing of audio/video streaming uploads, especially with Rainbows! and mobile clients) but use read-in-full semantics for TeeInput#read on requests with a known Content-Length.
2009-10-05Document the START_CTX hash contents
Modifying this can be useful for esoteric cases like switching entire Ruby installations or if the app was originally started in a no-longer-existent directory and we can't upgrade because we can't chdir to it.
2009-10-02unicorn 0.93.1 v0.93.1
Fix permissions for release tarballs/gems, no other changes. Thanks to Jay Reitz for reporting this.
2009-10-02unicorn 0.93.0 v0.93.0
The one minor bugfix is only for Rails 2.3.x+ users who set the RAILS_RELATIVE_URL_ROOT environment variable in a config file. Users of the "--path" switch or those who set the environment variable in the shell were unaffected by this bug. Note that we still don't have relative URL root support for Rails < 2.3, and are unlikely to bother with it unless there is visible demand for it. New features includes support for :tries and :delay when specifying a "listen" in an after_fork hook. This was inspired by Chris Wanstrath's example of binding per-worker listen sockets in a loop while migrating (or upgrading) Unicorn. Setting a negative value for :tries means we'll retry the listen indefinitely until the socket becomes available. So you can do something like this in an after_fork hook: after_fork do |server, worker| addr = "127.0.0.1:#{9293 + worker.nr}" server.listen(addr, :tries => -1, :delay => 5) end There's also the usual round of added documentation, packaging fixes, code cleanups, small fixes and minor performance improvements that are viewable in the "git log" output. Eric Wong (54): build: hardcode the canonical git URL build: manifest dropped manpages build: smaller ChangeLog doc/LATEST: remove trailing newline http: don't force -fPIC if it can't be used .gitignore on *.rbc files Rubinius generates README/gemspec: a better description, hopefully GNUmakefile: add missing .manifest dep on test installs Add HACKING document configurator: fix user switch example in RDoc local.mk.sample: time and perms enforcement unicorn_rails: show "RAILS_ENV" in help message gemspec: compatibility with older Rubygems Split out KNOWN_ISSUES document KNOWN_ISSUES: add notes about the "isolate" gem gemspec: fix test_files regexp match gemspec: remove tests that fork from test_files test_signals: ensure we can parse pids in response GNUmakefile: cleanup test/manifest generation util: remove APPEND_FLAGS constant http_request: simplify and remove handle_body method http_response: simplify and remove const dependencies local.mk.sample: fix .js times TUNING: notes about benchmarking a high :backlog HttpServer#listen accepts :tries and :delay parameters "make install" avoids installing multiple .so objects Use Configurator#expand_addr in HttpServer#listen configurator: move initialization stuff to #initialize Remove "Z" constant for binary strings cgi_wrapper: don't warn about stdoutput usage cgi_wrapper: simplify status handling in response cgi_wrapper: use Array#concat instead of += server: correctly unset reexec_pid on child death configurator: update and modernize examples configurator: add colons in front of listen() options configurator: remove DEFAULT_LOGGER constant gemspec: clarify commented-out licenses section Add makefile targets for non-release installs cleanup: use question mark op for 1-byte comparisons RDoc for Unicorn::HttpServer::Worker small cleanup to pid file handling + documentation rails: RAILS_RELATIVE_URL_ROOT may be set in Unicorn config unicorn_rails: undeprecate --path switch manpages: document environment variables README: remove reference to different versions Avoid a small window when a pid file can be empty configurator: update some migration examples configurator: listen :delay must be Numeric test: don't rely on .manifest for test install SIGNALS: state that we stole semantics from nginx const: DEFAULT_PORT as a string doesn't make sense test_helper: unused_port rejects 8080 unconditionally GNUmakefile: SINCE variable may be unset tests: GIT-VERSION-GEN is a test install dependency
2009-10-02const: DEFAULT_PORT as a string doesn't make sense
TCP ports are always integers, and it was always allowing a randomly-generated value of 8080 through in the unused_port method of test_helper.
2009-10-02configurator: listen :delay must be Numeric
:delay may be a Float to represent fractional seconds.
2009-10-02configurator: update some migration examples
We now give an example of how a before_fork hook can be used to incrementally migrate off the old code base without hitting a thundering herd (especially in the "preload_app false") case. Also comment on the per-worker listen usage in the RDoc, not just a hidden comment.
2009-10-01Avoid a small window when a pid file can be empty
There's always been a small window of opportunity for a script to do File.read(pid).to_i would cause File.read() to read an empty file and return "". This closes that window while hopefully retaining backwards compatibility... We've always checked for dirname(pid) writability in Configurator, so we can safely write to a temporary file in the intended directory and then atomically rename() it to the destination path.
2009-09-30small cleanup to pid file handling + documentation
It's pointless to try and stat a file before trying to read it. Instead just try opening it and rescue ENOENT because it would've been racy anyways. Additionally add some comments to keep us from forgetting why we did the things we did with the pid file management.
2009-09-30RDoc for Unicorn::HttpServer::Worker
I'd rather document and maintain a stable interface for the Worker class than to have to deal with potential (portability and security) issues with with supporting user privilege management right now. There's already an example of user/group-switching support in the after_fork() hook and the error handling involved may be different depending on the application and environment so I remain hesitant to add official support for it...
2009-09-30cleanup: use question mark op for 1-byte comparisons
It's compatible with both Ruby 1.8 and 1.9 without needing a Range object.
2009-09-28configurator: remove DEFAULT_LOGGER constant
We no longer have external lookups for it so just stick it in the DEFAULTS hash for now. Since the Configurator::DEFAULTS hash can be considered a stable interface for other modules to interact with, they can eventually just use it instead of relying on another constant.
2009-09-28configurator: add colons in front of listen() options
Hopefuly make it more obvious that they're Ruby symbols and not strings. While we're at it, fix ordering of :{rcv,snd}buf descriptions to (logically) match the order of mention.
2009-09-28configurator: update and modernize examples
* Use the new :tries and :default parameters for listen() instead of the ugly and less-effective "rescue nil" * ActiveRecord connection management examples for hooks when using for "preload_app true" * combine "preload_app true" example with REE COW-friendly optimization for memory savings Some of these are based on Chris Wanstrath's configuration posted here: http://gist.github.com/189623
2009-09-27server: correctly unset reexec_pid on child death
Sometimes the upgraded version won't survive and we can fail to unset that pid and instead accidentally create a local variable. This is unlikely to be a problem in practice because this variable is immediately reclobbered when we fork.
2009-09-27cgi_wrapper: use Array#concat instead of +=
Array#concat avoids an intermediate Array object from being allocated (yes, still supporting Rails <= 1.2.x apps...)
2009-09-27cgi_wrapper: simplify status handling in response
Our HttpResponse class interprets non-Integer string status now as well as falling back if it can't be looked up.
2009-09-27cgi_wrapper: don't warn about stdoutput usage
It really shouldn't be a problem for existing CGI apps to write to the StringIO object..
2009-09-27Remove "Z" constant for binary strings
We've started using magic comments to ensure any strings we create are binary instead. Additionally, ensure we create any StringIO objects with an explicit string (which default to binary) to ensure the StringIO object is binary. This is because StringIO.new (with no arguments) will always use the process-wide default encoding since it does not know about magic comments (and couldn't, really...)
2009-09-27configurator: move initialization stuff to #initialize
Avoids making the #listen method any noisier than it should be.
2009-09-27Use Configurator#expand_addr in HttpServer#listen
This may be redundant for the "normal" configuration file directive, but allows the same syntax to be used in after_fork hooks where HttpServer#listen() may be called.
2009-09-27HttpServer#listen accepts :tries and :delay parameters
This allows per-worker listeners to be configured to retry and and not continue until the equivalent worker belonging to a previous master (or even another server) has released the socket. In the Configurator RDoc, include better examples for per-worker server.listen calls using these :tries == -1. Inspired by an example by Chris Wanstrath.
2009-09-27http_response: simplify and remove const dependencies
We don't need the Z constant anymore and inlining the header writing gives a small overall performance improvement in microbenchmarks. This also makes this method reentrant and thread-safe for Rainbows as well.
2009-09-27http_request: simplify and remove handle_body method
It is simpler and even slightly faster in micro benchmarks when inlined.
2009-09-27util: remove APPEND_FLAGS constant
One less thing to RDoc
2009-09-22configurator: fix user switch example in RDoc
We changed this in 97e469fc3afb751618b8b9a7b364cb447aaf90dd but never updated the example.
2009-09-18unicorn 0.92.0 v0.92.0
Small fixes and documentation are the focus of this release. James Golick reported and helped me track down a bug that caused SIGHUP to drop the default listener (0.0.0.0:8080) if and only if listeners were completely unspecified in both the command-line and Unicorn config file. The Unicorn config file remains the recommended option for specifying listeners as it allows fine-tuning of the :backlog, :rcvbuf, :sndbuf, :tcp_nopush, and :tcp_nodelay options. There are some documentation (and resulting website) improvements. setup.rb users will notice the new section 1 manpages for `unicorn` and `unicorn_rails`, Rubygems users will have to install manpages manually or use the website. The HTTP parser got a 3rd-party code review which resulted in some cleanups and one insignificant bugfix as a result. Additionally, the HTTP parser compiles, runs and passes unit tests under Rubinius. The pure-Ruby parts still do not work yet and we currently lack the resources/interest to pursue this further but help will be gladly accepted. The website now has an Atom feed for new release announcements. Those unfamiliar with Atom or HTTP may finger unicorn@bogomips.org for the latest announcements.
2009-09-17SIGHUP no longer drops lone, default listener
When SIGHUP reloads the config, we didn't account for the case where the listen socket was completely unspecified. Thus the default listener (0.0.0.0:8080), did not get preserved and re-injected into the config properly. Note that relying on the default listen or specifying listeners on the command-line means it's /practically/ impossible to _unbind_ those listeners with a configuration file reload. We also need to preserve the (unspecified) default listener across upgrades that later result in SIGHUP, too; so the easiest way is to inject the default listener into the command-line for upgrades. Many thanks to James Golick for reporting and helping me track down the bug since this behavior is difficult to write reliable automated tests for. Signed-off-by: Eric Wong <normalperson@yhbt.net>
2009-09-16Avoid freezing objects that don't benefit from it
This gives applications more rope to play with in case they have any reasons for changing some values of the default constants. Freezing strings for Hash assignments still speeds up MRI, so we'll keep on doing that for now (and as long as MRI supports frozen strings, I expect them to always be faster for Hashes though I'd be very happy to be proven wrong...)
2009-09-16socket_helper: (FreeBSD) don't freeze the accept filter constant
We may add support for the Gopher protocol in the future...
2009-09-15Fix comment about speculative accept()
We used to try it on every listener, but then rarely-used listener ports used mainly for monitoring/debugging would have accept() unnecessary called, getting unnecessarily expensive inside the kernel.
2009-09-09http_response: don't "rescue nil" for body.close
This can hide bugs in Rack applications/middleware. Most other Rack handlers/servers seem to follow this route as well, so this helps ensure broken things will break loudly and more consistently across all Rack-enabled servers :)
2009-09-08"encoding: binary" comments for all sources (1.9)
This ensures any string literals that pop up in *our* code will just be a bag of bytes. This shouldn't affect/fix/break existing apps in most cases, but most constants will always have the "correct" encoding (none!) to be consistent with HTTP/socket expectations. Since this comment affects things only on a per-source basis, it won't affect existing apps with the exception of strings we pass to the Rack application. This will eventually allow us to get rid of that Unicorn::Z constant, too.
2009-09-04unicorn 0.91.0 v0.91.0
2009-09-04Redirect files in binary mode
Avoid potential issues that can arise from logging any weird characters that may not be supported in the current encoding.
2009-09-03Support HTTP/0.9 entity-body-only responses
HTTP/0.9 GET requests expect responses without headers. Some weird applications/tools still use the ancient HTTP/0.9 protocol for weird reasons, so we'll support them. ref: rfc 1945, section 4.1
2009-09-02launcher: defer daemonized redirects until config is read
Otherwise errors in the Unicorn-specific config files can get error messages swallowed up when daemonizing.
2009-08-20tee_input: fix rdoc
the docs for the TeeInput class was clobbering the Unicorn module documentation instead.
2009-08-16unicorn 0.90.0 v0.90.0
2009-08-16app/inetd: explicitly close pipe descriptors on CatBody#close
Since Rack permits body objects to have #close called on them, we can safely close our pipe readers immediately instead of waiting on the GC to close them (like we do for TeeInput tempfiles).
2009-08-15Remove explicit requires for Rack things
Rack is autoload-based and so are we.
2009-08-15const: remove unused constants
2009-08-15http_response: pass through unknown status codes
This lets clients can pass through newly-invented status codes that Rack does not know about.
2009-08-15Fix documentation for Util.reopen_logs
2009-08-15tee_input: make interface more usable outside of Unicorn
TeeInput being needed is now (once again) an uncommon code path so there's no point in relying on global constants. While we're at it, allow StringIO to be used in the presence of small inputs; too.