about summary refs log tree commit homepage
DateCommit message (Collapse)
2013-10-31remove arity enforcement for atfork_* hooks
It's usually given as a block, so Ruby won't care about arity there. Users will get the worker ID number as the first arg, making it possible to isolate some things to certain processes (e.g. for A/B testing).
2013-10-31remove "worker_" prefix from atfork hooks
It was totally unnecessary and just made things hard-to-follow.
2013-10-31comment to explain YAHNS_FD env
Users of other web servers may be surprised there is no recommended way to have a new instance of yahns inherit from another web server.
2013-10-31implement before_exec hook
This allows modifying the command-line (as an array) passed to Kernel#exec, as well as running anything necessary.
2013-10-31doc: fix client_timeout documentation in yahns_config
The default value was incorrect, also expand on common reasons why it should be tweaked.
2013-10-31implement shutdown_timeout and expiry on graceful shutdown
Otherwise, the server may stay running forever if a client chooses to stay forever (and there is no FD pressure).
2013-10-31fdmap: prevent possible/theoretical race
With a GVL-free Ruby implementation, the following situation may occur as FDs are recycled frequently with 3 threads running: expiry | normal | acceptor -----------------------+-----------+---------------------- yahns_expire(fd).enter | | | close(fd) | | | accept().return => fd shutdown(fd) - WRONG | | -----------------------+-----------+---------------------- So we must prevent expiry from running while another thread is closing, otherwise there is a small chance a lack of lock inside the Ruby implementation itself can lead to a mis-issued close() to a fast-recycled FD.
2013-10-30test_server: improve working_directory test robustness
We need to account for the directory change since yahns may lazily require some files. GTL is also not needed inside a child process.
2013-10-30test for overriding rack.errors destination
Different instances/ports of apps may want to point error output elsewhere.
2013-10-30test_unix_socket: remember to close IO when done
Hopefully saves us from running out of FDs when doing parallel tests.
2013-10-30add test for working_directory config parameter
This is often forgotten, and we need to make a tweak to the coverage generator to dump correctly.
2013-10-30use Hash#each instead of Hash#each_pair
There were some old Ruby versions where there was a minor difference, but they're identical from 1.9 onwards and this has lower cognitive overhead.
2013-10-30tests for SIGTTIN and SIGTTOU
These are implemented trivially and based on working code, but test them anyways.
2013-10-30config: raise ArgumentError for consistency
The rest of the config handling spews ArgumentError when a user sets something bad...
2013-10-30Rack hijack issues EPOLL_CTL_DEL
This saves about 200 bytes of unswappable kernel memory, so it might matter for systems with many connections when hijacking.
2013-10-30test for binding Unix stream sockets
This should prevent us from introducing bugs into some otherwise rarely-tested code.
2013-10-30socket_helper: account for undefined options
Not all servers may have options set, and we still need to set the default backlog.
2013-10-30server: fix incorrect receiver of method call
Oops, this was only noticed when inheriting a descriptor we want to close.
2013-10-30acceptor: account for inheriting dead descriptors
We may inherit descriptors we never spawned threads for, so account for @thrs not being defined, yet.
2013-10-30allow multiple blocking threads per listen socket
This is probably not needed and just adds contention, but it makes experimenting easier. While we're at it, validate minimum values of for sndbuf/rcvbuf along with this new threads value, too.
2013-10-30test_input: close client when we're done with it
This allows us to avoid some FD leakage and waste of memory allocations.
2013-10-30test output_buffering with hijacked responses
We need to be able to resume hijacking if gigantic HTTP headers are buffered on the response.
2013-10-30stream_input: use thread-local rbuf to avoid some garbage
While we're at it, add some additional tests for input handling.
2013-10-29gem: install manpages in the RubyGems package
This should be compatible with the "gem-man" command.
2013-10-29implement client_timeout for streaming inputs
We may also return HTTP 408 errors in this case.
2013-10-29lower client_body_buffer_size to 8K (from 114K)
8K is the default for nginx, too. This prevents Ruby/malloc from getting too fragmented with large buffers and being unable to release memory back to the OS. While we're at it, update the documentation to reflect we use this parameter to control read(2) sizes, too.
2013-10-29config: reject negative float for client_expire_ratio
Negative ratio makes little sense and there's no reason to allow it.
2013-10-29server: fix out-of-date comment regarding bind/pid order
Unfortunately, my eyes are more-or-less trained to ignore documentation when I edit code.
2013-10-29config: working_directory is only called at top-level
working_directory affects the whole process, so it must be called at the top-level and not allowed inside blocks.
2013-10-29configurator: validate :reuseport for boolean-ess
In case we (and Linux) supports other values in the future, we can update it then. Until now, ensure users only set true or false for this option. commit 03580a19afe5ce76323a7366b92243a94d445de1 in unicorn
2013-10-29implement user switching
This was documented (incorrectly) and not implemented for either the master/worker or single process cases. Implement and test all (with mocks, so not fully-tested).
2013-10-29config: comment for atfork_* hook definitions
This should make these definitions easier-to-find with grep(1)
2013-10-29doc: preliminary manpages for yahns(1), yahns_config(5)
This should hopefully make yahns more appealing and easier-to-use.
2013-10-28config: disallow defining new, named queues inside app
naming new (global) queues should be done outside of app contexts. Private, per-app queues should be anonymous to avoid confusion.
2013-10-28queue_epoll: remove check for closed descriptor
We use QueueQuitter, nowadays, so we no longer rely on cross-thread close to destroy a running thread blocked on epoll_wait.
2013-10-28associate private/anonymous queues correctly
We do not want users to use the default queue unless an app context requires it. We also do not want to spin up the default queue unless we are sure we have app contexts using it (and not private/anonymous queues).
2013-10-28rack: leave RACK_ENV unset by us
We'll leave setting RACK_ENV and RAILS_ENV to be the responsibility of the user. RACK_ENV makes little sense here since we do not do anything with it, and a global environment variable makes hosting different apps unpredictable.
2013-10-28doc: ignore RDoc for all internal classes
We will have no public API outside the config file. Since this is a *nix-only (and possibly Linux-only, even), manpages are language-agnostic and easier for users (sysadmins) who may not be familiar with Ruby/RDoc. All *nix-based Rubyists I've encountered are familiar with manpages, already. We won't have to worry about users being confused by our docs strewn across frames/CSS/JS-ridden sites like rdoc.info, either :)
2013-10-26support SO_REUSEPORT on new listeners (:reuseport)
This allows users to start an independent instance of unicorn on a the same port as a running unicorn (as long as both instances use :reuseport). ref: https://lwn.net/Articles/542629/
2013-10-26server: avoid metaclass for acceptors
This should make things a little easier-to-follow and possibly improve method cache hit rates for servers with multiple acceptors.
2013-10-26StreamFile and TmpIO attempt expiry on EMFILE/ENFILE
This should help prevent some errors from popping up. Obviously, we cannot spend too long doing this inside a worker thread.
2013-10-26test_client_expire: disable output buffering in test
We may end up buffering on headers and hitting EMFILE/ENFILE this way, too. We need to figure out a way to recover from this.
2013-10-26fix SIGCHLD w/o workers + PID file renames
We'll hit SIGCHLD if our reexec process fails on us, so the non-MP server must handle it, too. We discovered this bug while porting the PID file renaming changes from unicorn.
2013-10-26tests: increase mkserver use to reduce LoC
This reduces the amount of code we have in our tests to improve maintainability.
2013-10-26fix output buffer corner-case for static files
The write buffer may block on a single write and immediately become unblocked afterwards. We need to account for this odd corner case when serving static files; because clients can trigger strange corner cases like this.
2013-10-26output_buffering handles odd EAGAIN cases
The tiny responses for check_client_connection and "100-Continue" responses may occasionally fail with EAGAIN. We must be prepared for those corner cases and buffer the output appropriately. We can safely use a string for buffering here (for once(!)), since the buffer sizes are bounded and known at buffer time, unlike the response headers/bodies sent by the Rack application.
2013-10-26http_client: reduce the size of the yahns_step method
It was getting too large to be manageable and rarer paths for bodies/trailers can be hoisted out.
2013-10-26test_expect_100: cleanup unused var
2013-10-25enforce FD_CLOEXEC on all pipes, including tests
We need to prevent FD leakage on Ruby 1.9.3
2013-10-25quitter: save one syscall and implement for non-eventfd
pipes and eventfd are always writable after creation, thus there's no need to trigger it and watch for readability. This saves us some code in the Linux case (and we currently only support GNU/Linux).