about summary refs log tree commit homepage
path: root/t
DateCommit message (Collapse)
2020-07-30build: revamp and avoid unnecessary rebuilds
We can limit the amount of Ruby-version-specific code to just the stuff in ext/* and bin/*, reducing I/O traffic and FS + page cache footprint. Furthermore, rely on GNU make behavior to copy all the necessary files so we don't trigger unnecessary extconf.rb invocations just by touching a .rb file in lib.
2018-10-18doc: update more URLs to use HTTPS and avoid redirects
Latency from redirects is painful, and HTTPS can protect privacy in some cases.
2018-09-18tests: ensure -N/--no-default-middleware not supported in config.ru
Continue to make it easy to migrate AWAY from unicorn because vendor lock-in is the worst thing, especially if it's on us.
2017-12-16avoid reusing env on hijack
Hijackers may capture and reuse `env' indefinitely, so we must not use it in those cases for future requests. For non-hijack requests, we continue to reuse the `env' object to reduce memory recycling. Reported-and-tested-by: Sam Saffron <sam.saffron@gmail.com>
2017-03-14test-lib: expr(1) portability fix
GNU expr supports '+' to match one or more occurrences, but it seems the expr(1) on my FreeBSD installation does not.
2017-03-01t0011-active-unix-socket.sh: fix race condition in test
Killing the master process may lead to the worker dying on its own (as designed); before kill(1) has had an opportunity to send the second kill(2) syscall on the worker process. Killing the worker before the master might also lead to a needless respawn, so merely kill the master and let the worker follow it in death. This race condition occasionally caused test failures on slow, uniprocessor hardware.
2017-02-21t/t0012-reload-empty-config.sh: access ivars directly if needed
We'll be moving to direct ivar access to reduce the API (and method entry) overhead of internal unicorn classes. This means some tests like this one will reach deeper into internals. This will be necessary for the upcoming changes to add new configuration options to unicorn.
2015-06-10ensure body is closed during hijack
Middlewares such as Rack::Lock (used by Rails) break badly unless the response body is closed on hijack, so we will close it to follow the lead of other popular Rack servers. While it's unclear if there's anybody using rack.hijack with unicorn, we'll try to emulate the behavior of other servers as much as possible. ref: https://github.com/ngauthier/tubesock/issues/10
2015-02-06doc: update support status for Ruby versions
unicorn 5 will not support Ruby 1.8 anymore. Drop mentions of Rubinius, too, it's too difficult to support due to the proprietary and registration-required nature of its bug tracker. The smaller memory footprint and CoW-friendly memory allocator in mainline Ruby is a better fit for unicorn, anyways. Since Ruby 1.9+ bundles RubyGems and gem startup is faster nowadays, we'll just depend on that instead of not loading RubyGems. Drop the local.mk.sample file, too, since it's way out-of-date and probably isn't useful (I have not used it in a while).
2014-12-21t/t0002-parser-error.sh: relax test for rack 1.6.0
This overly zealous test was broken by: rack commit be28c6a2ac152fe4adfbef71f3db9f4200df89e8 ("update HTTP status codes to IETF RFC 7231")
2014-08-17dev: remove isolate dependency
It seems unnecessary with current versions of RubyGems supporting development dependencies.
2014-05-29http: remove xftrust options
This has long been considered a mistake and not documented for very long. I considered removing X-Forwarded-Proto and X-Forwarded-SSL handling, too, so rack.url_scheme is always "http", but that might lead to compatibility issues in rare apps if Rack::Request#scheme is not used.
2014-02-19remove SSL tests
This feature is on hold for now, since it never really took off and kgio-monkey is more-or-less abandoned. I'm not looking forward to supporting OpenSSL unless there's interest. This was mainly intended as an experiment to deal with a bad hardware/firmware situation on a LAN I have. It allowed SSL to abort on corrupt packets.
2013-11-08t0300: kill off stray processes in test
We shouldn't leave processes running after the test.
2013-10-25tests: limit oobgc check to accepted sockets
Otherwise these tests fail if we start using IO#autoclose=true on Ruby 1.9 (and also if we use IPv6 sockets for tests).
2013-06-07Make -N/--no-default-middleware option work
This fixes the -N (a.k.a. --no-defaut-middleware) option, which was not working. The problem was that Unicorn::Configurator::RACKUP is cleared before the lambda returned by Unicorn.builder is run, which means that checking whether the :no_default_middleware option was set from the lambda could not detect anything. This patch copies it to a local variable that won't get clobbered, restoring the feature. [ew: squashed test commit into the fix, whitespace fixes] Signed-off-by: Eric Wong <normalperson@yhbt.net>
2013-02-04tests: "wc -l" portability for *BSDs
On FreeBSD 9.0, "wc -l" emits leading whitespace, so filter it through tr -d '[:space:]' to eliminate it.
2013-02-04tests: "wc -c" portability for *BSDs
On FreeBSD 9.0, "wc -c" emits leading whitespace, so filter it through tr -d '[:space:]' to eliminate it. This is commit 8a6117a22a7d01eeb5adc63d3152acf435cd3176 in rainbows.git
2013-02-04tests: replace non-portable "date +%s" with ruby equivalent
"date +%s" is not in POSIX (it is in GNU, and at least FreeBSD 9.0, possibly earlier). The Ruby equivalent should be sufficiently portable between different Ruby versions. This change was automated via: perl -i -p -e 's/date \+%s/unix_time/' t/*.sh This is commit 0ba6fc3c30b9cf530faf7fcf5ce7be519ec13fe7 in rainbows.git
2013-02-04tests: remove utee
POSIX already stipulates tee(1) must be unbuffered. I think my decision to use utee was due to my being misled by a bug in older curl where -N did not work as advertised (but --no-buffer did). N.B. we don't use tee in unicorn tests, this just matches commit cbff7b0892148b037581541184364e0e91d2a138 in rainbows
2013-01-22ignore normal Rack response at request-time hijack
Once a connection is hijacked, we ignore it completely and leave the connection at the mercy of the application.
2013-01-22support for Rack hijack in request and response
Rack 1.5.0 (protocol version [1,2]) adds support for hijacking the client socket (removing it from the control of unicorn (or any other Rack webserver)). Tested with rack 1.5.0.
2012-08-02bind listeners after loading for preload_app users
In the case where preload_app is true, delay binding new listeners until after loading the application. Some applications have very long load times (especially Rails apps with Ruby 1.9.2). Binding listeners early may cause a load balancer to incorrectly believe the unicorn workers are ready to serve traffic even while the app is being loaded. Once a listener is bound, connect() requests from the load balancer succeed until the listen backlog is filled. This allows requests to pile up for a bit (depending on backlog size) before getting rejected by the kernel. By the time the application is loaded and ready-to-run, requests in the listen backlog are likely stale and not useful to process. Processes inheriting listeners do not suffer this effect, as the old process should still be capable of serving new requests. This change does not improve the situation for the preload_app=false (default) use case. There may not be a solution for preload_app=false users using large applications. Fortunately Ruby 1.9.3+ improves load times of large applications significantly over 1.9.2 so this should be less of a problem in the future. Reported via private email sent on 2012-06-29T22:59:10Z
2012-07-28remove Rails-oriented integration tests
It's too much overhead to keep Rails-specific tests working, especially when it's hauling in an ancient version of SQLite3. Since Rails 3 has settled down with Rack and unicorn_rails is unlikely to need changing in the future, we can drop these tests.
2012-04-17tests: set executable bit on integration shell scripts
These should be made executable for ease-of-understanding and consistency, regardless of whether we actually execute them.
2012-04-12shutdown client socket for apps which fork in background
Previously we relied on implicit socket shutdown() from the close() syscall. However, some Rack applications fork() (without calling exec()), creating a potentially long-lived reference to the underlying socket in a child process. This ends up causing nginx to wait on the socket shutdown when the child process exits. Calling shutdown() explicitly signals nginx (or whatever client) that the unicorn worker is done with the socket, regardless of the number of FD references to the underlying socket in existence. This was not an issue for applications which exec() since FD_CLOEXEC is always set on the client socket. Thanks to Patrick Wenger for discovering this. Thanks to Hongli Lai for the tip on using shutdown() as is done in Passenger. ref: http://mid.gmane.org/CAOG6bOTseAPbjU5LYchODqjdF3-Ez4+M8jo-D_D2Wq0jkdc4Rw@mail.gmail.com
2012-04-12t/sslgen.sh: use larger keys for tests
This seems required for TLSv1.2 under OpenSSL 1.0.1
2011-11-15tests: try to set a shorter path for Unix domain sockets
We're only allowed 108 bytes for Unix domain sockets. mktemp(1) usually generates path names of reasonable length and we rely on it anyways.
2011-11-15tests: just use the sha1sum implemented in Ruby
The output of SHA1 command-line tools is too unstable and I'm more comfortable with Ruby 1.9 encoding support than I was in 2009. Jeremy Evans noted the output of "openssl sha1" has changed since I last used it.
2011-11-15t0011: fix test under OpenBSD
expr on OpenBSD uses a basic regular expression (according to re_format(7)), which doesn't support +, only *. Acked-by: Eric Wong <normalperson@yhbt.net>
2011-11-15t: ensure SSL certificates exist on fresh test
We throw up some fake SSL certs for testing
2011-09-15add preliminary SSL support
This will also be the foundation of SSL support in Rainbows! and Zbatery. Some users may also want to use this in Unicorn on LANs to meet certain security/auditing requirements. Of course, Nightmare! (in whatever form) should also be able to use it.
2011-06-17error logging is more consistent
Backtraces are now formatted properly (with timestamps) and exceptions will be logged more consistently and similar to Logger defaults: "#{exc.message} (#{e.class})" backtrace.each { |line| ... } This may break some existing monitoring scripts, but errors will be more standardized and easier to check moving forward.
2011-06-17add broken app test from Rainbows!
"app error" is more correct, and consistent with Rainbows!
2011-06-17ensure at_exit handlers run on graceful shutdown
rescuing from SystemExit and exit()-ing again is ugly, but changes made to lower stack depth positively affect _everyone_ so we'll tolerate some ugliness here. We'll need to disable graceful exit for some tests, too...
2011-06-16add heartbeat timeout test from Rainbows!
Just in case we break anything
2011-05-05http_parser: add max_header_len accessor
Rainbows! wants to be able to lower this eventually...
2011-05-05t0002-parser-error: fix race conditions
"wait" needs to be done in the outside shell because the subshell could still be exiting when we grep.
2011-05-04return 414 for URI length violations
There's an HTTP status code allocated for it in <http://www.iana.org/assignments/http-status-codes>, so return that instead of 400.
2011-04-29oob_gc: reimplement to fix breakage and add tests
This was broken since v3.3.1[1] since nginx relies on a closed socket (and not Content-Length/Transfer-Encoding) to detect a response completion. We have to close the client socket before invoking GC to ensure the client sees the response in a timely manner. [1] - commit b72a86f66c722d56a6d77ed1d2779ace6ad103ed
2011-04-01bump dependencies for testing
No need to use an ancient Rack now that we've dropped Rails 2.3.x tests. We need to remember that Rack 1.1.0 doesn't support input#size.
2011-02-10Revert "test_helper: simplify random port binding"
This causes conflicts with ports clients may use in the ephemeral range since those do not hold FS locks. This reverts commit e597e594ad88dc02d70f7d3521d0d3bdc23739bb. Conflicts: test/test_helper.rb
2011-02-02test_helper: simplify random port binding
Duh...
2011-01-05close client socket after closing response body
Response bodies may capture the block passed to each and save it for body.close, so don't close the socket before we have a chance to call body.close
2010-12-21http: hook up "trust_x_forwarded" to configurator
More config bloat, sadly this is necessary for Rainbows! :<
2010-12-09allow client_buffer_body_size to be tuned
Since modern machines have more memory these days and clients are sending more data, avoiding potentially slow filesystem operations for larger uploads can be useful for some applications.
2010-12-09configurator: ensure examples in FAQ still work
This has been broken since 2.0.x Internal cleanups sometimes have unintended consequences :<
2010-12-09tee_input: fix accounting error on corked requests
In case a request sends the header and buffer as one packet, TeeInput relying on accounting info from StreamInput is harmful as StreamInput will buffer in memory outside of TeeInput's control. This bug is triggered by calling env["rack.input"].size or env["rack.input"].rewind before to read.
2010-11-18tests: add parser error test from Rainbows!
This will help ensure we trap our own errors properly in the future.
2010-11-18add missing test files
oops :x