From b62bab09a2288b3d1711deafb45be39db1ddee80 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 8 May 2014 22:39:34 +0000 Subject: ISSUES: update with mailing list subscription mlmmj seems quite usable and maintainable, so we'll run it. --- ISSUES | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ISSUES b/ISSUES index bca7f9f..f66d14a 100644 --- a/ISSUES +++ b/ISSUES @@ -6,7 +6,7 @@ submit patches and/or obtain support after you have searched the {documentation}[http://unicorn.bogomips.org/]. * No subscription will ever be required to email the public inbox. -* Please Cc: all participants in a thread, as there are no subscribers +* Please Cc: all participants in a thread, as subscription is optional * Do not {top post}[http://catb.org/jargon/html/T/top-post.html] in replies * Quote as little as possible of the message you're replying to * Do not send HTML mail, it will likely be flagged as spam @@ -29,8 +29,14 @@ document distributed with git) on guidelines for patch submission. * public: mailto:unicorn-public@bogomips.org * private: mailto:unicorn@bogomips.org -We operate a {public-inbox}[http://public-inbox.org/]. -You may subscribe using {ssoma}[http://ssoma.public-inbox.org/]: +We operate a {public-inbox}[http://public-inbox.org/] which +feeds the mailing list. You may subscribe either using +{ssoma}[http://ssoma.public-inbox.org/] or by sending a mail +to mailto:unicorn-public+subscribe@bogomips.org + +ssoma is a mail archiver/fetcher using git. It operates in a similar +fashion to tools such as slrnpull, fetchmail, or getmail. ssoma +subscription instructions: URL=git://bogomips.org/unicorn-public LISTNAME=unicorn -- cgit v1.2.3-24-ge0c7 From 08aa09aed7af84e5cf1505c822ea55fe9a729c92 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 3 Jul 2014 19:20:17 +0000 Subject: FAQ: add entry for Rails autoflush_log Thanks to Cedric Maion for bringing this up on the mailing list: http://bogomips.org/unicorn-public/m/20140703144048.GA6674@cedric-maion.com --- FAQ | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/FAQ b/FAQ index c84a8af..66f1a09 100644 --- a/FAQ +++ b/FAQ @@ -1,6 +1,14 @@ = Frequently Asked Questions about Unicorn -=== I've installed Rack 1.1.x, why can't Unicorn load Rails (2.3.5)? +=== Why aren't my Rails log files rotated when I use SIGUSR1? + +The Rails autoflush_log option must remain disabled with multiprocess +servers such as unicorn. Buffering in userspace may cause lines to be +partially written and lead to corruption in the presence of multiple +processes. With reasonable amounts of logging, the performance impact +of autoflush_log should be negligible on Linux and other modern kernels. + +=== I've installed Rack 1.1.x, why can't Unicorn load Rails (2.3.5)? Rails 2.3.5 is not compatible with Rack 1.1.x. Unicorn is compatible with both Rack 1.1.x and Rack 1.0.x, and RubyGems will load the latest -- cgit v1.2.3-24-ge0c7 From eb3daa8cf8d860580db3ca6f22531b051a5d6d76 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 17 Aug 2014 02:33:53 +0000 Subject: dev: remove isolate dependency It seems unnecessary with current versions of RubyGems supporting development dependencies. --- GNUmakefile | 6 +----- script/isolate_for_tests | 31 ------------------------------- t/GNUmakefile | 6 +----- unicorn.gemspec | 1 - 4 files changed, 2 insertions(+), 42 deletions(-) delete mode 100755 script/isolate_for_tests diff --git a/GNUmakefile b/GNUmakefile index 00a6ace..50819fc 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -23,11 +23,7 @@ endif RUBY_ENGINE := $(shell $(RUBY) -e 'puts((RUBY_ENGINE rescue "ruby"))') -isolate_libs := tmp/isolate/$(RUBY_ENGINE)-$(RUBY_VERSION).mk -$(isolate_libs): script/isolate_for_tests - @$(RUBY) script/isolate_for_tests --include $(isolate_libs) -MYLIBS = $(RUBYLIB):$(ISOLATE_LIBS) +MYLIBS = $(RUBYLIB) # dunno how to implement this as concisely in Ruby, and hell, I love awk awk_slow := awk '/def test_/{print FILENAME"--"$$2".n"}' 2>/dev/null diff --git a/script/isolate_for_tests b/script/isolate_for_tests deleted file mode 100755 index 6f5dced..0000000 --- a/script/isolate_for_tests +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env ruby -# scripts/Makefiles can read and eval the output of this script and -# use it as RUBYLIB -require 'rubygems' -require 'isolate' -fp = File.open(__FILE__, "rb") -fp.flock(File::LOCK_EX) - -ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby' -opts = { - :system => false, - # we want "ruby-1.8.7" and not "ruby-1.8", so disable :multiruby - :multiruby => false, - :path => "tmp/isolate/#{ruby_engine}-#{RUBY_VERSION}", -} - -pid = fork do - Isolate.now!(opts) do - gem 'raindrops', '0.13.0' - gem 'kgio', '2.9.2' - gem 'rack', '1.5.2' - end -end -_, status = Process.waitpid2(pid) -status.success? or abort status.inspect -lib_paths = Dir["#{opts[:path]}/gems/*-*/lib"].map { |x| File.expand_path(x) } -dst = "tmp/isolate/#{ruby_engine}-#{RUBY_VERSION}.mk" -File.open("#{dst}.#$$", "w") do |fp| - fp.puts "ISOLATE_LIBS=#{lib_paths.join(':')}" -end -File.rename("#{dst}.#$$", dst) diff --git a/t/GNUmakefile b/t/GNUmakefile index 8f2668c..5f5d9bc 100644 --- a/t/GNUmakefile +++ b/t/GNUmakefile @@ -17,11 +17,7 @@ endif RUBY_ENGINE := $(shell $(RUBY) -e 'puts((RUBY_ENGINE rescue "ruby"))') export RUBY_ENGINE -isolate_libs := ../tmp/isolate/$(RUBY_ENGINE)-$(RUBY_VERSION).mk -$(isolate_libs): ../script/isolate_for_tests - @cd .. && $(RUBY) script/isolate_for_tests --include $(isolate_libs) -MYLIBS := $(RUBYLIB):$(ISOLATE_LIBS) +MYLIBS := $(RUBYLIB) T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh) diff --git a/unicorn.gemspec b/unicorn.gemspec index c0c8092..b24b1ac 100644 --- a/unicorn.gemspec +++ b/unicorn.gemspec @@ -37,7 +37,6 @@ Gem::Specification.new do |s| s.add_dependency(%q, '~> 2.6') s.add_dependency(%q, '~> 0.7') - s.add_development_dependency('isolate', '~> 3.2') s.add_development_dependency('wrongdoc', '~> 1.8') s.licenses = ["GPLv2+", "Ruby 1.8"] -- cgit v1.2.3-24-ge0c7 From e6b0155763d4da0d4925b8a151a99a5180b2439c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 17 Aug 2014 02:33:54 +0000 Subject: unicorn.gemspec: depend on test-unit 3.0 test-unit 3 and minitest 5 will have equal support status as a bundled gems when Ruby 2.2.0 is released in December 2014. These bundled gems will appear in the user-oriented tarball installations, but do not get installed by "make install" when installing Ruby from SVN or git. test-unit appears to be actively maintained and good at keeping backwards compatibility even on a major version change, so this means no code changes on our end. I am not convinced switching to minitest is worth the effort. Cc: Ken Dreyer --- unicorn.gemspec | 1 + 1 file changed, 1 insertion(+) diff --git a/unicorn.gemspec b/unicorn.gemspec index b24b1ac..9456db2 100644 --- a/unicorn.gemspec +++ b/unicorn.gemspec @@ -37,6 +37,7 @@ Gem::Specification.new do |s| s.add_dependency(%q, '~> 2.6') s.add_dependency(%q, '~> 0.7') + s.add_development_dependency('test-unit', '~> 3.0') s.add_development_dependency('wrongdoc', '~> 1.8') s.licenses = ["GPLv2+", "Ruby 1.8"] -- cgit v1.2.3-24-ge0c7 From f6c7195cbc5b4eb7341741d9cc83833cba562b38 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 17 Aug 2014 22:13:25 +0000 Subject: remove RubyForge and Freecode references Both sites are gone. --- GNUmakefile | 7 ------- Rakefile | 44 -------------------------------------------- unicorn.gemspec | 1 - 3 files changed, 52 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 50819fc..6916b6e 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -245,15 +245,8 @@ $(pkgtgz): .manifest fix-perms package: $(pkgtgz) $(pkggem) release: verify package $(release_notes) $(release_changes) - # make tgz release on RubyForge - rubyforge add_release -f -n $(release_notes) -a $(release_changes) \ - $(rfproject) $(rfpackage) $(VERSION) $(pkgtgz) # push gem to Gemcutter gem push $(pkggem) - # in case of gem downloads from RubyForge releases page - -rubyforge add_file \ - $(rfproject) $(rfpackage) $(VERSION) $(pkggem) - $(RAKE) fm_update VERSION=$(VERSION) else gem install-gem: GIT-VERSION-FILE $(MAKE) $@ VERSION=$(GIT_VERSION) diff --git a/Rakefile b/Rakefile index 01ff5d0..37569ce 100644 --- a/Rakefile +++ b/Rakefile @@ -1,47 +1,3 @@ -# -*- encoding: binary -*- -autoload :Gem, 'rubygems' -require 'wrongdoc' - -cgit_url = Wrongdoc.config[:cgit_url] -git_url = Wrongdoc.config[:git_url] - -desc "post to FM" -task :fm_update do - require 'tempfile' - require 'net/http' - require 'net/netrc' - require 'json' - version = ENV['VERSION'] or abort "VERSION= needed" - uri = URI.parse('https://freecode.com/projects/unicorn/releases.json') - rc = Net::Netrc.locate('unicorn-fm') or abort "~/.netrc not found" - api_token = rc.password - _, subject, body = `git cat-file tag v#{version}`.split(/\n\n/, 3) - tmp = Tempfile.new('fm-changelog') - tmp.puts subject - tmp.puts - tmp.puts body - tmp.flush - system(ENV["VISUAL"], tmp.path) or abort "#{ENV["VISUAL"]} failed: #$?" - changelog = File.read(tmp.path).strip - - req = { - "auth_code" => api_token, - "release" => { - "tag_list" => "Experimental", - "version" => version, - "changelog" => changelog, - }, - }.to_json - - if ! changelog.strip.empty? && version =~ %r{\A[\d\.]+\d+\z} - Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http| - p http.post(uri.path, req, {'Content-Type'=>'application/json'}) - end - else - warn "not updating freshmeat for v#{version}" - end -end - # optional rake-compiler support in case somebody needs to cross compile begin mk = "ext/unicorn_http/Makefile" diff --git a/unicorn.gemspec b/unicorn.gemspec index 9456db2..8623d44 100644 --- a/unicorn.gemspec +++ b/unicorn.gemspec @@ -26,7 +26,6 @@ Gem::Specification.new do |s| s.files = manifest s.homepage = Wrongdoc.config[:rdoc_url] s.rdoc_options = rdoc_options - s.rubyforge_project = %q{mongrel} s.test_files = test_files # for people that are absolutely stuck on Rails 2.3.2 and can't -- cgit v1.2.3-24-ge0c7 From 2bb8cc404232254af0d74f2dd3dec87d406fd764 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 18 Aug 2014 01:53:49 +0000 Subject: remove mongrel.rubyforge.org references mongrel.rubyforge.org has been dead longer than rubyforge.org! --- test/test_helper.rb | 4 ++-- test/unit/test_http_parser.rb | 4 ++-- test/unit/test_response.rb | 4 ++-- test/unit/test_server.rb | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index c65f2f3..c4fe07a 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,10 +1,10 @@ # -*- encoding: binary -*- -# Copyright (c) 2005 Zed A. Shaw +# Copyright (c) 2005 Zed A. Shaw # You can redistribute it and/or modify it under the same terms as Ruby 1.8 or # the GPLv2+ (GPLv3+ preferred) # -# Additional work donated by contributors. See http://mongrel.rubyforge.org/attributions.html +# Additional work donated by contributors. See git history # for more information. STDIN.sync = STDOUT.sync = STDERR.sync = true # buffering makes debugging hard diff --git a/test/unit/test_http_parser.rb b/test/unit/test_http_parser.rb index 8d5b251..2251dcf 100644 --- a/test/unit/test_http_parser.rb +++ b/test/unit/test_http_parser.rb @@ -1,10 +1,10 @@ # -*- encoding: binary -*- -# Copyright (c) 2005 Zed A. Shaw +# Copyright (c) 2005 Zed A. Shaw # You can redistribute it and/or modify it under the same terms as Ruby 1.8 or # the GPLv2+ (GPLv3+ preferred) # -# Additional work donated by contributors. See http://mongrel.rubyforge.org/attributions.html +# Additional work donated by contributors. See git history # for more information. require 'test/test_helper' diff --git a/test/unit/test_response.rb b/test/unit/test_response.rb index 85ac085..f33431b 100644 --- a/test/unit/test_response.rb +++ b/test/unit/test_response.rb @@ -1,10 +1,10 @@ # -*- encoding: binary -*- -# Copyright (c) 2005 Zed A. Shaw +# Copyright (c) 2005 Zed A. Shaw # You can redistribute it and/or modify it under the same terms as Ruby 1.8 or # the GPLv2+ (GPLv3+ preferred) # -# Additional work donated by contributors. See http://mongrel.rubyforge.org/attributions.html +# Additional work donated by contributors. See git history # for more information. require 'test/test_helper' diff --git a/test/unit/test_server.rb b/test/unit/test_server.rb index e5b335f..9c92bab 100644 --- a/test/unit/test_server.rb +++ b/test/unit/test_server.rb @@ -1,10 +1,10 @@ # -*- encoding: binary -*- -# Copyright (c) 2005 Zed A. Shaw +# Copyright (c) 2005 Zed A. Shaw # You can redistribute it and/or modify it under the same terms as Ruby 1.8 or # the GPLv2+ (GPLv3+ preferred) # -# Additional work donated by contributors. See http://mongrel.rubyforge.org/attributions.html +# Additional work donated by contributors. See git history # for more information. require 'test/test_helper' -- cgit v1.2.3-24-ge0c7 From 5176868d908b03dbd4d43c7fcc5545bccc2b138a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 4 Oct 2014 02:14:21 +0000 Subject: examples: add run_once to before_fork hook example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There may be code in a before_fork hook which should run only once, document an example using a guard variable since it may not be immediately obvious to all users. Inspired-by: BrĂ¡ulio Bhavamitra http://bogomips.org/unicorn-public/m/20141004015707.GA1951@dcvr.yhbt.net.html --- examples/unicorn.conf.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/examples/unicorn.conf.rb b/examples/unicorn.conf.rb index 9dce58a..4b28a5a 100644 --- a/examples/unicorn.conf.rb +++ b/examples/unicorn.conf.rb @@ -54,12 +54,23 @@ GC.respond_to?(:copy_on_write_friendly=) and # fast LAN. check_client_connection false +# local variable to guard against running a hook multiple times +run_once = true + before_fork do |server, worker| # the following is highly recomended for Rails + "preload_app true" # as there's no need for the master process to hold a connection defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect! + # Occasionally, it may be necessary to run non-idempotent code in the + # master before forking. Keep in mind the above disconnect! example + # is idempotent and does not need a guard. + if run_once + # do_something_once_here ... + run_once = false # prevent from firing again + end + # The following is only recommended for memory/DB-constrained # installations. It is not needed if your system can house # twice as many worker_processes as you have configured. -- cgit v1.2.3-24-ge0c7 From d6244f78af7910317733fb32adef20f3f3986871 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 21 Dec 2014 10:43:10 +0000 Subject: t/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") --- t/t0002-parser-error.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/t/t0002-parser-error.sh b/t/t0002-parser-error.sh index 9fa5a31..9dc1cd2 100755 --- a/t/t0002-parser-error.sh +++ b/t/t0002-parser-error.sh @@ -42,7 +42,7 @@ t_begin "send a huge Request URI (REQUEST_PATH > (12 * 1024))" && { } t_begin "response should be a 414 (REQUEST_PATH)" && { - grep -F 'HTTP/1.1 414 Request-URI Too Long' $tmp + grep -F 'HTTP/1.1 414 ' $tmp } t_begin "send a huge Request URI (QUERY_STRING > (10 * 1024))" && { @@ -63,7 +63,7 @@ t_begin "send a huge Request URI (QUERY_STRING > (10 * 1024))" && { } t_begin "response should be a 414 (QUERY_STRING)" && { - grep -F 'HTTP/1.1 414 Request-URI Too Long' $tmp + grep -F 'HTTP/1.1 414 ' $tmp } t_begin "send a huge Request URI (FRAGMENT > 1024)" && { @@ -84,7 +84,7 @@ t_begin "send a huge Request URI (FRAGMENT > 1024)" && { } t_begin "response should be a 414 (FRAGMENT)" && { - grep -F 'HTTP/1.1 414 Request-URI Too Long' $tmp + grep -F 'HTTP/1.1 414 ' $tmp } t_begin "server stderr should be clean" && check_stderr -- cgit v1.2.3-24-ge0c7 From 1dd67c4cf3e65f065f07f397f69517c9424d129a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 10 Jan 2015 03:58:35 +0000 Subject: switch docs + website to olddoc wrongdoc was difficult to maintain because of the tidy-ffi dependency and the HTML5 changes in Darkfish could not be handled well by Tidy. olddoc is superior as it generates leaner HTML which loads faster, requires less scrolling and less processing power to render. Aesthetic comparisons are subjective of course but completely unimportant compared to speed and accessibility. The presence of images and CSS on the old (Darkfish-based) site probably set unreasonable expectations as to my ability and willingness to view such things. No more, the new website is entirely simple HTML which renders well with even the wimpiest browser. --- .document | 1 - .gitignore | 4 ++-- .olddoc.yml | 15 +++++++++++++++ .wrongdoc.yml | 11 ----------- GNUmakefile | 39 ++++++++++++++------------------------- HACKING | 8 +++----- unicorn.gemspec | 8 ++++---- 7 files changed, 38 insertions(+), 48 deletions(-) create mode 100644 .olddoc.yml delete mode 100644 .wrongdoc.yml diff --git a/.document b/.document index 4092597..0160176 100644 --- a/.document +++ b/.document @@ -10,7 +10,6 @@ SIGNALS KNOWN_ISSUES TODO NEWS -ChangeLog LATEST lib/unicorn.rb lib/unicorn/configurator.rb diff --git a/.gitignore b/.gitignore index 19a82d6..ad92808 100644 --- a/.gitignore +++ b/.gitignore @@ -15,11 +15,11 @@ ext/unicorn_http/unicorn_http.c log/ pkg/ /vendor -/NEWS -/ChangeLog +/NEWS* /.manifest /GIT-VERSION-FILE /man /tmp /LATEST /lib/unicorn/version.rb +/*_1 diff --git a/.olddoc.yml b/.olddoc.yml new file mode 100644 index 0000000..063c1c6 --- /dev/null +++ b/.olddoc.yml @@ -0,0 +1,15 @@ +--- +cgit_url: http://bogomips.org/unicorn.git +git_url: git://bogomips.org/unicorn.git +rdoc_url: http://unicorn.bogomips.org/ +ml_url: http://bogomips.org/unicorn-public/ +merge_html: + unicorn_1: Documentation/unicorn.1.html + unicorn_rails_1: Documentation/unicorn_rails.1.html +noindex: +- Unicorn::Const +- LATEST +- TODO +- unicorn_rails_1 +public_email: unicorn-public@bogomips.org +private_email: unicorn@bogomips.org diff --git a/.wrongdoc.yml b/.wrongdoc.yml deleted file mode 100644 index 3c3cbaf..0000000 --- a/.wrongdoc.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -cgit_url: http://bogomips.org/unicorn.git -git_url: git://bogomips.org/unicorn.git -rdoc_url: http://unicorn.bogomips.org/ -ml_url: http://bogomips.org/unicorn-public/ -changelog_start: v1.1.5 -merge_html: - unicorn_1: Documentation/unicorn.1.html - unicorn_rails_1: Documentation/unicorn_rails.1.html -public_email: unicorn-public@bogomips.org -private_email: unicorn@bogomips.org diff --git a/GNUmakefile b/GNUmakefile index 6916b6e..d7f0118 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -8,6 +8,8 @@ RUBY = ruby RAKE = rake RAGEL = ragel RSYNC = rsync +OLDDOC = olddoc +RDOC = rdoc GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE @./GIT-VERSION-GEN @@ -152,35 +154,31 @@ clean: man html: $(MAKE) -C Documentation install-$@ -pkg_extra := GIT-VERSION-FILE lib/unicorn/version.rb ChangeLog LATEST NEWS \ +pkg_extra := GIT-VERSION-FILE lib/unicorn/version.rb LATEST NEWS \ $(ext)/unicorn_http.c $(man1_paths) -ChangeLog: GIT-VERSION-FILE .wrongdoc.yml - wrongdoc prepare - -.manifest: ChangeLog $(ext)/unicorn_http.c man +.manifest: $(ext)/unicorn_http.c man (git ls-files && for i in $@ $(pkg_extra); do echo $$i; done) | \ LC_ALL=C sort > $@+ cmp $@+ $@ || mv $@+ $@ $(RM) $@+ -doc: .document $(ext)/unicorn_http.c man html .wrongdoc.yml - for i in $(man1_rdoc); do echo > $$i; done +PLACEHOLDERS = $(man1_rdoc) +doc: .document $(ext)/unicorn_http.c man html .olddoc.yml $(PLACEHOLDERS) find bin lib -type f -name '*.rbc' -exec rm -f '{}' ';' $(RM) -r doc - wrongdoc all + $(OLDDOC) prepare + $(RDOC) -f oldweb + $(OLDDOC) merge install -m644 COPYING doc/COPYING install -m644 $(shell LC_ALL=C grep '^[A-Z]' .document) doc/ install -m644 $(man1_paths) doc/ tar cf - $$(git ls-files examples/) | (cd doc && tar xf -) - $(RM) $(man1_rdoc) # publishes docs to http://unicorn.bogomips.org publish_doc: -git set-file-times $(MAKE) doc - find doc/images -type f | \ - TZ=UTC xargs touch -d '1970-01-01 00:00:02' doc/rdoc.css $(MAKE) doc_gz chmod 644 $$(find doc -type f) $(RSYNC) -av doc/ unicorn.bogomips.org:/srv/unicorn/ @@ -188,27 +186,15 @@ publish_doc: # Create gzip variants of the same timestamp as the original so nginx # "gzip_static on" can serve the gzipped versions directly. -doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.\(gif\|jpg\|png\|gz\)$$') +doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.gz$$') doc_gz: for i in $(docs); do \ gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done ifneq ($(VERSION),) -rfproject := mongrel rfpackage := unicorn pkggem := pkg/$(rfpackage)-$(VERSION).gem pkgtgz := pkg/$(rfpackage)-$(VERSION).tgz -release_notes := release_notes-$(VERSION) -release_changes := release_changes-$(VERSION) - -release-notes: $(release_notes) -release-changes: $(release_changes) -$(release_changes): - wrongdoc release_changes > $@+ - $(VISUAL) $@+ && test -s $@+ && mv $@+ $@ -$(release_notes): - wrongdoc release_notes > $@+ - $(VISUAL) $@+ && test -s $@+ && mv $@+ $@ # ensures we're actually on the tagged $(VERSION), only used for release verify: @@ -244,7 +230,7 @@ $(pkgtgz): .manifest fix-perms package: $(pkgtgz) $(pkggem) -release: verify package $(release_notes) $(release_changes) +release: verify package # push gem to Gemcutter gem push $(pkggem) else @@ -252,5 +238,8 @@ gem install-gem: GIT-VERSION-FILE $(MAKE) $@ VERSION=$(GIT_VERSION) endif +$(PLACEHOLDERS): + echo olddoc_placeholder > $@ + .PHONY: .FORCE-GIT-VERSION-FILE doc $(T) $(slow_tests) man .PHONY: test-install diff --git a/HACKING b/HACKING index acb9f9d..9b4da1b 100644 --- a/HACKING +++ b/HACKING @@ -57,10 +57,8 @@ programming experience will come in handy (or be learned) here. === Documentation -We use RDoc 2.5.x with Darkfish for documentation as much as possible, -if you're on Ruby 1.8 you want to install the latest "rdoc" gem. Due to -the lack of RDoc-to-manpage converters we know about, we're writing -manpages in Markdown and converting to troff/HTML with Pandoc. +Due to the lack of RDoc-to-manpage converters we know about, we're +writing manpages in Markdown and converting to troff/HTML with Pandoc. Please wrap documentation at 72 characters-per-line or less (long URLs are exempt) so it is comfortably readable from terminals. @@ -114,7 +112,7 @@ don't email the git mailing list or maintainer with Unicorn patches :) In order to build the gem, you must install the following components: - * wrongdoc + * olddoc (RubyGem) * pandoc You can build the Unicorn gem with the following command: diff --git a/unicorn.gemspec b/unicorn.gemspec index 8623d44..fc6f475 100644 --- a/unicorn.gemspec +++ b/unicorn.gemspec @@ -1,8 +1,8 @@ # -*- encoding: binary -*- ENV["VERSION"] or abort "VERSION= must be specified" manifest = File.readlines('.manifest').map! { |x| x.chomp! } -require 'wrongdoc' -extend Wrongdoc::Gemspec +require 'olddoc' +extend Olddoc::Gemspec name, summary, title = readme_metadata # don't bother with tests that fork, not worth our time to get working @@ -24,7 +24,7 @@ Gem::Specification.new do |s| s.extensions = %w(ext/unicorn_http/extconf.rb) s.extra_rdoc_files = extra_rdoc_files(manifest) s.files = manifest - s.homepage = Wrongdoc.config[:rdoc_url] + s.homepage = Olddoc.config['rdoc_url'] s.rdoc_options = rdoc_options s.test_files = test_files @@ -37,7 +37,7 @@ Gem::Specification.new do |s| s.add_dependency(%q, '~> 0.7') s.add_development_dependency('test-unit', '~> 3.0') - s.add_development_dependency('wrongdoc', '~> 1.8') + s.add_development_dependency('olddoc', '~> 1.0') s.licenses = ["GPLv2+", "Ruby 1.8"] end -- cgit v1.2.3-24-ge0c7 From 0dafad76c20844ec10fa7674fd778578bc9a8ed0 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 10 Jan 2015 04:44:49 +0000 Subject: README: clarify/reduce references to unicorn_rails unicorn_rails is an ancient compatibility wrapper for ancient versions of Rails which did not use Rack. Those applications have likely moved on, so stop promoting unicorn_rails. --- README | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README b/README index 1bd42b8..02d01e1 100644 --- a/README +++ b/README @@ -95,13 +95,13 @@ from git. == Usage -=== non-Rails Rack applications +=== Rack (including Rails 3+) applications In APP_ROOT, run: unicorn -=== for Rails applications (should work for all 1.2 or later versions) +=== Ancient Rails 1.2 - 2.x versions In RAILS_ROOT, run: @@ -122,8 +122,7 @@ The default settings are designed for maximum out-of-the-box compatibility with existing applications. Most command-line options for other Rack applications (above) are also -supported. Run `unicorn -h` or `unicorn_rails -h` to see command-line -options. +supported. Run `unicorn -h` to see command-line options. == Disclaimer -- cgit v1.2.3-24-ge0c7 From 198c421ac07b88ade69d9710501077b9d0ef4a9f Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 17 Jan 2015 04:30:58 +0000 Subject: gemspec: fixup olddoc migration rdoc_options is no longer necesary with olddoc as olddoc can infer document titles and only generates cgit-compatible URLs to source code. --- unicorn.gemspec | 2 -- 1 file changed, 2 deletions(-) diff --git a/unicorn.gemspec b/unicorn.gemspec index fc6f475..47d5670 100644 --- a/unicorn.gemspec +++ b/unicorn.gemspec @@ -17,7 +17,6 @@ Gem::Specification.new do |s| s.version = ENV["VERSION"].dup s.authors = ["#{name} hackers"] s.summary = summary - s.date = Time.now.utc.strftime('%Y-%m-%d') s.description = readme_description s.email = %q{unicorn-public@bogomips.org} s.executables = %w(unicorn unicorn_rails) @@ -25,7 +24,6 @@ Gem::Specification.new do |s| s.extra_rdoc_files = extra_rdoc_files(manifest) s.files = manifest s.homepage = Olddoc.config['rdoc_url'] - s.rdoc_options = rdoc_options s.test_files = test_files # for people that are absolutely stuck on Rails 2.3.2 and can't -- cgit v1.2.3-24-ge0c7 From e5925e55a5365053415f08bb4cb7f810a533601d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 28 Jan 2015 19:00:32 +0000 Subject: GNUmakefile: fix clean gem build + reduce build cruft Ensure we have a NEWS file for building the gem beforehand. We don't need to polute lib/ with object files, either. --- GNUmakefile | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index d7f0118..6dddf6c 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -57,10 +57,7 @@ $(ext)/Makefile: $(ext)/extconf.rb $(c_files) cd $(@D) && $(RUBY) extconf.rb $(ext)/unicorn_http.$(DLEXT): $(ext)/Makefile $(MAKE) -C $(@D) -lib/unicorn_http.$(DLEXT): $(ext)/unicorn_http.$(DLEXT) - @mkdir -p lib - install -m644 $< $@ -http: lib/unicorn_http.$(DLEXT) +http: $(ext)/unicorn_http.$(DLEXT) test-install: $(test_prefix)/.stamp $(test_prefix)/.stamp: $(inst_deps) @@ -131,7 +128,6 @@ $(T): $(test_prefix)/.stamp install: $(bins) $(ext)/unicorn_http.c $(prep_setup_rb) - $(RM) lib/unicorn_http.$(DLEXT) $(RM) -r .install-tmp mkdir .install-tmp cp -p bin/* .install-tmp @@ -147,7 +143,7 @@ prep_setup_rb := @-$(RM) $(setup_rb_files);$(MAKE) -C $(ext) clean clean: -$(MAKE) -C $(ext) clean -$(MAKE) -C Documentation clean - $(RM) $(ext)/Makefile lib/unicorn_http.$(DLEXT) + $(RM) $(ext)/Makefile $(RM) $(setup_rb_files) $(t_log) $(RM) -r $(test_prefix) man @@ -157,7 +153,10 @@ man html: pkg_extra := GIT-VERSION-FILE lib/unicorn/version.rb LATEST NEWS \ $(ext)/unicorn_http.c $(man1_paths) -.manifest: $(ext)/unicorn_http.c man +NEWS: + $(OLDDOC) prepare + +.manifest: $(ext)/unicorn_http.c man NEWS (git ls-files && for i in $@ $(pkg_extra); do echo $$i; done) | \ LC_ALL=C sort > $@+ cmp $@+ $@ || mv $@+ $@ -- cgit v1.2.3-24-ge0c7 From c3271c2eb26578316d7cecad1a2b99e1814a5fa3 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 6 Feb 2015 20:09:19 +0000 Subject: doc: 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). [reinstate 1.9 version check for listener_fds in backport] --- HACKING | 23 +++------------- KNOWN_ISSUES | 20 +++++++------- README | 3 ++- Sandbox | 2 +- lib/unicorn/configurator.rb | 2 -- lib/unicorn/http_server.rb | 2 +- local.mk.sample | 59 ----------------------------------------- t/README | 2 +- test/unit/test_socket_helper.rb | 4 +-- 9 files changed, 21 insertions(+), 96 deletions(-) delete mode 100644 local.mk.sample diff --git a/HACKING b/HACKING index 9b4da1b..6c5f897 100644 --- a/HACKING +++ b/HACKING @@ -19,13 +19,6 @@ RubyGems. Users of GNU-based systems (such as GNU/Linux) usually have GNU make installed as "make" instead of "gmake". -Since we don't load RubyGems by default, loading Rack properly requires -setting up RUBYLIB to point to where Rack is located. Not loading -RubyGems drastically lowers the time to run the full test suite. You -may setup a "local.mk" file in the top-level working directory to setup -your RUBYLIB and any other environment variables. A "local.mk.sample" -file is provided for reference. - Running the entire test suite with 4 tests in parallel: gmake -j4 check @@ -70,10 +63,9 @@ becomes unavailable. === Ruby/C Compatibility -We target Ruby 1.8.6+, 1.9 and will target Rubinius as it becomes -production-ready. We need the Ruby implementation to support fork, -exec, pipe, UNIX signals, access to integer file descriptors and -ability to use unlinked files. +We target mainline Ruby 1.9.3 and later. We need the Ruby +implementation to support fork, exec, pipe, UNIX signals, access to +integer file descriptors and ability to use unlinked files. All of our C code is OS-independent and should run on compilers supported by the versions of Ruby we target. @@ -123,13 +115,6 @@ You can build the Unicorn gem with the following command: It is easy to install the contents of your git working directory: -Via RubyGems (RubyGems 1.3.5+ recommended for prerelease versions): +Via RubyGems gmake install-gem - -Without RubyGems (via setup.rb): - - gmake install - -It is not at all recommended to mix a RubyGems installation with an -installation done without RubyGems, however. diff --git a/KNOWN_ISSUES b/KNOWN_ISSUES index 38263e7..69e4f57 100644 --- a/KNOWN_ISSUES +++ b/KNOWN_ISSUES @@ -17,16 +17,6 @@ acceptable solution. Those issues are documented here. have builtin workarounds for Kernel#rand and OpenSSL::Random users, but applications may use other PRNGs. -* Under some versions of Ruby 1.8, it is necessary to call +srand+ in an - after_fork hook to get correct random number generation. We have a builtin - workaround for this starting with \Unicorn 3.6.1 - - See http://redmine.ruby-lang.org/issues/show/4338 - -* On Ruby 1.8 prior to Ruby 1.8.7-p248, *BSD platforms have a broken - stdio that causes failure for file uploads larger than 112K. Upgrade - your version of Ruby or continue using Unicorn 1.x/3.4.x. - * For notes on sandboxing tools such as Bundler or Isolate, see the {Sandbox}[link:Sandbox.html] page. @@ -44,6 +34,16 @@ acceptable solution. Those issues are documented here. == Known Issues (Old) +* Under some versions of Ruby 1.8, it is necessary to call +srand+ in an + after_fork hook to get correct random number generation. We have a builtin + workaround for this starting with \Unicorn 3.6.1 + + See http://redmine.ruby-lang.org/issues/show/4338 + +* On Ruby 1.8 prior to Ruby 1.8.7-p248, *BSD platforms have a broken + stdio that causes failure for file uploads larger than 112K. Upgrade + your version of Ruby or continue using Unicorn 1.x/3.4.x. + * Under Ruby 1.9.1, methods like Array#shuffle and Array#sample will segfault if called after forking. Upgrade to Ruby 1.9.2 or call "Kernel.rand" in your after_fork hook to reinitialize the random diff --git a/README b/README index 02d01e1..f084d0c 100644 --- a/README +++ b/README @@ -12,7 +12,8 @@ both the the request and response in between \Unicorn and slow clients. cut out everything that is better supported by the operating system, {nginx}[http://nginx.net/] or {Rack}[http://rack.github.io/]. -* Compatible with Ruby 1.8 and later. Rubinius support is in-progress. +* Compatible with Ruby 1.9.3 and later. + unicorn 4.8.x will remain supported for Ruby 1.8 users. * Process management: \Unicorn will reap and restart workers that die from broken apps. There is no need to manage multiple processes diff --git a/Sandbox b/Sandbox index 3c7f226..f662b27 100644 --- a/Sandbox +++ b/Sandbox @@ -86,7 +86,7 @@ For now workarounds include doing one of the following: 3. Explicitly setting RUBYLIB or $LOAD_PATH to include any gem path where the unicorn gem is installed - (e.g. /usr/lib/ruby/gems/1.9.1/gems/unicorn-VERSION/lib) + (e.g. /usr/lib/ruby/gems/1.9.3/gems/unicorn-VERSION/lib) === RUBYOPT pollution from SIGUSR2 upgrades diff --git a/lib/unicorn/configurator.rb b/lib/unicorn/configurator.rb index 9406223..0658c81 100644 --- a/lib/unicorn/configurator.rb +++ b/lib/unicorn/configurator.rb @@ -309,8 +309,6 @@ class Unicorn::Configurator # to receive IPv4 queries on dual-stack systems. A separate IPv4-only # listener is required if this is true. # - # This option is only available for Ruby 1.9.2 and later. - # # Enabling this option for the IPv6-only listener and having a # separate IPv4 listener is recommended if you wish to support IPv6 # on the same TCP port. Otherwise, the value of \env[\"REMOTE_ADDR\"] diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb index a0ca302..509fb36 100644 --- a/lib/unicorn/http_server.rb +++ b/lib/unicorn/http_server.rb @@ -69,7 +69,7 @@ class Unicorn::HttpServer # you can set the following in your Unicorn config file, HUP and then # continue with the traditional USR2 + QUIT upgrade steps: # - # Unicorn::HttpServer::START_CTX[0] = "/home/bofh/1.9.2/bin/unicorn" + # Unicorn::HttpServer::START_CTX[0] = "/home/bofh/2.2.0/bin/unicorn" START_CTX = { :argv => ARGV.map { |arg| arg.dup }, 0 => $0.dup, diff --git a/local.mk.sample b/local.mk.sample deleted file mode 100644 index 25bca5d..0000000 --- a/local.mk.sample +++ /dev/null @@ -1,59 +0,0 @@ -# this is the local.mk file used by Eric Wong on his dev boxes. -# GNUmakefile will source local.mk in the top-level source tree -# if it is present. -# -# This is depends on a bunch of GNU-isms from bash, sed, touch. - -DLEXT := so - -# Avoid loading rubygems to speed up tests because gmake is -# fork+exec heavy with Ruby. -prefix = $(HOME) - -# XXX clean this up -ifeq ($(r192),) - ifeq ($(r19),) - ifeq ($(rbx),) - ifeq ($(r186),) - RUBY := $(prefix)/bin/ruby - else - prefix := $(prefix)/r186-p114 - export PATH := $(prefix)/bin:$(PATH) - RUBY := $(prefix)/bin/ruby - endif - else - prefix := $(prefix)/rbx - export PATH := $(prefix)/bin:$(PATH) - RUBY := $(prefix)/bin/rbx - endif - else - prefix := $(prefix)/ruby-1.9 - export PATH := $(prefix)/bin:$(PATH) - RUBY := $(prefix)/bin/ruby --disable-gems - endif -else - prefix := $(prefix)/ruby-1.9.2 - export PATH := $(prefix)/bin:$(PATH) - RUBY := $(prefix)/bin/ruby --disable-gems -endif - -# pipefail is THE reason to use bash (v3+) or never revisions of ksh93 -# SHELL := /bin/bash -e -o pipefail -SHELL := /bin/ksh93 -e -o pipefail - -full-test: test-18 test-191 test-192 test-rbx test-186 - -# FIXME: keep eye on Rubinius activity and wait for fixes from upstream -# so we don't need RBX_SKIP anymore -test-rbx: export RBX_SKIP := 1 -test-rbx: export RUBY := $(RUBY) -test-rbx: - $(MAKE) test test-integration rbx=T 2>&1 |sed -e 's!^!rbx !' -test-186: - $(MAKE) test-all r186=1 2>&1 |sed 's!^!1.8.6 !' -test-18: - $(MAKE) test-all 2>&1 |sed 's!^!1.8 !' -test-191: - $(MAKE) test-all r19=1 2>&1 |sed 's!^!1.9.1 !' -test-192: - $(MAKE) test-all r192=1 2>&1 |sed 's!^!1.9.2 !' diff --git a/t/README b/t/README index 095f106..bcaf3ce 100644 --- a/t/README +++ b/t/README @@ -10,7 +10,7 @@ comfortable writing integration tests with. == Requirements -* {Ruby 1.8 or 1.9}[http://www.ruby-lang.org/] (duh!) +* {Ruby 1.9.3+}[https://www.ruby-lang.org/] (duh!) * {GNU make}[http://www.gnu.org/software/make/] * {socat}[http://www.dest-unreach.org/socat/] * {curl}[http://curl.haxx.se/] diff --git a/test/unit/test_socket_helper.rb b/test/unit/test_socket_helper.rb index 8992757..7135928 100644 --- a/test/unit/test_socket_helper.rb +++ b/test/unit/test_socket_helper.rb @@ -182,8 +182,8 @@ class TestSocketHelper < Test::Unit::TestCase sock = bind_listen "[#@test6_addr]:#{port}", :ipv6only => true cur = sock.getsockopt(:IPPROTO_IPV6, :IPV6_V6ONLY).unpack('i')[0] assert_equal 1, cur - rescue Errno::EAFNOSUPPORT - end if RUBY_VERSION >= "1.9.2" + rescue Errno::EAFNOSUPPORT + end def test_reuseport port = unused_port @test_addr -- cgit v1.2.3-24-ge0c7 From dac42b86497e98d5f184d4c40ddc4ca718383403 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 6 Feb 2015 22:17:26 +0000 Subject: fix uninstalled testing and reduce require paths This fixes a bug introduced in commit fe83ead4eae6f011fa15f506cd80cb4256813a92 (GNUmakefile: fix clean gem build + reduce build cruft) which broke clean Ruby installations without an existing unicorn gem installed :x [fixed test/unit/test_http_parser_xftrust.rb for backport] --- GNUmakefile | 10 +++++++--- test/exec/test_exec.rb | 2 +- test/unit/test_http_parser.rb | 2 +- test/unit/test_http_parser_ng.rb | 2 +- test/unit/test_http_parser_xftrust.rb | 2 +- test/unit/test_request.rb | 2 +- test/unit/test_response.rb | 2 +- test/unit/test_server.rb | 2 +- test/unit/test_signals.rb | 2 +- test/unit/test_socket_helper.rb | 2 +- test/unit/test_upload.rb | 2 +- test/unit/test_util.rb | 2 +- 12 files changed, 18 insertions(+), 14 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 6dddf6c..7cf1023 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -59,13 +59,17 @@ $(ext)/unicorn_http.$(DLEXT): $(ext)/Makefile $(MAKE) -C $(@D) http: $(ext)/unicorn_http.$(DLEXT) +# only used for tests +http-install: $(ext)/unicorn_http.$(DLEXT) + install -m644 $< lib/ + test-install: $(test_prefix)/.stamp $(test_prefix)/.stamp: $(inst_deps) mkdir -p $(test_prefix)/.ccache tar cf - $(inst_deps) GIT-VERSION-GEN | \ (cd $(test_prefix) && tar xf -) $(MAKE) -C $(test_prefix) clean - $(MAKE) -C $(test_prefix) http shebang RUBY="$(RUBY)" + $(MAKE) -C $(test_prefix) http-install shebang RUBY="$(RUBY)" > $@ # this is only intended to be run within $(test_prefix) @@ -115,14 +119,14 @@ run_test = $(quiet_pre) \ %.n: arg = $(subst .n,,$(subst --, -n ,$@)) %.n: t = $(subst .n,$(log_suffix),$@) %.n: export PATH := $(test_prefix)/bin:$(PATH) -%.n: export RUBYLIB := $(test_prefix):$(test_prefix)/lib:$(MYLIBS) +%.n: export RUBYLIB := $(test_prefix)/lib:$(MYLIBS) %.n: $(test_prefix)/.stamp $(run_test) $(T): arg = $@ $(T): t = $(subst .rb,$(log_suffix),$@) $(T): export PATH := $(test_prefix)/bin:$(PATH) -$(T): export RUBYLIB := $(test_prefix):$(test_prefix)/lib:$(MYLIBS) +$(T): export RUBYLIB := $(test_prefix)/lib:$(MYLIBS) $(T): $(test_prefix)/.stamp $(run_test) diff --git a/test/exec/test_exec.rb b/test/exec/test_exec.rb index 10a1bae..6deb96b 100644 --- a/test/exec/test_exec.rb +++ b/test/exec/test_exec.rb @@ -2,7 +2,7 @@ # Copyright (c) 2009 Eric Wong FLOCK_PATH = File.expand_path(__FILE__) -require 'test/test_helper' +require './test/test_helper' do_test = true $unicorn_bin = ENV['UNICORN_TEST_BIN'] || "unicorn" diff --git a/test/unit/test_http_parser.rb b/test/unit/test_http_parser.rb index 2251dcf..431ede5 100644 --- a/test/unit/test_http_parser.rb +++ b/test/unit/test_http_parser.rb @@ -7,7 +7,7 @@ # Additional work donated by contributors. See git history # for more information. -require 'test/test_helper' +require './test/test_helper' include Unicorn diff --git a/test/unit/test_http_parser_ng.rb b/test/unit/test_http_parser_ng.rb index ab335ac..4f13c9a 100644 --- a/test/unit/test_http_parser_ng.rb +++ b/test/unit/test_http_parser_ng.rb @@ -1,6 +1,6 @@ # -*- encoding: binary -*- -require 'test/test_helper' +require './test/test_helper' require 'digest/md5' include Unicorn diff --git a/test/unit/test_http_parser_xftrust.rb b/test/unit/test_http_parser_xftrust.rb index db8cfa9..8d0cc37 100644 --- a/test/unit/test_http_parser_xftrust.rb +++ b/test/unit/test_http_parser_xftrust.rb @@ -1,5 +1,5 @@ # -*- encoding: binary -*- -require 'test/test_helper' +require './test/test_helper' include Unicorn diff --git a/test/unit/test_request.rb b/test/unit/test_request.rb index fbda1a2..f0ccaf7 100644 --- a/test/unit/test_request.rb +++ b/test/unit/test_request.rb @@ -4,7 +4,7 @@ # You can redistribute it and/or modify it under the same terms as Ruby 1.8 or # the GPLv2+ (GPLv3+ preferred) -require 'test/test_helper' +require './test/test_helper' include Unicorn diff --git a/test/unit/test_response.rb b/test/unit/test_response.rb index f33431b..10b247b 100644 --- a/test/unit/test_response.rb +++ b/test/unit/test_response.rb @@ -7,7 +7,7 @@ # Additional work donated by contributors. See git history # for more information. -require 'test/test_helper' +require './test/test_helper' require 'time' include Unicorn diff --git a/test/unit/test_server.rb b/test/unit/test_server.rb index 9c92bab..8b3afad 100644 --- a/test/unit/test_server.rb +++ b/test/unit/test_server.rb @@ -7,7 +7,7 @@ # Additional work donated by contributors. See git history # for more information. -require 'test/test_helper' +require './test/test_helper' include Unicorn diff --git a/test/unit/test_signals.rb b/test/unit/test_signals.rb index 443c736..4592819 100644 --- a/test/unit/test_signals.rb +++ b/test/unit/test_signals.rb @@ -6,7 +6,7 @@ # # Ensure we stay sane in the face of signals being sent to us -require 'test/test_helper' +require './test/test_helper' include Unicorn diff --git a/test/unit/test_socket_helper.rb b/test/unit/test_socket_helper.rb index 7135928..7722049 100644 --- a/test/unit/test_socket_helper.rb +++ b/test/unit/test_socket_helper.rb @@ -1,6 +1,6 @@ # -*- encoding: binary -*- -require 'test/test_helper' +require './test/test_helper' require 'tempfile' class TestSocketHelper < Test::Unit::TestCase diff --git a/test/unit/test_upload.rb b/test/unit/test_upload.rb index bcce4bc..5de02e4 100644 --- a/test/unit/test_upload.rb +++ b/test/unit/test_upload.rb @@ -1,7 +1,7 @@ # -*- encoding: binary -*- # Copyright (c) 2009 Eric Wong -require 'test/test_helper' +require './test/test_helper' require 'digest/md5' include Unicorn diff --git a/test/unit/test_util.rb b/test/unit/test_util.rb index 904d51c..4d17a16 100644 --- a/test/unit/test_util.rb +++ b/test/unit/test_util.rb @@ -1,6 +1,6 @@ # -*- encoding: binary -*- -require 'test/test_helper' +require './test/test_helper' require 'tempfile' class TestUtil < Test::Unit::TestCase -- cgit v1.2.3-24-ge0c7 From 030b17f4e10fb847f39f6bdadfaf036f2a7d9ea4 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 6 Feb 2015 22:31:24 +0000 Subject: test_socket_helper: do not depend on SO_REUSEPORT Older Rubies (2.0) may not define SO_REUSEPORT even if the kernel and libc support it --- test/unit/test_socket_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/test_socket_helper.rb b/test/unit/test_socket_helper.rb index 7722049..09d65af 100644 --- a/test/unit/test_socket_helper.rb +++ b/test/unit/test_socket_helper.rb @@ -193,5 +193,5 @@ class TestSocketHelper < Test::Unit::TestCase assert_operator cur, :>, 0 rescue Errno::ENOPROTOOPT # kernel does not support SO_REUSEPORT (older Linux) - end + end if defined?(Socket::SO_REUSEPORT) end -- cgit v1.2.3-24-ge0c7 From e407195b12e454ea3fbc0d28ec61b5ed587b5c53 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 12 Feb 2015 19:01:24 +0000 Subject: ISSUES: add section for bugs in other projects This is not anything new, just documenting what has been going on since the beginning. There's been a small number of generic networking (or mm) bugs in the kernel which affect unicorn, but are usually found and fixed with more popular, non-Ruby servers, first. Aside from generic performance problems, I don't think there's ever been a glibc bug which affected unicorn. --- ISSUES | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/ISSUES b/ISSUES index f66d14a..8910180 100644 --- a/ISSUES +++ b/ISSUES @@ -6,7 +6,7 @@ submit patches and/or obtain support after you have searched the {documentation}[http://unicorn.bogomips.org/]. * No subscription will ever be required to email the public inbox. -* Please Cc: all participants in a thread, as subscription is optional +* Cc: all participants in a thread or commit, as subscription is optional * Do not {top post}[http://catb.org/jargon/html/T/top-post.html] in replies * Quote as little as possible of the message you're replying to * Do not send HTML mail, it will likely be flagged as spam @@ -18,6 +18,40 @@ instead and your issue will be handled discreetly. If you don't get a response within a few days, we may have forgotten about it so feel free to ask again. +== Bugs in related projects + +unicorn is sometimes affected by bugs in its dependencies. Bugs +triggered by unicorn in mainline Ruby, rack, GNU C library (glibc), +or the Linux kernel will be reported upstream and fixed. + +For bugs in Ruby itself, we may forward bugs to +https://bugs.ruby-lang.org/ and discuss+fix them on the ruby-core +list at mailto:ruby-core@ruby-lang.org +Subscription to post is required to ruby-core, unfortunately: +mailto:ruby-core-request@ruby-lang.org?subject=subscribe + +For uncommon bugs in Rack, we may forward bugs to +mailto:rack-devel@googlegroups.com and discuss there. +Subscription (without any web UI or Google account) is possible via: +mailto:rack-devel+subscribe@googlegroups.com +Note: not everyone can use the proprietary bug tracker used by Rack, +but their mailing list remains operational. + +Uncommon bugs we encounter in the Linux kernel should be Cc:-ed to the +Linux kernel mailing list (LKML) at mailto:linux-kernel@vger.kernel.org +and subsystem maintainers such as mailto:netdev@vger.kernel.org +(for networking issues). It is expected practice to Cc: anybody +involved with any problematic commits (including those in the +Signed-off-by: and other trailer lines). No subscription is necessary, +and the our mailing list follows the same conventions as LKML for +interopability. There is a kernel.org Bugzilla instance, but it is +ignored by most developers. + +Likewise for any rare glibc bugs we might encounter, we should Cc: +mailto:libc-alpha@sourceware.org +Keep in mind glibc upstream does use Bugzilla for tracking bugs: +https://sourceware.org/bugzilla/ + == Submitting Patches See the HACKING document (and additionally, the -- cgit v1.2.3-24-ge0c7 From 0d9b834624f5c74200c7d7f5ba42b0d8557c674b Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 18 Feb 2015 09:22:56 +0000 Subject: explain 11 byte magic number for self-pipe Oops, this should've been explained long ago but apparently not. In response to a comment on http://www.sitepoint.com/the-self-pipe-trick-explained/ > Does anybody know why both unicorn and foreman read 11 bytes from > self-pipe? Unfortunately I couldn't find a way to comment on the site on a JavaScript-free browser nor does it seem possible without registering. Again, anybody can send plain-text mail to: unicorn-public@bogomips.org No registration, no real name policy, no terms-of-service, just plain-text. Feel free to use Tor, mixmaster or any anonymity service, too. --- lib/unicorn/http_server.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb index 509fb36..329c5bf 100644 --- a/lib/unicorn/http_server.rb +++ b/lib/unicorn/http_server.rb @@ -389,6 +389,10 @@ class Unicorn::HttpServer # wait for a signal hander to wake us up and then consume the pipe def master_sleep(sec) + # 11 bytes is the maximum string length which can be embedded within + # the Ruby itself and not require a separate malloc (on 32-bit MRI 1.9+). + # Most reads are only one byte here and uncommon, so it's not worth a + # persistent buffer, either: IO.select([ SELF_PIPE[0] ], nil, nil, sec) or return SELF_PIPE[0].kgio_tryread(11) end -- cgit v1.2.3-24-ge0c7 From 1c4843708b0fddbb9d196d9419b220f82707ed61 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 1 Mar 2015 09:54:48 +0000 Subject: Links: mark Rainbows! as historical, reference yahns Pushing the boundaries of bad marketing :P --- Links | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Links b/Links index 0355850..5e868fd 100644 --- a/Links +++ b/Links @@ -45,7 +45,10 @@ or services behind them. * {Green Unicorn}[http://gunicorn.org/] - a Python version of \Unicorn * {Rainbows!}[http://rainbows.bogomips.org/] - \Unicorn for sleepy - apps and slow clients. + apps and slow clients (historical). + +* {yahns}[http://yahns.yhbt.net/] - like Rainbows!, but with fewer options + and designed for energy efficiency on idle sites. === Prior Work -- cgit v1.2.3-24-ge0c7 From 548e1e67d314f6ebd17df37ece0ee20632462f6f Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 12 Mar 2015 22:09:38 +0000 Subject: doc: document UNICORN_FD in manpage Due to the prevalence of socket activation in modern init systems, we shall document UNICORN_FD (previously an implementation detail) in the manpage. --- Documentation/unicorn.1.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/unicorn.1.txt b/Documentation/unicorn.1.txt index 376a6c6..b03962e 100644 --- a/Documentation/unicorn.1.txt +++ b/Documentation/unicorn.1.txt @@ -163,6 +163,13 @@ set in the old master process are inherited by the new master process. Unicorn only uses (and will overwrite) the UNICORN_FD environment variable internally when doing transparent upgrades. +UNICORN_FD is a comma-delimited list of one or more file descriptors +used to implement USR2 upgrades. Init systems may bind listen sockets +itself and spawn unicorn with UNICORN_FD set to the file descriptor +numbers of the listen socket(s). The unicorn CONFIG_FILE must still +have the inherited listen socket parameters defined as in a normal +startup, otherwise the socket will be closed. + # SEE ALSO * unicorn_rails(1) -- cgit v1.2.3-24-ge0c7 From 3bdf5481e49d76b4502c51e5bdd93f68bfd1f0b4 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 24 Apr 2015 02:38:15 +0000 Subject: tee_input: support for Rack::TempfileReaper middleware Rack::TempfileReaper was added in rack 1.6 to cleanup temporary files. Make Unicorn::TmpIO ducktype-compatible so Rack::TempfileReaper may be used to free up space used by temporary buffer files. Ref: Reported-by: Mike Mulvaney --- lib/unicorn/tee_input.rb | 9 ++++++++- lib/unicorn/tmpio.rb | 3 +++ test/unit/test_tee_input.rb | 10 ++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/unicorn/tee_input.rb b/lib/unicorn/tee_input.rb index 637c583..3c6d18a 100644 --- a/lib/unicorn/tee_input.rb +++ b/lib/unicorn/tee_input.rb @@ -28,13 +28,20 @@ class Unicorn::TeeInput < Unicorn::StreamInput @@client_body_buffer_size end + # for Rack::TempfileReaper in rack 1.6+ + def new_tmpio # :nodoc: + tmpio = Unicorn::TmpIO.new + (@parser.env['rack.tempfiles'] ||= []) << tmpio + tmpio + end + # Initializes a new TeeInput object. You normally do not have to call # this unless you are writing an HTTP server. def initialize(socket, request) @len = request.content_length super @tmp = @len && @len <= @@client_body_buffer_size ? - StringIO.new("") : Unicorn::TmpIO.new + StringIO.new("") : new_tmpio end # :call-seq: diff --git a/lib/unicorn/tmpio.rb b/lib/unicorn/tmpio.rb index 2da05a2..dcdf9da 100644 --- a/lib/unicorn/tmpio.rb +++ b/lib/unicorn/tmpio.rb @@ -26,4 +26,7 @@ class Unicorn::TmpIO < File def size stat.size end unless File.method_defined?(:size) + + # pretend we're Tempfile for Rack::TempfileReaper + alias close! close end diff --git a/test/unit/test_tee_input.rb b/test/unit/test_tee_input.rb index 0c2c941..4647e66 100644 --- a/test/unit/test_tee_input.rb +++ b/test/unit/test_tee_input.rb @@ -29,6 +29,13 @@ class TestTeeInput < Test::Unit::TestCase end while true end + def check_tempfiles + tmp = @parser.env["rack.tempfiles"] + assert_instance_of Array, tmp + assert_operator tmp.size, :>=, 1 + assert_instance_of Unicorn::TmpIO, tmp[0] + end + def test_gets_long r = init_request("hello", 5 + (4096 * 4 * 3) + "#$/foo#$/".size) ti = TeeInput.new(@rd, r) @@ -106,6 +113,7 @@ class TestTeeInput < Test::Unit::TestCase assert_kind_of File, ti.tmp assert_equal 0, ti.tmp.pos assert_equal Unicorn::Const::MAX_BODY + 1, ti.size + check_tempfiles end def test_read_in_full_if_content_length @@ -148,6 +156,7 @@ class TestTeeInput < Test::Unit::TestCase assert_nil ti.read(1) pid, status = Process.waitpid2(pid) assert status.success? + check_tempfiles end def test_chunked @@ -183,6 +192,7 @@ class TestTeeInput < Test::Unit::TestCase status = nil pid, status = Process.waitpid2(pid) assert status.success? + check_tempfiles end def test_chunked_ping_pong -- cgit v1.2.3-24-ge0c7 From d33d32fe87645e35ad0d0f3438bce9ba8a649da8 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 24 Apr 2015 02:45:21 +0000 Subject: support TempfileReaper in deployment and development envs rack 1.6 added a TempfileReaper middleware to cleanup temporary files. Enable it by default for users running rack 1.6 or later to avoid leaving temporary files around. --- lib/unicorn.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/unicorn.rb b/lib/unicorn.rb index 638b846..358748f 100644 --- a/lib/unicorn.rb +++ b/lib/unicorn.rb @@ -67,6 +67,7 @@ module Unicorn use Rack::CommonLogger, $stderr use Rack::ShowExceptions use Rack::Lint + use Rack::TempfileReaper if Rack.const_defined?(:TempfileReaper) run inner_app end.to_app when "deployment" @@ -74,6 +75,7 @@ module Unicorn use Rack::ContentLength use Rack::Chunked use Rack::CommonLogger, $stderr + use Rack::TempfileReaper if Rack.const_defined?(:TempfileReaper) run inner_app end.to_app else -- cgit v1.2.3-24-ge0c7 From fcc591a23014724828dac86f805d10782a4e51e9 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 24 Apr 2015 03:03:12 +0000 Subject: unicorn 4.9.0 - TempfileReaper support in Rack 1.6 This release supports the Rack::TempfileReaper middleware found in rack 1.6 for cleaning up disk space used by temporary files. We also use Rack::TempfileReaper for cleaning up large temporary files buffered with TeeInput. Users on rack 1.5 and earlier will see no changes. There's also a bunch of documentation/build system improvements. This is likely to be the last Ruby 1.8-compatible release, unicorn 5.x will require 1.9.3 or later as well as dropping lots of cruft (the stupid "Status:" header in responses being the most notable). 21 changes backported from master: ISSUES: update with mailing list subscription FAQ: add entry for Rails autoflush_log dev: remove isolate dependency unicorn.gemspec: depend on test-unit 3.0 remove RubyForge and Freecode references remove mongrel.rubyforge.org references examples: add run_once to before_fork hook example t/t0002-parser-error.sh: relax test for rack 1.6.0 switch docs + website to olddoc README: clarify/reduce references to unicorn_rails gemspec: fixup olddoc migration GNUmakefile: fix clean gem build + reduce build cruft doc: update support status for Ruby versions fix uninstalled testing and reduce require paths test_socket_helper: do not depend on SO_REUSEPORT ISSUES: add section for bugs in other projects explain 11 byte magic number for self-pipe Links: mark Rainbows! as historical, reference yahns doc: document UNICORN_FD in manpage tee_input: support for Rack::TempfileReaper middleware support TempfileReaper in deployment and development envs --- GIT-VERSION-GEN | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index ad3e0f8..0030ca4 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -DEF_VER = "v4.8.3" +DEF_VER = "v4.9.0" CONSTANT = "Unicorn::Const::UNICORN_VERSION" RVF = "lib/unicorn/version.rb" GVF = "GIT-VERSION-FILE" -- cgit v1.2.3-24-ge0c7