Date | Commit message (Collapse) |
|
The HTTP parser is fix for oddly-aligned reads of trailers (this
technically affects headers, too, but is highly unlikely due to
our non-support of slow clients). This allows our HTTP parser
to better support very slow clients when used by other servers
(like Rainbows!). Fortunately this bug does not appear to lead
to any invalid memory accesses (and potential arbitrary code
execution).
FreeBSD (and possibly other *BSDs) support is improved and and
all the test cases pass under FreeBSD 7.2. Various flavors of
GNU/Linux remains our primary platform for development and
production.
New features added include the "working_directory" directive in
the configurator . Even without specifying a
"working_directory", symlink-aware detection of the current path
no longer depends on /bin/sh so it should work out-of-the-box on
FreeBSD and Solaris and not just systems where /bin/sh is dash,
ksh93 or bash.
User-switching support is finally supported but only intended
for use in the after_fork hook of worker processes. Putting it
in the after_fork hook allows allows users to set things like
CPU affinity[1] on a per-worker basis before dropping
privileges. The master process retains all privileges it
started with.
The ENV["RACK_ENV"] (process-wide) environment variable is now
both read and set for `unicorn' in the same way RAILS_ENV is
used by `unicorn_rails'. This allows the Merb launcher to read
ENV["RACK_ENV"] in config.ru. Other web servers already set
this and there may be applications or libraries that already
rely on this de facto standard.
Eric Wong (26):
cleanup: avoid redundant error checks for fstat
test_helper: connect(2) may fail with EINVAL
GNUmakefile: fix non-portable tar(1) usage
tests: provide a pure Ruby setsid(8) equivalent
more portable symlink awareness for START_CTX[:cwd]
test_signals: avoid portability issues with fchmod(2)
cleanup error handling and make it less noisy
Do not override Dir.chdir in config files
configurator: add "working_directory" directive
configurator: working_directory is expanded
configurator: set ENV["PWD"] with working_directory, too
configurator: working_directory affects pid, std{err,out}_paths
configurator: update documentation for working_directory
TODO: remove working_directory bit, done
Util.reopen_logs: remove needless Range
worker: user/group switching for after_fork hooks
Fix autoload of Etc in Worker for Ruby 1.9
bin/unicorn: allow RACK_ENV to be passed from parent
tests for RACK_ENV preservation
http: allow headers/trailers to be written byte-wise
http: extra test for bytewise chunked bodies
tee_input: do not clobber trailer buffer on partial uploads
test_exec: ensure master is killed after test
Util::tmpio returns a TmpIO that responds to #size
TODO: remove user-switching bit, done
unicorn 0.94.0
Wayne Larsen (1):
bin/unicorn: set ENV["RACK_ENV"] on startup
[1] - Unicorn does not support CPU affinity directly, but it is
possible to load code that allows it inside after_fork hooks,
or even just call sched_tool(8).
|
|
|
|
Subclass off the core File class so we don't have to
worry about #size being defined. This will mainly
be useful to Rainbows! but allows us to simplify
our TeeInput implementation a little, too.
|
|
The relative working_directory test runs so quickly
that the master may not even have signal handlers
setup by the time we're done with it. The proper
way would be to not start workers until the master
is ready, but that breaks some test cases horribly.
|
|
Found in Rainbows! testing. Reusing the buffer when finalizing
input for headers could be problematic because it would lead
to the @buf2 instance variable being clobbered; allowing the
trailers to "leak" into the body.
|
|
Make sure we're completely resumable no matter how
idiotic clients are.
|
|
This allows clients to trickle headers and trailers. While
Unicorn itself does not support slow clients for many reasons,
this affects servers that depend on our parser like Rainbows!.
This actually does affect Unicorn when handling trailers, but
HTTP trailers are very ever rarely used in requests.
Fortunately this stupid bug does not seem able to trigger
out-of-bounds conditions.
|
|
Prevent ourselves from breaking things in case applications
start depending on this.
|
|
This makes our RACK_ENV handling like our RAILS_ENV
handling for unicorn_rails, removing the redundant
local variable.
|
|
Constant scoping appears to be a bit different under 1.9
|
|
This must be called in the after_fork hook because there may be
Ruby modules that'll allow things such as CPU affinity and
scheduling class/priority to be set on a per-worker basis. So
we give the user the ability to change users at any time during
the after_fork hook.
|
|
?/ avoids allocating a String in 1.8 and in 1.9 short String
objects are cheap.
|
|
|
|
We follow the principle of least surprise now, so less
documentation is better documentation.
|
|
It makes more sense this way since users usually expect config
file directives to be order-independent.
|
|
Just in case anything depends on it, we'll have it set
correctly because it's usually set by the $SHELL
|
|
Allow people to use "~" and relative paths, like all
of our other paths.
|
|
Although not currently part of the Rack specification,
ENV["RACK_ENV"] is at least a de facto standard. Some of the
popular Rack servers (Thin, Passenger) and frameworks (Merb,
Sinatra) already set or use it.
ML-Ref: <C7A9411D-CD40-4DA4-9CB3-6AA959D2D127@larsen.st>
Acked-by: Eric Wong <normalperson@yhbt.net>
[ew: setenv always, not just on CLI + commit message]
|
|
This basically a prettier way of saying:
Dir.chdir(Unicorn::HttpServer::START_CTX[:cwd] = path)
In the config file. Unfortunately, this is configuration
directive where order matters and you should specify it
before any other path[1] directives if you're using relative
paths (relative paths are not recommended anyways)
[1] pid, stderr_path, stdout_path
|
|
Even if START_CTX[:cwd] is pointing to another directory,
avoid overriding the user's decision to Dir.chdir if they
do it in either the Unicorn config file or the config.ru.
|
|
split out uncommon code from the common path
|
|
Just write bytes to the file instead and track its
size increase instead of its mode. As of now all
the unit tests pass under FreeBSD 7.2.
|
|
`sh -c pwd` doesn't reliably read ENV["PWD"] on all platforms,
this means that directories that are symlinks may be ignored
and the real path is resolved. This can be problematic when
doing upgrades for common deployment systems such as Capistrano
which rely on the working directory being a symlink.
|
|
setsid(8) is non-portable, but we depend on Ruby already and
it's trivial to implement; so just use the Ruby-only version
|
|
Explicitly specify that we mean to use stdin/stdout since
not all tar(1) implementations default to it.
|
|
Not documented on FreeBSD 7.2, but it seems to happen there
and searching around, it seems to happen on other systems,
too...
|
|
If fstat() fails on an open file descriptor in the master,
something is seriously wrong (like your kernel is broken/buggy)
and trying to restart the worker that owned that file descriptor
is likely masking the symptoms. Instead let the error propagate
up to the main loop to avoid wasting cycles to restart broken
workers.
|
|
This release fixes a regression introduced in 0.93.3 where
timed-out worker processes run a chance of not being killed off
at all if they're hung. While it's not ever advisable to have
requests take a long time, we realize it's easy to fix
everything :)
Eric Wong (3):
TODO: remove --kill
fix reliability of timeout kills
TODO: update for next version (possibly 1.0-pre)
|
|
|
|
The method introduced in commit
6c8a3d3c55997978bacaecc5dbbb7d03c2fee345 to avoid killing
workers after suspend/hibernate interacted badly with the change
for OpenBSD fchmod(2) compatibility introduced with the 0.93.3
release. This interaction lead to workers with files stuck in
the zero state to never be murdered off for timeout violations.
Additionally, the method to avoid killing processes off was
never completely reliable and has been reworked even if we
entered suspend/hibernate/STOP during client processing.
This regression was discovered during continued development of the
Rainbows! test suite (which we will bring over as it becomes ready).
|
|
I'm still having a hard time justifying this...
|
|
This release mainly works around BSD stdio compatibility issues
that affect at least FreeBSD and OS X. While this issues was
documented and fixed in [ruby-core:26300][1], no production
release of MRI 1.8 has it, and users typically upgrade MRI more
slowly than gems. This issue does NOT affect 1.9 users. Thanks
to Vadim Spivak for reporting and testing this issue and Andrey
Stikheev for the fix.
Additionally there are small documentation bits, one error
handling improvement, and one minor change that should improve
reliability of signal delivery.
Andrey Stikheev (1):
workaround FreeBSD/OSX IO bug for large uploads
Eric Wong (7):
DESIGN: address concerns about on-demand and thundering herd
README: alter reply conventions for the mailing list
configurator: stop testing for non-portable listens
KNOWN_ISSUES: document Rack gem issue w/Rails 2.3.2
stop continually resends signals during shutdowns
add news bodies to site NEWS.atom.xml
configurator: fix broken example in RDoc
Suraj N. Kurapati (1):
show configuration file path in errors instead of '(eval)'
[1] http://redmine.ruby-lang.org/issues/show/2267
|
|
Under FreeBSD writing to the file in sync mode does not change current
position, so change position to the end of the file. Without this patch
multipart post requests with large data (image uploading) does not work
correctly:
Status: 500 Internal Server Error
bad content body
/usr/local/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/utils.rb:347:in `parse_multipart'
/usr/local/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/utils.rb:319:in `loop'
/usr/local/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/utils.rb:319:in `parse_multipart'
File position behavior under FreeBSD :
ruby -v
ruby 1.8.7 (2009-04-08 patchlevel 160) [i386-freebsd7]
irb(main):001:0> b = File.new("abc", "w+")
=> #<File:abc>
irb(main):002:0> b.sync = true
=> true
irb(main):004:0> b.write("abc")
=> 3
irb(main):005:0> b.pos
=> 0
Acked-by: Eric Wong <normalperson@yhbt.net>
|
|
Thanks to Greg Melton for reporting.
|
|
While we're at it, remove trailing whitespace for
author names, too.
|
|
Since our :QUIT and :TERM signal handlers are idempotent, we can
safely retry sending signals in case workers don't/can't handle
them them the first time around. This appears to be a problem
with the Thread-based concurrency models in Rainbows! not
behaving well (no surprise, though, since pthreads and signals
are difficult to manage/mix properly).
|
|
In short: upgrade to Rails 2.3.4 (or later)
ref: http://mid.gmane.org/20091014221552.GA30624@dcvr.yhbt.net
Note: the workaround described in the article above only made
the issue more subtle and we didn't notice them immediately.
|
|
also __FILE__ did not reflect configuration file path
|
|
IPv4 addresses in the format of: "^[[:digit:]]+:[[:digit:]]+$"
isn't very portable..
|
|
Mailman is now configured to munge Reply-To: to point back to
the mailing list. This might make things easier for folks
on low traffic mailing lists like ours.
|
|
Based on a private email I just received.
|
|
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
|
|
Generated C code is no longer checked into git so it
doesn't matter.
|
|
While Unicorn is one of very many Unix-only, pre-forking, shared
socket servers in existence, and Unicorn is _definitely_ not the
only server that only works *well* with fast clients, either.
But as far as we know, Unicorn is the first (and so far only)
server that emphasizes only working well with fast clients.
|
|
Still pretty rare, though.
|
|
It's "Ragel+C" (as well as being Ragel->C) because there is C
code in the parser. Oddly, validator.w3.org doesn't complain
about the unescaped ">", but we'll err on the safe side for
blissful ignorance.
|
|
|
|
|
|
I've only served in an advisory role in most of those instances
and I relied on feedback from other folks (especially for Tomcat
since I know almost nothing about that).
|
|
It has come to our attention that this setting is not very
well-known to the rest of the world...
|