unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 0/5..5/5] more tests to Perl 5 for stability
@ 2024-05-06 20:10  6% Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2024-05-06 20:10 UTC (permalink / raw)
  To: unicorn-public

[-- Attachment #1: Type: text/plain, Size: 1394 bytes --]

It's far easier to maintain tests in a language that's been
"dead" for 20 years :P  This is another step towards freeing us
up to make more internal changes, too; as well as avoiding slow
Ruby startup overhead.  (Perl 5 startup is slow, too, but not
nearly as slow as Ruby)

Eric Wong (5):
  GNUmakefile: build writes shebang-modified files
  t/*.t: use write_file helper function
  tests: port broken-app test to Perl 5
  tests: move test/unit/test_request.rb to Perl 5
  port test/unit/test_ccc.rb to Perl 5

 GNUmakefile                 |   1 +
 t/active-unix-socket.t      |  13 +--
 t/broken-app.ru             |  13 ---
 t/client_body_buffer_size.t |   5 +-
 t/heartbeat-timeout.t       |   4 +-
 t/integration.ru            |  11 +++
 t/integration.t             | 128 +++++++++++++++++++++++++--
 t/lib.perl                  |   2 +-
 t/reload-bad-config.t       |  17 ++--
 t/reopen-logs.t             |   5 +-
 t/t0009-broken-app.sh       |  56 ------------
 t/winch_ttin.t              |   7 +-
 t/working_directory.t       |  16 +---
 test/unit/test_ccc.rb       |  92 -------------------
 test/unit/test_request.rb   | 170 ------------------------------------
 15 files changed, 153 insertions(+), 387 deletions(-)
 delete mode 100644 t/broken-app.ru
 delete mode 100755 t/t0009-broken-app.sh
 delete mode 100644 test/unit/test_ccc.rb
 delete mode 100644 test/unit/test_request.rb

[-- Attachment #2: 0001-GNUmakefile-build-writes-shebang-modified-files.patch --]
[-- Type: text/x-diff, Size: 772 bytes --]

From 5e9dbfd071aa939677aaf3d269115fb88e606311 Mon Sep 17 00:00:00 2001
From: Eric Wong <bofh@yhbt.net>
Date: Sun, 5 May 2024 22:15:35 +0000
Subject: [PATCH 1/5] GNUmakefile: build writes shebang-modified files

This makes it easier to run individual integration tests via
prove(1) rather than all at once with gmake(1).
---
 GNUmakefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/GNUmakefile b/GNUmakefile
index 70e7e10..227842c 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -78,6 +78,7 @@ man1_bins := $(addsuffix .1, $(base_bins))
 man1_paths := $(addprefix man/man1/, $(man1_bins))
 tmp_bins = $(addprefix $(tmp_bin)/, unicorn unicorn_rails)
 pid := $(shell echo $$PPID)
+build: $(tmp_bins)
 
 $(tmp_bin)/%: bin/% | $(tmp_bin)
 	$(INSTALL) -m 755 $< $@.$(pid)

[-- Attachment #3: 0002-t-.t-use-write_file-helper-function.patch --]
[-- Type: text/x-diff, Size: 8088 bytes --]

From 9cbf87fd110acc36c3b6eec14231aed3be78ecf4 Mon Sep 17 00:00:00 2001
From: Eric Wong <bofh@yhbt.net>
Date: Sun, 5 May 2024 22:15:36 +0000
Subject: [PATCH 2/5] t/*.t: use write_file helper function

This shortens the tests a bit for readability.
---
 t/active-unix-socket.t      | 13 +++----------
 t/client_body_buffer_size.t |  5 ++---
 t/heartbeat-timeout.t       |  4 +---
 t/integration.t             |  5 ++---
 t/reload-bad-config.t       | 17 ++++++-----------
 t/reopen-logs.t             |  5 +----
 t/winch_ttin.t              |  7 ++-----
 t/working_directory.t       | 16 ++++------------
 8 files changed, 21 insertions(+), 51 deletions(-)

diff --git a/t/active-unix-socket.t b/t/active-unix-socket.t
index ff731b5..ab3c973 100644
--- a/t/active-unix-socket.t
+++ b/t/active-unix-socket.t
@@ -11,29 +11,22 @@ END { kill('TERM', values(%to_kill)) if keys %to_kill }
 my $u1 = "$tmpdir/u1.sock";
 my $u2 = "$tmpdir/u2.sock";
 {
-	open my $fh, '>', "$tmpdir/u1.conf.rb";
-	print $fh <<EOM;
+	write_file '>', "$tmpdir/u1.conf.rb", <<EOM;
 pid "$tmpdir/u.pid"
 listen "$u1"
 stderr_path "$err_log"
 EOM
-	close $fh;
-
-	open $fh, '>', "$tmpdir/u2.conf.rb";
-	print $fh <<EOM;
+	write_file '>', "$tmpdir/u2.conf.rb", <<EOM;
 pid "$tmpdir/u.pid"
 listen "$u2"
 stderr_path "$tmpdir/err2.log"
 EOM
-	close $fh;
 
-	open $fh, '>', "$tmpdir/u3.conf.rb";
-	print $fh <<EOM;
+	write_file '>', "$tmpdir/u3.conf.rb", <<EOM;
 pid "$tmpdir/u3.pid"
 listen "$u1"
 stderr_path "$tmpdir/err3.log"
 EOM
-	close $fh;
 }
 
 my @uarg = qw(-D -E none t/integration.ru);
diff --git a/t/client_body_buffer_size.t b/t/client_body_buffer_size.t
index d479901..c8e871d 100644
--- a/t/client_body_buffer_size.t
+++ b/t/client_body_buffer_size.t
@@ -4,11 +4,10 @@
 
 use v5.14; BEGIN { require './t/lib.perl' };
 use autodie;
-open my $conf_fh, '>', $u_conf;
-$conf_fh->autoflush(1);
-print $conf_fh <<EOM;
+my $conf_fh = write_file '>', $u_conf, <<EOM;
 client_body_buffer_size 0
 EOM
+$conf_fh->autoflush(1);
 my $srv = tcp_server();
 my $host_port = tcp_host_port($srv);
 my @uarg = (qw(-E none t/client_body_buffer_size.ru -c), $u_conf);
diff --git a/t/heartbeat-timeout.t b/t/heartbeat-timeout.t
index 694867a..0ae0764 100644
--- a/t/heartbeat-timeout.t
+++ b/t/heartbeat-timeout.t
@@ -6,14 +6,12 @@ use autodie;
 use Time::HiRes qw(clock_gettime CLOCK_MONOTONIC);
 mkdir "$tmpdir/alt";
 my $srv = tcp_server();
-open my $fh, '>', $u_conf;
-print $fh <<EOM;
+write_file '>', $u_conf, <<EOM;
 pid "$tmpdir/pid"
 preload_app true
 stderr_path "$err_log"
 timeout 3 # WORST FEATURE EVER
 EOM
-close $fh;
 
 my $ar = unicorn(qw(-E none t/heartbeat-timeout.ru -c), $u_conf, { 3 => $srv });
 
diff --git a/t/integration.t b/t/integration.t
index d17ace0..93480fa 100644
--- a/t/integration.t
+++ b/t/integration.t
@@ -18,13 +18,12 @@ if ('ensure Perl does not set SO_KEEPALIVE by default') {
 	$val = getsockopt($srv, SOL_SOCKET, SO_KEEPALIVE);
 }
 my $t0 = time;
-open my $conf_fh, '>', $u_conf;
-$conf_fh->autoflush(1);
 my $u1 = "$tmpdir/u1";
-print $conf_fh <<EOM;
+my $conf_fh = write_file '>', $u_conf, <<EOM;
 early_hints true
 listen "$u1"
 EOM
+$conf_fh->autoflush(1);
 my $ar = unicorn(qw(-E none t/integration.ru -c), $u_conf, { 3 => $srv });
 my $curl = which('curl');
 local $ENV{NO_PROXY} = '*'; # for curl
diff --git a/t/reload-bad-config.t b/t/reload-bad-config.t
index c023b88..4c17968 100644
--- a/t/reload-bad-config.t
+++ b/t/reload-bad-config.t
@@ -6,32 +6,27 @@ use autodie;
 my $srv = tcp_server();
 my $host_port = tcp_host_port($srv);
 my $ru = "$tmpdir/config.ru";
-my $u_conf = "$tmpdir/u.conf.rb";
 
-open my $fh, '>', $ru;
-print $fh <<'EOM';
+write_file '>', $ru, <<'EOM';
 use Rack::ContentLength
 use Rack::ContentType, 'text/plain'
 config = ru = "hello world\n" # check for config variable conflicts, too
 run lambda { |env| [ 200, {}, [ ru.to_s ] ] }
 EOM
-close $fh;
 
-open $fh, '>', $u_conf;
-print $fh <<EOM;
+write_file '>', $u_conf, <<EOM;
 preload_app true
 stderr_path "$err_log"
 EOM
-close $fh;
 
 my $ar = unicorn(qw(-E none -c), $u_conf, $ru, { 3 => $srv });
 my ($status, $hdr, $bdy) = do_req($srv, 'GET / HTTP/1.0');
 like($status, qr!\AHTTP/1\.[01] 200\b!, 'status line valid at start');
 is($bdy, "hello world\n", 'body matches expected');
 
-open $fh, '>>', $ru;
-say $fh '....this better be a syntax error in any version of ruby...';
-close $fh;
+write_file '>>', $ru, <<'EOM';
+....this better be a syntax error in any version of ruby...
+EOM
 
 $ar->do_kill('HUP'); # reload
 my @l;
@@ -42,7 +37,7 @@ for (1..1000) {
 }
 diag slurp($err_log) if $ENV{V};
 ok(grep(/error reloading/, @l), 'got error reloading');
-open $fh, '>', $err_log;
+open my $fh, '>', $err_log; # truncate
 close $fh;
 
 ($status, $hdr, $bdy) = do_req($srv, 'GET / HTTP/1.0');
diff --git a/t/reopen-logs.t b/t/reopen-logs.t
index 76a4dbd..14bc6ef 100644
--- a/t/reopen-logs.t
+++ b/t/reopen-logs.t
@@ -4,14 +4,11 @@
 use v5.14; BEGIN { require './t/lib.perl' };
 use autodie;
 my $srv = tcp_server();
-my $u_conf = "$tmpdir/u.conf.rb";
 my $out_log = "$tmpdir/out.log";
-open my $fh, '>', $u_conf;
-print $fh <<EOM;
+write_file '>', $u_conf, <<EOM;
 stderr_path "$err_log"
 stdout_path "$out_log"
 EOM
-close $fh;
 
 my $auto_reap = unicorn('-c', $u_conf, 't/reopen-logs.ru', { 3 => $srv } );
 my ($status, $hdr, $bdy) = do_req($srv, 'GET / HTTP/1.0');
diff --git a/t/winch_ttin.t b/t/winch_ttin.t
index c507959..3a3d430 100644
--- a/t/winch_ttin.t
+++ b/t/winch_ttin.t
@@ -4,13 +4,11 @@
 use v5.14; BEGIN { require './t/lib.perl' };
 use autodie;
 use POSIX qw(mkfifo);
-my $u_conf = "$tmpdir/u.conf.rb";
 my $u_sock = "$tmpdir/u.sock";
 my $fifo = "$tmpdir/fifo";
 mkfifo($fifo, 0666) or die "mkfifo($fifo): $!";
 
-open my $fh, '>', $u_conf;
-print $fh <<EOM;
+write_file '>', $u_conf, <<EOM;
 pid "$tmpdir/pid"
 listen "$u_sock"
 stderr_path "$err_log"
@@ -19,11 +17,10 @@ after_fork do |server, worker|
   File.open("$fifo", "wb") { |fp| fp.syswrite worker.nr.to_s }
 end
 EOM
-close $fh;
 
 unicorn('-D', '-c', $u_conf, 't/integration.ru')->join;
 is($?, 0, 'daemonized properly');
-open $fh, '<', "$tmpdir/pid";
+open my $fh, '<', "$tmpdir/pid";
 chomp(my $pid = <$fh>);
 ok(kill(0, $pid), 'daemonized PID works');
 my $quit = sub { kill('QUIT', $pid) if $pid; $pid = undef };
diff --git a/t/working_directory.t b/t/working_directory.t
index f9254eb..f1c0a35 100644
--- a/t/working_directory.t
+++ b/t/working_directory.t
@@ -5,15 +5,13 @@ use v5.14; BEGIN { require './t/lib.perl' };
 use autodie;
 mkdir "$tmpdir/alt";
 my $ru = "$tmpdir/alt/config.ru";
-open my $fh, '>', $u_conf;
-print $fh <<EOM;
+write_file '>', $u_conf, <<EOM;
 pid "$pid_file"
 preload_app true
 stderr_path "$err_log"
 working_directory "$tmpdir/alt" # the whole point of this test
 before_fork { |_,_| \$master_ppid = Process.ppid }
 EOM
-close $fh;
 
 my $common_ru = <<'EOM';
 use Rack::ContentLength
@@ -21,12 +19,10 @@ use Rack::ContentType, 'text/plain'
 run lambda { |env| [ 200, {}, [ "#{$master_ppid}\n" ] ] }
 EOM
 
-open $fh, '>', $ru;
-print $fh <<EOM;
+write_file '>', $ru, <<EOM;
 #\\--daemonize --listen $u_sock
 $common_ru
 EOM
-close $fh;
 
 unicorn('-c', $u_conf)->join; # will daemonize
 chomp($daemon_pid = slurp($pid_file));
@@ -39,9 +35,7 @@ check_stderr;
 
 if ('test without CLI switches in config.ru') {
 	truncate $err_log, 0;
-	open $fh, '>', $ru;
-	print $fh $common_ru;
-	close $fh;
+	write_file '>', $ru, $common_ru;
 
 	unicorn('-D', '-l', $u_sock, '-c', $u_conf)->join; # will daemonize
 	chomp($daemon_pid = slurp($pid_file));
@@ -68,8 +62,7 @@ if ('ensures broken working_directory (missing config.ru) is OK') {
 if ('fooapp.rb (not config.ru) works with working_directory') {
 	truncate $err_log, 0;
 	my $fooapp = "$tmpdir/alt/fooapp.rb";
-	open $fh, '>', $fooapp;
-	print $fh <<EOM;
+	write_file '>', $fooapp, <<EOM;
 class Fooapp
   def self.call(env)
     b = "dir=#{Dir.pwd}"
@@ -78,7 +71,6 @@ class Fooapp
   end
 end
 EOM
-	close $fh;
 	my $srv = tcp_server;
 	my $auto_reap = unicorn(qw(-c), $u_conf, qw(-I. fooapp.rb),
 				{ -C => '/', 3 => $srv });

[-- Attachment #4: 0003-tests-port-broken-app-test-to-Perl-5.patch --]
[-- Type: text/x-diff, Size: 4208 bytes --]

From e61a1152a613032927613b805a46c4d831bad00c Mon Sep 17 00:00:00 2001
From: Eric Wong <bofh@yhbt.net>
Date: Sun, 5 May 2024 22:15:37 +0000
Subject: [PATCH 3/5] tests: port broken-app test to Perl 5

Save some inodes and startup time by folding it into the
integration test.
---
 t/broken-app.ru       | 13 ----------
 t/integration.ru      |  1 +
 t/integration.t       | 18 +++++++++++++-
 t/lib.perl            |  2 +-
 t/t0009-broken-app.sh | 56 -------------------------------------------
 5 files changed, 19 insertions(+), 71 deletions(-)
 delete mode 100644 t/broken-app.ru
 delete mode 100755 t/t0009-broken-app.sh

diff --git a/t/broken-app.ru b/t/broken-app.ru
deleted file mode 100644
index 5966bff..0000000
--- a/t/broken-app.ru
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: false
-# we do not want Rack::Lint or anything to protect us
-use Rack::ContentLength
-use Rack::ContentType, "text/plain"
-map "/" do
-  run lambda { |env| [ 200, {}, [ "OK\n" ] ] }
-end
-map "/raise" do
-  run lambda { |env| raise "BAD" }
-end
-map "/nil" do
-  run lambda { |env| nil }
-end
diff --git a/t/integration.ru b/t/integration.ru
index 6df481c..3a0d99c 100644
--- a/t/integration.ru
+++ b/t/integration.ru
@@ -100,6 +100,7 @@ def rack_input_tests(env)
     when '/early_hints_rack2'; early_hints(env, "r\n2")
     when '/early_hints_rack3'; early_hints(env, %w(r 3))
     when '/broken_app'; raise RuntimeError, 'hello'
+    when '/nil'; nil
     else '/'; [ 200, {}, [ env_dump(env) ] ]
     end # case PATH_INFO (GET)
   when 'POST'
diff --git a/t/integration.t b/t/integration.t
index 93480fa..c9a7877 100644
--- a/t/integration.t
+++ b/t/integration.t
@@ -122,7 +122,23 @@ check_stderr;
 ($status, $hdr, $bdy) = do_req($srv, 'GET /broken_app HTTP/1.0');
 like($status, qr!\AHTTP/1\.[0-1] 500\b!, 'got 500 error on broken endpoint');
 is($bdy, undef, 'no response body after exception');
-truncate($errfh, 0);
+seek $errfh, 0, SEEK_SET;
+{
+	my $nxt;
+	while (!defined($nxt) && defined($_ = <$errfh>)) {
+		$nxt = <$errfh> if /app error/;
+	}
+	ok $nxt, 'got app error' and
+		like $nxt, qr/\bintegration\.ru/, 'got backtrace';
+}
+seek $errfh, 0, SEEK_SET;
+truncate $errfh, 0;
+
+($status, $hdr, $bdy) = do_req($srv, 'GET /nil HTTP/1.0');
+like($status, qr!\AHTTP/1\.[0-1] 500\b!, 'got 500 error on nil endpoint');
+like slurp($err_log), qr/app error/, 'exception logged for nil';
+seek $errfh, 0, SEEK_SET;
+truncate $errfh, 0;
 
 my $ck_early_hints = sub {
 	my ($note) = @_;
diff --git a/t/lib.perl b/t/lib.perl
index 8c842b1..382f08c 100644
--- a/t/lib.perl
+++ b/t/lib.perl
@@ -30,7 +30,7 @@ $pid_file = "$tmpdir/pid";
 $fifo = "$tmpdir/fifo";
 $u_sock = "$tmpdir/u.sock";
 $u_conf = "$tmpdir/u.conf.rb";
-open($errfh, '>>', $err_log);
+open($errfh, '+>>', $err_log);
 
 if (my $t = $ENV{TAIL}) {
 	my @tail = $t =~ /tail/ ? split(/\s+/, $t) : (qw(tail -F));
diff --git a/t/t0009-broken-app.sh b/t/t0009-broken-app.sh
deleted file mode 100755
index 895b178..0000000
--- a/t/t0009-broken-app.sh
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/bin/sh
-. ./test-lib.sh
-
-t_plan 9 "graceful handling of broken apps"
-
-t_begin "setup and start" && {
-	unicorn_setup
-	unicorn -E none -D broken-app.ru -c $unicorn_config
-	unicorn_wait_start
-}
-
-t_begin "normal response is alright" && {
-	test xOK = x"$(curl -sSf http://$listen/)"
-}
-
-t_begin "app raised exception" && {
-	curl -sSf http://$listen/raise 2> $tmp || :
-	grep -F 500 $tmp
-	> $tmp
-}
-
-t_begin "app exception logged and backtrace not swallowed" && {
-	grep -F 'app error' $r_err
-	grep -A1 -F 'app error' $r_err | tail -1 | grep broken-app.ru:
-	dbgcat r_err
-	> $r_err
-}
-
-t_begin "trigger bad response" && {
-	curl -sSf http://$listen/nil 2> $tmp || :
-	grep -F 500 $tmp
-	> $tmp
-}
-
-t_begin "app exception logged" && {
-	grep -F 'app error' $r_err
-	> $r_err
-}
-
-t_begin "normal responses alright afterwards" && {
-	> $tmp
-	curl -sSf http://$listen/ >> $tmp &
-	curl -sSf http://$listen/ >> $tmp &
-	curl -sSf http://$listen/ >> $tmp &
-	curl -sSf http://$listen/ >> $tmp &
-	wait
-	test xOK = x$(sort < $tmp | uniq)
-}
-
-t_begin "teardown" && {
-	kill $unicorn_pid
-}
-
-t_begin "check stderr" && check_stderr
-
-t_done

[-- Attachment #5: 0004-tests-move-test-unit-test_request.rb-to-Perl-5.patch --]
[-- Type: text/x-diff, Size: 11298 bytes --]

From 01224642a20e91de5ea18c6f20856142158068a8 Mon Sep 17 00:00:00 2001
From: Eric Wong <bofh@yhbt.net>
Date: Sun, 5 May 2024 22:15:38 +0000
Subject: [PATCH 4/5] tests: move test/unit/test_request.rb to Perl 5

Another step towards having more freedom to change our internals
and having a more stable language for tests to reduce
maintenance overhead by avoiding Ruby incompatibilities.
---
 t/integration.ru          |   6 ++
 t/integration.t           |  72 +++++++++++++++-
 test/unit/test_request.rb | 170 --------------------------------------
 3 files changed, 75 insertions(+), 173 deletions(-)
 delete mode 100644 test/unit/test_request.rb

diff --git a/t/integration.ru b/t/integration.ru
index 3a0d99c..a6b022a 100644
--- a/t/integration.ru
+++ b/t/integration.ru
@@ -47,6 +47,7 @@ def env_dump(env)
     else
       case k
       when 'rack.version', 'rack.after_reply'; h[k] = v
+      when 'rack.input'; h[k] = v.class.to_s
       end
     end
   end
@@ -112,6 +113,11 @@ def rack_input_tests(env)
   when 'PUT'
     case env['PATH_INFO']
     when %r{\A/rack_input}; rack_input_tests(env)
+    when '/env_dump'; [ 200, {}, [ env_dump(env) ] ]
+    end
+  when 'OPTIONS'
+    case env['REQUEST_URI']
+    when '*'; [ 200, {}, [ env_dump(env) ] ]
     end
   end # case REQUEST_METHOD
 end) # run
diff --git a/t/integration.t b/t/integration.t
index c9a7877..3b1d6df 100644
--- a/t/integration.t
+++ b/t/integration.t
@@ -103,14 +103,75 @@ is_deeply([ grep(/^x-r3: /, @$hdr) ],
 
 SKIP: {
 	eval { require JSON::PP } or skip "JSON::PP missing: $@", 1;
-	($status, $hdr, my $json) = do_req $srv, 'GET /env_dump';
+	my $get_json = sub {
+		my (@req) = @_;
+		my @r = do_req $srv, @req;
+		my $env = eval { JSON::PP->new->decode($r[2]) };
+		diag "$@ (r[2]=$r[2])" if $@;
+		is ref($env), 'HASH', "@req response body is JSON";
+		(@r, $env)
+	};
+	($status, $hdr, my $json, my $env) = $get_json->('GET /env_dump');
 	is($status, undef, 'no status for HTTP/0.9');
 	is($hdr, undef, 'no header for HTTP/0.9');
 	unlike($json, qr/^Connection: /smi, 'no connection header for 0.9');
 	unlike($json, qr!\AHTTP/!s, 'no HTTP/1.x prefix for 0.9');
-	my $env = JSON::PP->new->decode($json);
-	is(ref($env), 'HASH', 'JSON decoded body to hashref');
 	is($env->{SERVER_PROTOCOL}, 'HTTP/0.9', 'SERVER_PROTOCOL is 0.9');
+	is $env->{'rack.url_scheme'}, 'http', 'rack.url_scheme default';
+	is $env->{'rack.input'}, 'StringIO', 'StringIO for no content';
+
+	my $req = 'OPTIONS *';
+	($status, $hdr, $json, $env) = $get_json->("$req HTTP/1.0");
+	is $env->{REQUEST_PATH}, '', "$req => REQUEST_PATH";
+	is $env->{PATH_INFO}, '', "$req => PATH_INFO";
+	is $env->{REQUEST_URI}, '*', "$req => REQUEST_URI";
+
+	$req = 'GET http://e:3/env_dump?y=z';
+	($status, $hdr, $json, $env) = $get_json->("$req HTTP/1.0");
+	is $env->{REQUEST_PATH}, '/env_dump', "$req => REQUEST_PATH";
+	is $env->{PATH_INFO}, '/env_dump', "$req => PATH_INFO";
+	is $env->{QUERY_STRING}, 'y=z', "$req => QUERY_STRING";
+
+	$req = 'GET http://e:3/env_dump#frag';
+	($status, $hdr, $json, $env) = $get_json->("$req HTTP/1.0");
+	is $env->{REQUEST_PATH}, '/env_dump', "$req => REQUEST_PATH";
+	is $env->{PATH_INFO}, '/env_dump', "$req => PATH_INFO";
+	is $env->{QUERY_STRING}, '', "$req => QUERY_STRING";
+	is $env->{FRAGMENT}, 'frag', "$req => FRAGMENT";
+
+	$req = 'GET http://e:3/env_dump?a=b#frag';
+	($status, $hdr, $json, $env) = $get_json->("$req HTTP/1.0");
+	is $env->{REQUEST_PATH}, '/env_dump', "$req => REQUEST_PATH";
+	is $env->{PATH_INFO}, '/env_dump', "$req => PATH_INFO";
+	is $env->{QUERY_STRING}, 'a=b', "$req => QUERY_STRING";
+	is $env->{FRAGMENT}, 'frag', "$req => FRAGMENT";
+
+	for my $proto (qw(https http)) {
+		$req = "X-Forwarded-Proto: $proto";
+		($status, $hdr, $json, $env) = $get_json->(
+						"GET /env_dump HTTP/1.0\r\n".
+						"X-Forwarded-Proto: $proto");
+		is $env->{REQUEST_PATH}, '/env_dump', "$req => REQUEST_PATH";
+		is $env->{PATH_INFO}, '/env_dump', "$req => PATH_INFO";
+		is $env->{'rack.url_scheme'}, $proto, "$req => rack.url_scheme";
+	}
+
+	$req = 'X-Forwarded-Proto: ftp'; # invalid proto
+	($status, $hdr, $json, $env) = $get_json->(
+					"GET /env_dump HTTP/1.0\r\n".
+					"X-Forwarded-Proto: ftp");
+	is $env->{REQUEST_PATH}, '/env_dump', "$req => REQUEST_PATH";
+	is $env->{PATH_INFO}, '/env_dump', "$req => PATH_INFO";
+	is $env->{'rack.url_scheme'}, 'http', "$req => rack.url_scheme";
+
+	($status, $hdr, $json, $env) = $get_json->("PUT /env_dump HTTP/1.0\r\n".
+						'Content-Length: 0');
+	is $env->{'rack.input'}, 'StringIO', 'content-length: 0 uses StringIO';
+
+	($status, $hdr, $json, $env) = $get_json->("PUT /env_dump HTTP/1.0\r\n".
+						'Content-Length: 1');
+	is $env->{'rack.input'}, 'Unicorn::TeeInput',
+		'content-length: 1 uses TeeInput';
 }
 
 # cf. <CAO47=rJa=zRcLn_Xm4v2cHPr6c0UswaFC_omYFEH+baSxHOWKQ@mail.gmail.com>
@@ -179,6 +240,11 @@ if ('bad requests') {
 	($status, $hdr) = do_req $srv, 'GET /env_dump HTTP/1/1';
 	like($status, qr!\AHTTP/1\.[01] 400 \b!, 'got 400 on bad request');
 
+	for my $abs_uri (qw(ssh+http://e/ ftp://e/x http+ssh://e/x)) {
+		($status, $hdr) = do_req $srv, "GET $abs_uri HTTP/1.0";
+		like $status, qr!\AHTTP/1\.[01] 400 \b!, "400 on $abs_uri";
+	}
+
 	$c = tcp_start($srv);
 	print $c 'GET /';
 	my $buf = join('', (0..9), 'ab');
diff --git a/test/unit/test_request.rb b/test/unit/test_request.rb
deleted file mode 100644
index 9d1b350..0000000
--- a/test/unit/test_request.rb
+++ /dev/null
@@ -1,170 +0,0 @@
-# -*- encoding: binary -*-
-# frozen_string_literal: false
-
-# Copyright (c) 2009 Eric Wong
-# 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'
-
-include Unicorn
-
-class RequestTest < Test::Unit::TestCase
-
-  MockRequest = Class.new(StringIO)
-
-  AI = Addrinfo.new(Socket.sockaddr_un('/unicorn/sucks'))
-
-  def setup
-    @request = HttpRequest.new
-    @app = lambda do |env|
-      [ 200, { 'content-length' => '0', 'content-type' => 'text/plain' }, [] ]
-    end
-    @lint = Rack::Lint.new(@app)
-  end
-
-  def test_options
-    client = MockRequest.new("OPTIONS * HTTP/1.1\r\n" \
-                             "Host: foo\r\n\r\n")
-    env = @request.read_headers(client, AI)
-    assert_equal '', env['REQUEST_PATH']
-    assert_equal '', env['PATH_INFO']
-    assert_equal '*', env['REQUEST_URI']
-    assert_kind_of Array, @lint.call(env)
-  end
-
-  def test_absolute_uri_with_query
-    client = MockRequest.new("GET http://e:3/x?y=z HTTP/1.1\r\n" \
-                             "Host: foo\r\n\r\n")
-    env = @request.read_headers(client, AI)
-    assert_equal '/x', env['REQUEST_PATH']
-    assert_equal '/x', env['PATH_INFO']
-    assert_equal 'y=z', env['QUERY_STRING']
-    assert_kind_of Array, @lint.call(env)
-  end
-
-  def test_absolute_uri_with_fragment
-    client = MockRequest.new("GET http://e:3/x#frag HTTP/1.1\r\n" \
-                             "Host: foo\r\n\r\n")
-    env = @request.read_headers(client, AI)
-    assert_equal '/x', env['REQUEST_PATH']
-    assert_equal '/x', env['PATH_INFO']
-    assert_equal '', env['QUERY_STRING']
-    assert_equal 'frag', env['FRAGMENT']
-    assert_kind_of Array, @lint.call(env)
-  end
-
-  def test_absolute_uri_with_query_and_fragment
-    client = MockRequest.new("GET http://e:3/x?a=b#frag HTTP/1.1\r\n" \
-                             "Host: foo\r\n\r\n")
-    env = @request.read_headers(client, AI)
-    assert_equal '/x', env['REQUEST_PATH']
-    assert_equal '/x', env['PATH_INFO']
-    assert_equal 'a=b', env['QUERY_STRING']
-    assert_equal 'frag', env['FRAGMENT']
-    assert_kind_of Array, @lint.call(env)
-  end
-
-  def test_absolute_uri_unsupported_schemes
-    %w(ssh+http://e/ ftp://e/x http+ssh://e/x).each do |abs_uri|
-      client = MockRequest.new("GET #{abs_uri} HTTP/1.1\r\n" \
-                               "Host: foo\r\n\r\n")
-      assert_raises(HttpParserError) { @request.read_headers(client, AI) }
-    end
-  end
-
-  def test_x_forwarded_proto_https
-    client = MockRequest.new("GET / HTTP/1.1\r\n" \
-                             "X-Forwarded-Proto: https\r\n" \
-                             "Host: foo\r\n\r\n")
-    env = @request.read_headers(client, AI)
-    assert_equal "https", env['rack.url_scheme']
-    assert_kind_of Array, @lint.call(env)
-  end
-
-  def test_x_forwarded_proto_http
-    client = MockRequest.new("GET / HTTP/1.1\r\n" \
-                             "X-Forwarded-Proto: http\r\n" \
-                             "Host: foo\r\n\r\n")
-    env = @request.read_headers(client, AI)
-    assert_equal "http", env['rack.url_scheme']
-    assert_kind_of Array, @lint.call(env)
-  end
-
-  def test_x_forwarded_proto_invalid
-    client = MockRequest.new("GET / HTTP/1.1\r\n" \
-                             "X-Forwarded-Proto: ftp\r\n" \
-                             "Host: foo\r\n\r\n")
-    env = @request.read_headers(client, AI)
-    assert_equal "http", env['rack.url_scheme']
-    assert_kind_of Array, @lint.call(env)
-  end
-
-  def test_rack_lint_get
-    client = MockRequest.new("GET / HTTP/1.1\r\nHost: foo\r\n\r\n")
-    env = @request.read_headers(client, AI)
-    assert_equal "http", env['rack.url_scheme']
-    assert_equal '127.0.0.1', env['REMOTE_ADDR']
-    assert_kind_of Array, @lint.call(env)
-  end
-
-  def test_no_content_stringio
-    client = MockRequest.new("GET / HTTP/1.1\r\nHost: foo\r\n\r\n")
-    env = @request.read_headers(client, AI)
-    assert_equal StringIO, env['rack.input'].class
-  end
-
-  def test_zero_content_stringio
-    client = MockRequest.new("PUT / HTTP/1.1\r\n" \
-                             "Content-Length: 0\r\n" \
-                             "Host: foo\r\n\r\n")
-    env = @request.read_headers(client, AI)
-    assert_equal StringIO, env['rack.input'].class
-  end
-
-  def test_real_content_not_stringio
-    client = MockRequest.new("PUT / HTTP/1.1\r\n" \
-                             "Content-Length: 1\r\n" \
-                             "Host: foo\r\n\r\n")
-    env = @request.read_headers(client, AI)
-    assert_equal Unicorn::TeeInput, env['rack.input'].class
-  end
-
-  def test_rack_lint_put
-    client = MockRequest.new(
-      "PUT / HTTP/1.1\r\n" \
-      "Host: foo\r\n" \
-      "Content-Length: 5\r\n" \
-      "\r\n" \
-      "abcde")
-    env = @request.read_headers(client, AI)
-    assert ! env.include?(:http_body)
-    assert_kind_of Array, @lint.call(env)
-  end
-
-  def test_rack_lint_big_put
-    count = 100
-    bs = 0x10000
-    buf = (' ' * bs).freeze
-    length = bs * count
-    client = Tempfile.new('big_put')
-    client.syswrite(
-      "PUT / HTTP/1.1\r\n" \
-      "Host: foo\r\n" \
-      "Content-Length: #{length}\r\n" \
-      "\r\n")
-    count.times { assert_equal bs, client.syswrite(buf) }
-    assert_equal 0, client.sysseek(0)
-    env = @request.read_headers(client, AI)
-    assert ! env.include?(:http_body)
-    assert_equal length, env['rack.input'].size
-    count.times {
-      tmp = env['rack.input'].read(bs)
-      tmp << env['rack.input'].read(bs - tmp.size) if tmp.size != bs
-      assert_equal buf, tmp
-    }
-    assert_nil env['rack.input'].read(bs)
-    env['rack.input'].rewind
-    assert_kind_of Array, @lint.call(env)
-  end
-end

[-- Attachment #6: 0005-port-test-unit-test_ccc.rb-to-Perl-5.patch --]
[-- Type: text/x-diff, Size: 6013 bytes --]

From d6d127f50f9225bf51ef6ce0abce9bad87efaae3 Mon Sep 17 00:00:00 2001
From: Eric Wong <bofh@yhbt.net>
Date: Sun, 5 May 2024 22:15:39 +0000
Subject: [PATCH 5/5] port test/unit/test_ccc.rb to Perl 5

We'll fold this into integration.t to reduce startup time
penalties and get the benefit of a stable language to reduce
maintenance overhead.
---
 t/integration.ru      |  4 ++
 t/integration.t       | 33 ++++++++++++++++
 test/unit/test_ccc.rb | 92 -------------------------------------------
 3 files changed, 37 insertions(+), 92 deletions(-)
 delete mode 100644 test/unit/test_ccc.rb

diff --git a/t/integration.ru b/t/integration.ru
index a6b022a..aaed608 100644
--- a/t/integration.ru
+++ b/t/integration.ru
@@ -87,6 +87,7 @@ def rack_input_tests(env)
   [ 200, h, [ dig.hexdigest ] ]
 end
 
+$nr_aborts = 0
 run(lambda do |env|
   case env['REQUEST_METHOD']
   when 'GET'
@@ -101,7 +102,10 @@ def rack_input_tests(env)
     when '/early_hints_rack2'; early_hints(env, "r\n2")
     when '/early_hints_rack3'; early_hints(env, %w(r 3))
     when '/broken_app'; raise RuntimeError, 'hello'
+    when '/aborted'; $nr_aborts += 1; [ 200, {}, [] ]
+    when '/nr_aborts'; [ 200, { 'nr-aborts' => "#$nr_aborts" }, [] ]
     when '/nil'; nil
+    when '/read_fifo'; [ 200, {}, [ File.read(env['HTTP_READ_FIFO']) ] ]
     else '/'; [ 200, {}, [ env_dump(env) ] ]
     end # case PATH_INFO (GET)
   when 'POST'
diff --git a/t/integration.t b/t/integration.t
index 3b1d6df..2d448cd 100644
--- a/t/integration.t
+++ b/t/integration.t
@@ -405,6 +405,39 @@ EOM
 	my $wpid = readline($fifo_fh);
 	like($wpid, qr/\Apid=\d+\z/a , 'new worker ready');
 	$ck_early_hints->('ccc on');
+
+	$c = tcp_start $srv, 'GET /env_dump HTTP/1.0';
+	vec(my $rvec = '', fileno($c), 1) = 1;
+	select($rvec, undef, undef, 10) or BAIL_OUT 'timed out env_dump';
+	($status, $hdr) = slurp_hdr($c);
+	like $status, qr!\AHTTP/1\.[01] 200!, 'got part of first response';
+	ok $hdr, 'got all headers';
+
+	# start a slow TCP request
+	my $rfifo = "$tmpdir/rfifo";
+	mkfifo_die $rfifo;
+	$c = tcp_start $srv, "GET /read_fifo HTTP/1.0\r\nRead-FIFO: $rfifo";
+	tcp_start $srv, 'GET /aborted HTTP/1.0' for (1..100);
+	write_file '>', $rfifo, 'TFIN';
+	($status, $hdr) = slurp_hdr($c);
+	like $status, qr!\AHTTP/1\.[01] 200!, 'got part of first response';
+	$bdy = <$c>;
+	is $bdy, 'TFIN', 'got slow response from TCP socket';
+
+	# slow Unix socket request
+	$c = unix_start $u1, "GET /read_fifo HTTP/1.0\r\nRead-FIFO: $rfifo";
+	vec($rvec = '', fileno($c), 1) = 1;
+	select($rvec, undef, undef, 10) or BAIL_OUT 'timed out Unix CCC';
+	unix_start $u1, 'GET /aborted HTTP/1.0' for (1..100);
+	write_file '>', $rfifo, 'UFIN';
+	($status, $hdr) = slurp_hdr($c);
+	like $status, qr!\AHTTP/1\.[01] 200!, 'got part of first response';
+	$bdy = <$c>;
+	is $bdy, 'UFIN', 'got slow response from Unix socket';
+
+	($status, $hdr, $bdy) = do_req $srv, 'GET /nr_aborts HTTP/1.0';
+	like "@$hdr", qr/nr-aborts: 0\b/,
+		'aborted connections unseen by Rack app';
 }
 
 if ('max_header_len internal API') {
diff --git a/test/unit/test_ccc.rb b/test/unit/test_ccc.rb
deleted file mode 100644
index a0a2bff..0000000
--- a/test/unit/test_ccc.rb
+++ /dev/null
@@ -1,92 +0,0 @@
-# frozen_string_literal: false
-require 'socket'
-require 'unicorn'
-require 'io/wait'
-require 'tempfile'
-require 'test/unit'
-require './test/test_helper'
-
-class TestCccTCPI < Test::Unit::TestCase
-  def test_ccc_tcpi
-    start_pid = $$
-    host = '127.0.0.1'
-    srv = TCPServer.new(host, 0)
-    port = srv.addr[1]
-    err = Tempfile.new('unicorn_ccc')
-    rd, wr = IO.pipe
-    sleep_pipe = IO.pipe
-    pid = fork do
-      sleep_pipe[1].close
-      reqs = 0
-      rd.close
-      worker_pid = nil
-      app = lambda do |env|
-        worker_pid ||= begin
-          at_exit { wr.write(reqs.to_s) if worker_pid == $$ }
-          $$
-        end
-        reqs += 1
-
-        # will wake up when writer closes
-        sleep_pipe[0].read if env['PATH_INFO'] == '/sleep'
-
-        [ 200, {'content-length'=>'0', 'content-type'=>'text/plain'}, [] ]
-      end
-      ENV['UNICORN_FD'] = srv.fileno.to_s
-      opts = {
-        listeners: [ "#{host}:#{port}" ],
-        stderr_path: err.path,
-        check_client_connection: true,
-      }
-      uni = Unicorn::HttpServer.new(app, opts)
-      uni.start.join
-    end
-    wr.close
-
-    # make sure the server is running, at least
-    client = tcp_socket(host, port)
-    client.write("GET / HTTP/1.1\r\nHost: example.com\r\n\r\n")
-    assert client.wait(10), 'never got response from server'
-    res = client.read
-    assert_match %r{\AHTTP/1\.1 200}, res, 'got part of first response'
-    assert_match %r{\r\n\r\n\z}, res, 'got end of response, server is ready'
-    client.close
-
-    # start a slow request...
-    sleeper = tcp_socket(host, port)
-    sleeper.write("GET /sleep HTTP/1.1\r\nHost: example.com\r\n\r\n")
-
-    # and a bunch of aborted ones
-    nr = 100
-    nr.times do |i|
-      client = tcp_socket(host, port)
-      client.write("GET /collections/#{rand(10000)} HTTP/1.1\r\n" \
-                   "Host: example.com\r\n\r\n")
-      client.close
-    end
-    sleep_pipe[1].close # wake up the reader in the worker
-    res = sleeper.read
-    assert_match %r{\AHTTP/1\.1 200}, res, 'got part of first sleeper response'
-    assert_match %r{\r\n\r\n\z}, res, 'got end of sleeper response'
-    sleeper.close
-    kpid = pid
-    pid = nil
-    Process.kill(:QUIT, kpid)
-    _, status = Process.waitpid2(kpid)
-    assert status.success?
-    reqs = rd.read.to_i
-    warn "server got #{reqs} requests with #{nr} CCC aborted\n" if $DEBUG
-    assert_operator reqs, :<, nr
-    assert_operator reqs, :>=, 2, 'first 2 requests got through, at least'
-  ensure
-    return if start_pid != $$
-    srv.close if srv
-    if pid
-      Process.kill(:QUIT, pid)
-      _, status = Process.waitpid2(pid)
-      assert status.success?
-    end
-    err.close! if err
-    rd.close if rd
-  end
-end

^ permalink raw reply related	[relevance 6%]

* [PATCH 0/4] a small pile of patches
@ 2024-03-23 19:45  1% Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2024-03-23 19:45 UTC (permalink / raw)
  To: unicorn-public

[-- Attachment #1: Type: text/plain, Size: 4446 bytes --]

Some stuff to future-proof against future Ruby incompatibilities.
More coming....

I've also pushed out preliminary work (started in 2021) to the
`pico' branch to switch the HTTP parser from Ragel to
picohttpparser.  It will simplify the build + maintenance,
especially when distros carry different Ragel versions (or don't
package it all, as some hackers can't afford bandwidth and disk
for a C++ toolchain).

Other notes: New releases will probably be hosted on yhbt.net if
the Rubygems.org MFA threshold is reached.  Caring about the
identity of hackers is totally misguided when we already show
our code (and even document it!).  If you can't audit the code
yourself, get an actual professional to do it and don't bother
amateurs like me.

Eric Wong (4):
  t/integration: disable proxies when running curl(1)
  tests: port back-out-of-upgrade to Perl 5
  doc: various updates and disclaimers
  treewide: future-proof frozen_string_literal changes

 HACKING                             |  13 +++-
 README                              |   9 +++
 Rakefile                            |   1 +
 TODO                                |   4 +-
 bin/unicorn                         |   1 +
 bin/unicorn_rails                   |   1 +
 examples/big_app_gc.rb              |   1 +
 examples/echo.ru                    |   1 +
 examples/logger_mp_safe.rb          |   1 +
 examples/unicorn.conf.minimal.rb    |   1 +
 examples/unicorn.conf.rb            |   1 +
 ext/unicorn_http/extconf.rb         |   1 +
 lib/unicorn.rb                      |   1 +
 lib/unicorn/app/old_rails.rb        |   1 +
 lib/unicorn/app/old_rails/static.rb |   1 +
 lib/unicorn/cgi_wrapper.rb          |   1 +
 lib/unicorn/configurator.rb         |   1 +
 lib/unicorn/const.rb                |   1 +
 lib/unicorn/http_request.rb         |   1 +
 lib/unicorn/http_response.rb        |   1 +
 lib/unicorn/http_server.rb          |   1 +
 lib/unicorn/launcher.rb             |   1 +
 lib/unicorn/oob_gc.rb               |   1 +
 lib/unicorn/preread_input.rb        |   1 +
 lib/unicorn/select_waiter.rb        |   1 +
 lib/unicorn/socket_helper.rb        |   1 +
 lib/unicorn/stream_input.rb         |   1 +
 lib/unicorn/tee_input.rb            |   1 +
 lib/unicorn/tmpio.rb                |   1 +
 lib/unicorn/util.rb                 |   1 +
 lib/unicorn/worker.rb               |   1 +
 setup.rb                            |   1 +
 t/back-out-of-upgrade.t             |  44 +++++++++++
 t/broken-app.ru                     |   1 +
 t/client_body_buffer_size.ru        |   1 +
 t/detach.ru                         |   1 +
 t/env.ru                            |   1 +
 t/fails-rack-lint.ru                |   1 +
 t/heartbeat-timeout.ru              |   1 +
 t/integration.ru                    |   1 +
 t/integration.t                     |   1 +
 t/lib.perl                          |  67 ++++++++++++++---
 t/listener_names.ru                 |   1 +
 t/oob_gc.ru                         |   1 +
 t/oob_gc_path.ru                    |   1 +
 t/pid.ru                            |   1 +
 t/preread_input.ru                  |   1 +
 t/reopen-logs.ru                    |   1 +
 t/t0008-back_out_of_upgrade.sh      | 110 ----------------------------
 t/t0013.ru                          |   1 +
 t/t0014.ru                          |   1 +
 t/t0301.ru                          |   1 +
 test/aggregate.rb                   |   1 +
 test/benchmark/dd.ru                |   1 +
 test/benchmark/ddstream.ru          |   1 +
 test/benchmark/readinput.ru         |   1 +
 test/benchmark/stack.ru             |   1 +
 test/exec/test_exec.rb              |   1 +
 test/test_helper.rb                 |   1 +
 test/unit/test_ccc.rb               |   1 +
 test/unit/test_configurator.rb      |   1 +
 test/unit/test_droplet.rb           |   1 +
 test/unit/test_http_parser.rb       |   1 +
 test/unit/test_http_parser_ng.rb    |   1 +
 test/unit/test_request.rb           |   1 +
 test/unit/test_server.rb            |   1 +
 test/unit/test_signals.rb           |   1 +
 test/unit/test_socket_helper.rb     |   1 +
 test/unit/test_stream_input.rb      |   1 +
 test/unit/test_tee_input.rb         |   1 +
 test/unit/test_util.rb              |   1 +
 test/unit/test_waiter.rb            |   1 +
 unicorn.gemspec                     |   1 +
 73 files changed, 188 insertions(+), 126 deletions(-)
 create mode 100644 t/back-out-of-upgrade.t
 delete mode 100755 t/t0008-back_out_of_upgrade.sh

[-- Attachment #2: 0001-t-integration-disable-proxies-when-running-curl-1.patch --]
[-- Type: text/x-diff, Size: 737 bytes --]

From f3acce5dce62ac4b0288d3c0ddf0a6db2cbd9e7f Mon Sep 17 00:00:00 2001
From: Eric Wong <BOFH@YHBT.net>
Date: Tue, 9 Jan 2024 21:35:08 +0000
Subject: [PATCH 1/4] t/integration: disable proxies when running curl(1)

This was also done in t/test-lib.sh, but using '*' is more
encompassing.
---
 t/integration.t | 1 +
 1 file changed, 1 insertion(+)

diff --git a/t/integration.t b/t/integration.t
index 7310ff2..d17ace0 100644
--- a/t/integration.t
+++ b/t/integration.t
@@ -27,6 +27,7 @@ listen "$u1"
 EOM
 my $ar = unicorn(qw(-E none t/integration.ru -c), $u_conf, { 3 => $srv });
 my $curl = which('curl');
+local $ENV{NO_PROXY} = '*'; # for curl
 my $fifo = "$tmpdir/fifo";
 POSIX::mkfifo($fifo, 0600) or die "mkfifo: $!";
 my %PUT = (

[-- Attachment #3: 0002-tests-port-back-out-of-upgrade-to-Perl-5.patch --]
[-- Type: text/x-diff, Size: 8889 bytes --]

From 724fb631c76f09964ec289ee8e144886ba15d380 Mon Sep 17 00:00:00 2001
From: Eric Wong <BOFH@YHBT.net>
Date: Mon, 6 Nov 2023 05:45:29 +0000
Subject: [PATCH 2/4] tests: port back-out-of-upgrade to Perl 5

Another place where we can be faster without adding more
dependencies on Ruby maintaining stable behavior.
---
 t/back-out-of-upgrade.t        |  44 +++++++++++++
 t/lib.perl                     |  67 +++++++++++++++++---
 t/t0008-back_out_of_upgrade.sh | 110 ---------------------------------
 3 files changed, 102 insertions(+), 119 deletions(-)
 create mode 100644 t/back-out-of-upgrade.t
 delete mode 100755 t/t0008-back_out_of_upgrade.sh

diff --git a/t/back-out-of-upgrade.t b/t/back-out-of-upgrade.t
new file mode 100644
index 0000000..cf3b09f
--- /dev/null
+++ b/t/back-out-of-upgrade.t
@@ -0,0 +1,44 @@
+#!perl -w
+# Copyright (C) unicorn hackers <unicorn-public@yhbt.net>
+# License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
+# test backing out of USR2 upgrade
+use v5.14; BEGIN { require './t/lib.perl' };
+use autodie;
+my $srv = tcp_server();
+mkfifo_die $fifo;
+write_file '>', $u_conf, <<EOM;
+preload_app true
+stderr_path "$err_log"
+pid "$pid_file"
+after_fork { |s,w| File.open('$fifo', 'w') { |fp| fp.write "pid=#\$\$" } }
+EOM
+my $ar = unicorn(qw(-E none t/pid.ru -c), $u_conf, { 3 => $srv });
+
+like(my $wpid_orig_1 = slurp($fifo), qr/\Apid=\d+\z/a, 'got worker pid');
+
+ok $ar->do_kill('USR2'), 'USR2 to start upgrade';
+ok $ar->do_kill('WINCH'), 'drop old worker';
+
+like(my $wpid_new = slurp($fifo), qr/\Apid=\d+\z/a, 'got pid from new master');
+chomp(my $new_pid = slurp($pid_file));
+isnt $new_pid, $ar->{pid}, 'PID file changed';
+chomp(my $pid_oldbin = slurp("$pid_file.oldbin"));
+is $pid_oldbin, $ar->{pid}, '.oldbin PID valid';
+
+ok $ar->do_kill('HUP'), 'HUP old master';
+like(my $wpid_orig_2 = slurp($fifo), qr/\Apid=\d+\z/a, 'got worker new pid');
+ok kill('QUIT', $new_pid), 'abort old master';
+kill_until_dead $new_pid;
+
+my ($st, $hdr, $req_pid) = do_req $srv, 'GET /';
+chomp $req_pid;
+is $wpid_orig_2, "pid=$req_pid", 'new worker on old worker serves';
+
+ok !-f "$pid_file.oldbin", '.oldbin PID file gone';
+chomp(my $old_pid = slurp($pid_file));
+is $old_pid, $ar->{pid}, 'PID file restored';
+
+my @log = grep !/ERROR -- : reaped .*? exec\(\)-ed/, slurp($err_log);
+check_stderr @log;
+undef $tmpdir;
+done_testing;
diff --git a/t/lib.perl b/t/lib.perl
index 9254b23..b20a2c6 100644
--- a/t/lib.perl
+++ b/t/lib.perl
@@ -6,30 +6,58 @@ use v5.14;
 use parent qw(Exporter);
 use autodie;
 use Test::More;
+use Socket qw(SOMAXCONN);
 use Time::HiRes qw(sleep time);
 use IO::Socket::INET;
+use IO::Socket::UNIX;
+use Carp qw(croak);
 use POSIX qw(dup2 _exit setpgid :signal_h SEEK_SET F_SETFD);
 use File::Temp 0.19 (); # 0.19 for ->newdir
 our ($tmpdir, $errfh, $err_log, $u_sock, $u_conf, $daemon_pid,
-	$pid_file);
+	$pid_file, $wtest_sock, $fifo);
 our @EXPORT = qw(unicorn slurp tcp_server tcp_start unicorn
 	$tmpdir $errfh $err_log $u_sock $u_conf $daemon_pid $pid_file
+	$wtest_sock $fifo
 	SEEK_SET tcp_host_port which spawn check_stderr unix_start slurp_hdr
-	do_req stop_daemon sleep time);
+	do_req stop_daemon sleep time mkfifo_die kill_until_dead write_file);
 
 my ($base) = ($0 =~ m!\b([^/]+)\.[^\.]+\z!);
 $tmpdir = File::Temp->newdir("unicorn-$base-XXXX", TMPDIR => 1);
+
+$wtest_sock = "$tmpdir/wtest.sock";
 $err_log = "$tmpdir/err.log";
 $pid_file = "$tmpdir/pid";
+$fifo = "$tmpdir/fifo";
 $u_sock = "$tmpdir/u.sock";
 $u_conf = "$tmpdir/u.conf.rb";
 open($errfh, '>>', $err_log);
 
+if (my $t = $ENV{TAIL}) {
+	my @tail = $t =~ /tail/ ? split(/\s+/, $t) : (qw(tail -F));
+	push @tail, $err_log;
+	my $pid = fork;
+	if ($pid == 0) {
+		open STDOUT, '>&', \*STDERR;
+		exec @tail;
+		die "exec(@tail): $!";
+	}
+	say "# @tail";
+	sleep 0.2;
+	UnicornTest::AutoReap->new($pid);
+}
+
+sub kill_until_dead ($;%) {
+	my ($pid, %opt) = @_;
+	my $tries = $opt{tries} // 1000;
+	my $sig = $opt{sig} // 0;
+	while (CORE::kill($sig, $pid) && --$tries) { sleep(0.01) }
+	$tries or croak "PID: $pid died after signal ($sig)";
+}
+
 sub stop_daemon (;$) {
 	my ($is_END) = @_;
 	kill('TERM', $daemon_pid);
-	my $tries = 1000;
-	while (CORE::kill(0, $daemon_pid) && --$tries) { sleep(0.01) }
+	kill_until_dead $daemon_pid;
 	if ($is_END && CORE::kill(0, $daemon_pid)) { # after done_testing
 		CORE::kill('KILL', $daemon_pid);
 		die "daemon_pid=$daemon_pid did not die";
@@ -44,8 +72,9 @@ END {
 	stop_daemon(1) if defined $daemon_pid;
 };
 
-sub check_stderr () {
-	my @log = slurp($err_log);
+sub check_stderr (@) {
+	my @log = @_;
+	slurp($err_log) if !@log;
 	diag("@log") if $ENV{V};
 	my @err = grep(!/NameError.*Unicorn::Waiter/, grep(/error/i, @log));
 	@err = grep(!/failed to set accept_filter=/, @err);
@@ -63,6 +92,16 @@ sub slurp_hdr {
 	($status, \@hdr);
 }
 
+sub unix_server (;$@) {
+	my $l = shift // $u_sock;
+	IO::Socket::UNIX->new(Listen => SOMAXCONN, Local => $l, Blocking => 0,
+				Type => SOCK_STREAM, @_);
+}
+
+sub unix_connect ($) {
+	IO::Socket::UNIX->new(Peer => $_[0], Type => SOCK_STREAM);
+}
+
 sub tcp_server {
 	my %opt = (
 		ReuseAddr => 1,
@@ -95,8 +134,7 @@ sub tcp_host_port {
 
 sub unix_start ($@) {
 	my ($dst, @req) = @_;
-	my $s = IO::Socket::UNIX->new(Peer => $dst, Type => SOCK_STREAM) or
-		BAIL_OUT "unix connect $dst: $!";
+	my $s = unix_connect($dst) or BAIL_OUT "unix connect $dst: $!";
 	$s->autoflush(1);
 	print $s @req, "\r\n\r\n" if @req;
 	$s;
@@ -201,7 +239,7 @@ sub unicorn {
 	state $ver = $ENV{TEST_RUBY_VERSION} // `$ruby -e 'print RUBY_VERSION'`;
 	state $eng = $ENV{TEST_RUBY_ENGINE} // `$ruby -e 'print RUBY_ENGINE'`;
 	state $ext = File::Spec->rel2abs("test/$eng-$ver/ext/unicorn_http");
-	state $exe = File::Spec->rel2abs('bin/unicorn');
+	state $exe = File::Spec->rel2abs("test/$eng-$ver/bin/unicorn");
 	my $pid = spawn(\%env, $ruby, '-I', $lib, '-I', $ext, $exe, @args);
 	UnicornTest::AutoReap->new($pid);
 }
@@ -219,6 +257,17 @@ sub do_req ($@) {
 	($status, $hdr, $bdy);
 }
 
+sub mkfifo_die ($;$) {
+	POSIX::mkfifo($_[0], $_[1] // 0600) or croak "mkfifo: $!";
+}
+
+sub write_file ($$@) { # mode, filename, LIST (for print)
+	open(my $fh, shift, shift);
+	print $fh @_;
+	# return $fh for futher writes if user wants it:
+	defined(wantarray) && !wantarray ? $fh : close $fh;
+}
+
 # automatically kill + reap children when this goes out-of-scope
 package UnicornTest::AutoReap;
 use v5.14;
diff --git a/t/t0008-back_out_of_upgrade.sh b/t/t0008-back_out_of_upgrade.sh
deleted file mode 100755
index 96d4057..0000000
--- a/t/t0008-back_out_of_upgrade.sh
+++ /dev/null
@@ -1,110 +0,0 @@
-#!/bin/sh
-. ./test-lib.sh
-t_plan 13 "backout of USR2 upgrade"
-
-worker_wait_start () {
-	test xSTART = x"$(cat $fifo)"
-	unicorn_pid=$(cat $pid)
-}
-
-t_begin "setup and start" && {
-	unicorn_setup
-	rm -f $pid.oldbin
-
-cat >> $unicorn_config <<EOF
-after_fork do |server, worker|
-  # test script will block while reading from $fifo,
-  # so notify the script on the first worker we spawn
-  # by opening the FIFO
-  if worker.nr == 0
-    File.open("$fifo", "wb") { |fp| fp.syswrite "START" }
-  end
-end
-EOF
-	unicorn -D -c $unicorn_config pid.ru
-	worker_wait_start
-	orig_master_pid=$unicorn_pid
-}
-
-t_begin "read original worker pid" && {
-	orig_worker_pid=$(curl -sSf http://$listen/)
-	test -n "$orig_worker_pid" && kill -0 $orig_worker_pid
-}
-
-t_begin "upgrade to new master" && {
-	kill -USR2 $orig_master_pid
-}
-
-t_begin "kill old worker" && {
-	kill -WINCH $orig_master_pid
-}
-
-t_begin "wait for new worker to start" && {
-	worker_wait_start
-	test $unicorn_pid -ne $orig_master_pid
-	new_master_pid=$unicorn_pid
-}
-
-t_begin "old master pid is stashed in $pid.oldbin" && {
-	test -s "$pid.oldbin"
-	test $orig_master_pid -eq $(cat $pid.oldbin)
-}
-
-t_begin "ensure old worker is no longer running" && {
-	i=0
-	while kill -0 $orig_worker_pid 2>/dev/null
-	do
-		i=$(( $i + 1 ))
-		test $i -lt 600 || die "timed out"
-		sleep 1
-	done
-}
-
-t_begin "capture pid of new worker" && {
-	new_worker_pid=$(curl -sSf http://$listen/)
-}
-
-t_begin "reload old master process" && {
-	kill -HUP $orig_master_pid
-	worker_wait_start
-}
-
-t_begin "gracefully kill new master and ensure it dies" && {
-	kill -QUIT $new_master_pid
-	i=0
-	while kill -0 $new_worker_pid 2>/dev/null
-	do
-		i=$(( $i + 1 ))
-		test $i -lt 600 || die "timed out"
-		sleep 1
-	done
-}
-
-t_begin "ensure $pid.oldbin does not exist" && {
-	i=0
-	while test -s $pid.oldbin
-	do
-		i=$(( $i + 1 ))
-		test $i -lt 600 || die "timed out"
-		sleep 1
-	done
-	while ! test -s $pid
-	do
-		i=$(( $i + 1 ))
-		test $i -lt 600 || die "timed out"
-		sleep 1
-	done
-}
-
-t_begin "ensure $pid is correct" && {
-	cur_master_pid=$(cat $pid)
-	test $orig_master_pid -eq $cur_master_pid
-}
-
-t_begin "killing succeeds" && {
-	kill $orig_master_pid
-}
-
-dbgcat r_err
-
-t_done

[-- Attachment #4: 0003-doc-various-updates-and-disclaimers.patch --]
[-- Type: text/x-diff, Size: 3343 bytes --]

From 69d15a7a51a096b6acf00ccf23e1b988076d3b5f Mon Sep 17 00:00:00 2001
From: Eric Wong <bofh@yhbt.net>
Date: Mon, 1 Jan 2024 10:43:13 +0000
Subject: [PATCH 3/4] doc: various updates and disclaimers

Covering my ass from draconian legislation.
---
 HACKING | 13 +++++++++----
 README  |  9 +++++++++
 TODO    |  4 +---
 3 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/HACKING b/HACKING
index 5aca83e..777e75e 100644
--- a/HACKING
+++ b/HACKING
@@ -6,6 +6,8 @@ Like Mongrel, we use Ruby where it makes sense, and Ragel with C where
 it helps performance.  All of the code that actually runs your Rack
 application is written Ruby, Ragel or C.
 
+Ragel may be dropped in favor of a picohttpparser-based one in the future.
+
 As far as tests and documentation goes, we're not afraid to embrace Unix
 and use traditional Unix tools where they make sense and get the job
 done.
@@ -16,6 +18,9 @@ Tests are good, but slow tests make development slow, so we make tests
 faster (in parallel) with GNU make (instead of Rake) and avoiding
 RubyGems.
 
+New tests are written in Perl 5 and use TAP <https://testanything.org/>
+to ensure stability and immunity from Ruby incompatibilities.
+
 Users of GNU-based systems (such as GNU/Linux) usually have GNU make
 installed as "make" instead of "gmake".
 
@@ -69,10 +74,10 @@ supported by the versions of Ruby we target.
 
 === Ragel Compatibility
 
-We target the latest released version of Ragel and will update our code
-to keep up with new releases.  Packaged tarballs and gems include the
-generated source code so they will remain usable if compatibility is
-broken.
+We target the latest released version of Ragel in Debian and will update
+our code to keep up with new releases.  Packaged tarballs and gems
+include the generated source code so they will remain usable if
+compatibility is broken.
 
 == Contributing
 
diff --git a/README b/README
index 84c0fdf..b60ed00 100644
--- a/README
+++ b/README
@@ -122,6 +122,7 @@ supported.  Run `unicorn -h` to see command-line options.
 
 There is NO WARRANTY whatsoever if anything goes wrong, but
 {let us know}[link:ISSUES.html] and maybe someone can fix it.
+No commercial support will ever be provided by the amateur maintainer.
 
 unicorn is designed to only serve fast clients either on the local host
 or a fast LAN.  See the PHILOSOPHY and DESIGN documents for more details
@@ -132,6 +133,14 @@ damage done to the entire Ruby ecosystem.  Its unintentional popularity
 set Ruby back decades in parallelism, concurrency and robustness since
 it prolongs and proliferates the existence of poorly-written code.
 
+unicorn hackers are NOT responsible for your supply chain security:
+read and understand it yourself or get someone you trust to audit it.
+Malicious commits and releases will be made if under duress.  The only
+defense you'll ever have is from reviewing the source code.
+
+No user or contributor will ever be expected to sacrifice their own
+security by running JavaScript or revealing any personal information.
+
 == Contact
 
 All feedback (bug reports, user/development dicussion, patches, pull
diff --git a/TODO b/TODO
index ebbccdc..a3b18fd 100644
--- a/TODO
+++ b/TODO
@@ -1,3 +1 @@
-* Documentation improvements
-
-* improve test suite
+* improve test suite (port to Perl 5 for stability and maintainability)

[-- Attachment #5: 0004-treewide-future-proof-frozen_string_literal-changes.patch --]
[-- Type: text/x-diff, Size: 24100 bytes --]

From ccf2443901c18ffb26b2785f52d921005e862167 Mon Sep 17 00:00:00 2001
From: Eric Wong <bofh@yhbt.net>
Date: Thu, 8 Feb 2024 12:16:31 +0000
Subject: [PATCH 4/4] treewide: future-proof frozen_string_literal changes

Once again Ruby seems ready to introduce more incompatibilities
and force busywork upon maintainers[1].  In order to avoid
incompatibilities in the future, I used a Perl script[2] to
prepend `frozen_string_literal: false' to every Ruby file.

Somebody interested will have to go through every Ruby source
file and enable frozen_string_literal once they've thoroughly
verified it's safe to do so.

[1] https://bugs.ruby-lang.org/issues/20205
[2] https://yhbt.net/add-fsl.git/74d7689/s/?b=add-fsl.perl
---
 Rakefile                            | 1 +
 bin/unicorn                         | 1 +
 bin/unicorn_rails                   | 1 +
 examples/big_app_gc.rb              | 1 +
 examples/echo.ru                    | 1 +
 examples/logger_mp_safe.rb          | 1 +
 examples/unicorn.conf.minimal.rb    | 1 +
 examples/unicorn.conf.rb            | 1 +
 ext/unicorn_http/extconf.rb         | 1 +
 lib/unicorn.rb                      | 1 +
 lib/unicorn/app/old_rails.rb        | 1 +
 lib/unicorn/app/old_rails/static.rb | 1 +
 lib/unicorn/cgi_wrapper.rb          | 1 +
 lib/unicorn/configurator.rb         | 1 +
 lib/unicorn/const.rb                | 1 +
 lib/unicorn/http_request.rb         | 1 +
 lib/unicorn/http_response.rb        | 1 +
 lib/unicorn/http_server.rb          | 1 +
 lib/unicorn/launcher.rb             | 1 +
 lib/unicorn/oob_gc.rb               | 1 +
 lib/unicorn/preread_input.rb        | 1 +
 lib/unicorn/select_waiter.rb        | 1 +
 lib/unicorn/socket_helper.rb        | 1 +
 lib/unicorn/stream_input.rb         | 1 +
 lib/unicorn/tee_input.rb            | 1 +
 lib/unicorn/tmpio.rb                | 1 +
 lib/unicorn/util.rb                 | 1 +
 lib/unicorn/worker.rb               | 1 +
 setup.rb                            | 1 +
 t/broken-app.ru                     | 1 +
 t/client_body_buffer_size.ru        | 1 +
 t/detach.ru                         | 1 +
 t/env.ru                            | 1 +
 t/fails-rack-lint.ru                | 1 +
 t/heartbeat-timeout.ru              | 1 +
 t/integration.ru                    | 1 +
 t/listener_names.ru                 | 1 +
 t/oob_gc.ru                         | 1 +
 t/oob_gc_path.ru                    | 1 +
 t/pid.ru                            | 1 +
 t/preread_input.ru                  | 1 +
 t/reopen-logs.ru                    | 1 +
 t/t0013.ru                          | 1 +
 t/t0014.ru                          | 1 +
 t/t0301.ru                          | 1 +
 test/aggregate.rb                   | 1 +
 test/benchmark/dd.ru                | 1 +
 test/benchmark/ddstream.ru          | 1 +
 test/benchmark/readinput.ru         | 1 +
 test/benchmark/stack.ru             | 1 +
 test/exec/test_exec.rb              | 1 +
 test/test_helper.rb                 | 1 +
 test/unit/test_ccc.rb               | 1 +
 test/unit/test_configurator.rb      | 1 +
 test/unit/test_droplet.rb           | 1 +
 test/unit/test_http_parser.rb       | 1 +
 test/unit/test_http_parser_ng.rb    | 1 +
 test/unit/test_request.rb           | 1 +
 test/unit/test_server.rb            | 1 +
 test/unit/test_signals.rb           | 1 +
 test/unit/test_socket_helper.rb     | 1 +
 test/unit/test_stream_input.rb      | 1 +
 test/unit/test_tee_input.rb         | 1 +
 test/unit/test_util.rb              | 1 +
 test/unit/test_waiter.rb            | 1 +
 unicorn.gemspec                     | 1 +
 66 files changed, 66 insertions(+)

diff --git a/Rakefile b/Rakefile
index 37569ce..fe1588b 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,3 +1,4 @@
+# frozen_string_literal: false
 # optional rake-compiler support in case somebody needs to cross compile
 begin
   mk = "ext/unicorn_http/Makefile"
diff --git a/bin/unicorn b/bin/unicorn
index 00c8464..af8353c 100755
--- a/bin/unicorn
+++ b/bin/unicorn
@@ -1,5 +1,6 @@
 #!/this/will/be/overwritten/or/wrapped/anyways/do/not/worry/ruby
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 require 'unicorn/launcher'
 require 'optparse'
 
diff --git a/bin/unicorn_rails b/bin/unicorn_rails
index 354c1df..374fd8e 100755
--- a/bin/unicorn_rails
+++ b/bin/unicorn_rails
@@ -1,5 +1,6 @@
 #!/this/will/be/overwritten/or/wrapped/anyways/do/not/worry/ruby
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 require 'unicorn/launcher'
 require 'optparse'
 require 'fileutils'
diff --git a/examples/big_app_gc.rb b/examples/big_app_gc.rb
index c1bae10..0baea26 100644
--- a/examples/big_app_gc.rb
+++ b/examples/big_app_gc.rb
@@ -1,2 +1,3 @@
+# frozen_string_literal: false
 # see {Unicorn::OobGC}[https://yhbt.net/unicorn/Unicorn/OobGC.html]
 # Unicorn::OobGC was broken in Unicorn v3.3.1 - v3.6.1 and fixed in v3.6.2
diff --git a/examples/echo.ru b/examples/echo.ru
index e982180..453a5e6 100644
--- a/examples/echo.ru
+++ b/examples/echo.ru
@@ -1,4 +1,5 @@
 #\-E none
+# frozen_string_literal: false
 #
 # Example application that echoes read data back to the HTTP client.
 # This emulates the old echo protocol people used to run.
diff --git a/examples/logger_mp_safe.rb b/examples/logger_mp_safe.rb
index 05ad3fa..f2c0500 100644
--- a/examples/logger_mp_safe.rb
+++ b/examples/logger_mp_safe.rb
@@ -1,3 +1,4 @@
+# frozen_string_literal: false
 # Multi-Processing-safe monkey patch for Logger
 #
 # This monkey patch fixes the case where "preload_app true" is used and
diff --git a/examples/unicorn.conf.minimal.rb b/examples/unicorn.conf.minimal.rb
index 46fd634..4f96ede 100644
--- a/examples/unicorn.conf.minimal.rb
+++ b/examples/unicorn.conf.minimal.rb
@@ -1,3 +1,4 @@
+# frozen_string_literal: false
 # Minimal sample configuration file for Unicorn (not Rack) when used
 # with daemonization (unicorn -D) started in your working directory.
 #
diff --git a/examples/unicorn.conf.rb b/examples/unicorn.conf.rb
index d90bdc4..5bae830 100644
--- a/examples/unicorn.conf.rb
+++ b/examples/unicorn.conf.rb
@@ -1,3 +1,4 @@
+# frozen_string_literal: false
 # Sample verbose configuration file for Unicorn (not Rack)
 #
 # This configuration file documents many features of Unicorn
diff --git a/ext/unicorn_http/extconf.rb b/ext/unicorn_http/extconf.rb
index 11099cd..de896fe 100644
--- a/ext/unicorn_http/extconf.rb
+++ b/ext/unicorn_http/extconf.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 require 'mkmf'
 
 have_func("rb_hash_clear", "ruby.h") or abort 'Ruby 2.0+ required'
diff --git a/lib/unicorn.rb b/lib/unicorn.rb
index 564cb30..fb91679 100644
--- a/lib/unicorn.rb
+++ b/lib/unicorn.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 require 'etc'
 require 'stringio'
 require 'raindrops'
diff --git a/lib/unicorn/app/old_rails.rb b/lib/unicorn/app/old_rails.rb
index 1e8c41a..54b3e69 100644
--- a/lib/unicorn/app/old_rails.rb
+++ b/lib/unicorn/app/old_rails.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 
 # :enddoc:
 # This code is based on the original Rails handler in Mongrel
diff --git a/lib/unicorn/app/old_rails/static.rb b/lib/unicorn/app/old_rails/static.rb
index 2257270..cf34e02 100644
--- a/lib/unicorn/app/old_rails/static.rb
+++ b/lib/unicorn/app/old_rails/static.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 # :enddoc:
 # This code is based on the original Rails handler in Mongrel
 # Copyright (c) 2005 Zed A. Shaw
diff --git a/lib/unicorn/cgi_wrapper.rb b/lib/unicorn/cgi_wrapper.rb
index d9b7fe5..fb43605 100644
--- a/lib/unicorn/cgi_wrapper.rb
+++ b/lib/unicorn/cgi_wrapper.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 
 # :enddoc:
 # This code is based on the original CGIWrapper from Mongrel
diff --git a/lib/unicorn/configurator.rb b/lib/unicorn/configurator.rb
index b21a01d..3c81596 100644
--- a/lib/unicorn/configurator.rb
+++ b/lib/unicorn/configurator.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 require 'logger'
 
 # Implements a simple DSL for configuring a unicorn server.
diff --git a/lib/unicorn/const.rb b/lib/unicorn/const.rb
index 33ab4ac..8032863 100644
--- a/lib/unicorn/const.rb
+++ b/lib/unicorn/const.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 
 module Unicorn::Const # :nodoc:
   # default TCP listen host address (0.0.0.0, all interfaces)
diff --git a/lib/unicorn/http_request.rb b/lib/unicorn/http_request.rb
index ab3bd6e..a48dab7 100644
--- a/lib/unicorn/http_request.rb
+++ b/lib/unicorn/http_request.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 # :enddoc:
 # no stable API here
 require 'unicorn_http'
diff --git a/lib/unicorn/http_response.rb b/lib/unicorn/http_response.rb
index 0ed0ae3..3634165 100644
--- a/lib/unicorn/http_response.rb
+++ b/lib/unicorn/http_response.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 # :enddoc:
 # Writes a Rack response to your client using the HTTP/1.1 specification.
 # You use it by simply doing:
diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index ed5bbf1..08fbe40 100644
--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 
 # This is the process manager of Unicorn. This manages worker
 # processes which in turn handle the I/O and application process.
diff --git a/lib/unicorn/launcher.rb b/lib/unicorn/launcher.rb
index 78e8f39..bd3324e 100644
--- a/lib/unicorn/launcher.rb
+++ b/lib/unicorn/launcher.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 
 # :enddoc:
 $stdout.sync = $stderr.sync = true
diff --git a/lib/unicorn/oob_gc.rb b/lib/unicorn/oob_gc.rb
index db9f2cb..efd9177 100644
--- a/lib/unicorn/oob_gc.rb
+++ b/lib/unicorn/oob_gc.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 
 # Strongly consider https://github.com/tmm1/gctools if using Ruby 2.1+
 # It is built on new APIs in Ruby 2.1, so it is more intelligent than
diff --git a/lib/unicorn/preread_input.rb b/lib/unicorn/preread_input.rb
index 12eb3e8..c62cc09 100644
--- a/lib/unicorn/preread_input.rb
+++ b/lib/unicorn/preread_input.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 
 module Unicorn
 # This middleware is used to ensure input is buffered to memory
diff --git a/lib/unicorn/select_waiter.rb b/lib/unicorn/select_waiter.rb
index cb84aab..d11ea57 100644
--- a/lib/unicorn/select_waiter.rb
+++ b/lib/unicorn/select_waiter.rb
@@ -1,3 +1,4 @@
+# frozen_string_literal: false
 # fallback for non-Linux and Linux <4.5 systems w/o EPOLLEXCLUSIVE
 class Unicorn::SelectWaiter # :nodoc:
   def get_readers(ready, readers, timeout) # :nodoc:
diff --git a/lib/unicorn/socket_helper.rb b/lib/unicorn/socket_helper.rb
index 06ec2b2..986932f 100644
--- a/lib/unicorn/socket_helper.rb
+++ b/lib/unicorn/socket_helper.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 # :enddoc:
 require 'socket'
 
diff --git a/lib/unicorn/stream_input.rb b/lib/unicorn/stream_input.rb
index 9246f73..23a9976 100644
--- a/lib/unicorn/stream_input.rb
+++ b/lib/unicorn/stream_input.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 
 # When processing uploads, unicorn may expose a StreamInput object under
 # "rack.input" of the Rack environment when
diff --git a/lib/unicorn/tee_input.rb b/lib/unicorn/tee_input.rb
index 2ccc2d9..b3c6535 100644
--- a/lib/unicorn/tee_input.rb
+++ b/lib/unicorn/tee_input.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 
 # Acts like tee(1) on an input input to provide a input-like stream
 # while providing rewindable semantics through a File/StringIO backing
diff --git a/lib/unicorn/tmpio.rb b/lib/unicorn/tmpio.rb
index 0bbf6ec..deecd80 100644
--- a/lib/unicorn/tmpio.rb
+++ b/lib/unicorn/tmpio.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 # :stopdoc:
 require 'tmpdir'
 
diff --git a/lib/unicorn/util.rb b/lib/unicorn/util.rb
index b826de4..f28d929 100644
--- a/lib/unicorn/util.rb
+++ b/lib/unicorn/util.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 
 require 'fcntl'
 module Unicorn::Util # :nodoc:
diff --git a/lib/unicorn/worker.rb b/lib/unicorn/worker.rb
index 4af31be..d2445d5 100644
--- a/lib/unicorn/worker.rb
+++ b/lib/unicorn/worker.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 require "raindrops"
 
 # This class and its members can be considered a stable interface
diff --git a/setup.rb b/setup.rb
index cf1abd9..96cf75a 100644
--- a/setup.rb
+++ b/setup.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 #
 # setup.rb
 #
diff --git a/t/broken-app.ru b/t/broken-app.ru
index d05d7ab..5966bff 100644
--- a/t/broken-app.ru
+++ b/t/broken-app.ru
@@ -1,3 +1,4 @@
+# frozen_string_literal: false
 # we do not want Rack::Lint or anything to protect us
 use Rack::ContentLength
 use Rack::ContentType, "text/plain"
diff --git a/t/client_body_buffer_size.ru b/t/client_body_buffer_size.ru
index 44161a5..1a0fb16 100644
--- a/t/client_body_buffer_size.ru
+++ b/t/client_body_buffer_size.ru
@@ -1,4 +1,5 @@
 #\ -E none
+# frozen_string_literal: false
 app = lambda do |env|
   input = env['rack.input']
   case env["PATH_INFO"]
diff --git a/t/detach.ru b/t/detach.ru
index bbd998e..8d35951 100644
--- a/t/detach.ru
+++ b/t/detach.ru
@@ -1,3 +1,4 @@
+# frozen_string_literal: false
 use Rack::ContentType, "text/plain"
 fifo_path = ENV["TEST_FIFO"] or abort "TEST_FIFO not set"
 run lambda { |env|
diff --git a/t/env.ru b/t/env.ru
index 388412e..86c3cfa 100644
--- a/t/env.ru
+++ b/t/env.ru
@@ -1,3 +1,4 @@
+# frozen_string_literal: false
 use Rack::ContentLength
 use Rack::ContentType, "text/plain"
 run lambda { |env| [ 200, {}, [ env.inspect << "\n" ] ] }
diff --git a/t/fails-rack-lint.ru b/t/fails-rack-lint.ru
index 82bfb5f..8b8b5ec 100644
--- a/t/fails-rack-lint.ru
+++ b/t/fails-rack-lint.ru
@@ -1,3 +1,4 @@
+# frozen_string_literal: false
 # This rack app returns an invalid status code, which will cause
 # Rack::Lint to throw an exception if it is present.  This
 # is used to check whether Rack::Lint is in the stack or not.
diff --git a/t/heartbeat-timeout.ru b/t/heartbeat-timeout.ru
index 3eeb5d6..ccc6a8e 100644
--- a/t/heartbeat-timeout.ru
+++ b/t/heartbeat-timeout.ru
@@ -1,3 +1,4 @@
+# frozen_string_literal: false
 use Rack::ContentLength
 headers = { 'content-type' => 'text/plain' }
 run lambda { |env|
diff --git a/t/integration.ru b/t/integration.ru
index 888833a..6df481c 100644
--- a/t/integration.ru
+++ b/t/integration.ru
@@ -1,4 +1,5 @@
 #!ruby
+# frozen_string_literal: false
 # Copyright (C) unicorn hackers <unicorn-public@80x24.org>
 # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
 
diff --git a/t/listener_names.ru b/t/listener_names.ru
index edb4e6a..f52c59b 100644
--- a/t/listener_names.ru
+++ b/t/listener_names.ru
@@ -1,3 +1,4 @@
+# frozen_string_literal: false
 use Rack::ContentLength
 use Rack::ContentType, "text/plain"
 names = Unicorn.listener_names.inspect # rely on preload_app=true
diff --git a/t/oob_gc.ru b/t/oob_gc.ru
index 224cb06..2ae58a8 100644
--- a/t/oob_gc.ru
+++ b/t/oob_gc.ru
@@ -1,4 +1,5 @@
 #\-E none
+# frozen_string_literal: false
 require 'unicorn/oob_gc'
 use Rack::ContentLength
 use Rack::ContentType, "text/plain"
diff --git a/t/oob_gc_path.ru b/t/oob_gc_path.ru
index 7f40601..5358222 100644
--- a/t/oob_gc_path.ru
+++ b/t/oob_gc_path.ru
@@ -1,4 +1,5 @@
 #\-E none
+# frozen_string_literal: false
 require 'unicorn/oob_gc'
 use Rack::ContentLength
 use Rack::ContentType, "text/plain"
diff --git a/t/pid.ru b/t/pid.ru
index f5fd31f..b49b137 100644
--- a/t/pid.ru
+++ b/t/pid.ru
@@ -1,3 +1,4 @@
+# frozen_string_literal: false
 use Rack::ContentLength
 use Rack::ContentType, "text/plain"
 run lambda { |env| [ 200, {}, [ "#$$\n" ] ] }
diff --git a/t/preread_input.ru b/t/preread_input.ru
index 18af221..5f68fe9 100644
--- a/t/preread_input.ru
+++ b/t/preread_input.ru
@@ -1,4 +1,5 @@
 #\-E none
+# frozen_string_literal: false
 require 'digest/md5'
 require 'unicorn/preread_input'
 use Unicorn::PrereadInput
diff --git a/t/reopen-logs.ru b/t/reopen-logs.ru
index c39e8f6..488da85 100644
--- a/t/reopen-logs.ru
+++ b/t/reopen-logs.ru
@@ -1,3 +1,4 @@
+# frozen_string_literal: false
 use Rack::ContentLength
 use Rack::ContentType, "text/plain"
 run lambda { |env|
diff --git a/t/t0013.ru b/t/t0013.ru
index 48a3a34..e425093 100644
--- a/t/t0013.ru
+++ b/t/t0013.ru
@@ -1,4 +1,5 @@
 #\ -E none
+# frozen_string_literal: false
 use Rack::ContentLength
 use Rack::ContentType, 'text/plain'
 app = lambda do |env|
diff --git a/t/t0014.ru b/t/t0014.ru
index b0bd2b7..686d214 100644
--- a/t/t0014.ru
+++ b/t/t0014.ru
@@ -1,4 +1,5 @@
 #\ -E none
+# frozen_string_literal: false
 use Rack::ContentLength
 use Rack::ContentType, 'text/plain'
 app = lambda do |env|
diff --git a/t/t0301.ru b/t/t0301.ru
index ce68213..54929b1 100644
--- a/t/t0301.ru
+++ b/t/t0301.ru
@@ -1,4 +1,5 @@
 #\-N --debug
+# frozen_string_literal: false
 run(lambda do |env|
   case env['PATH_INFO']
   when '/vars'
diff --git a/test/aggregate.rb b/test/aggregate.rb
index 5eebbe5..0f32b2f 100755
--- a/test/aggregate.rb
+++ b/test/aggregate.rb
@@ -1,5 +1,6 @@
 #!/usr/bin/ruby -n
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 
 BEGIN { $tests = $assertions = $failures = $errors = 0 }
 
diff --git a/test/benchmark/dd.ru b/test/benchmark/dd.ru
index 111fa2e..5bd2739 100644
--- a/test/benchmark/dd.ru
+++ b/test/benchmark/dd.ru
@@ -1,3 +1,4 @@
+# frozen_string_literal: false
 # This benchmark is the simplest test of the I/O facilities in
 # unicorn.  It is meant to return a fixed-sized blob to test
 # the performance of things in Unicorn, _NOT_ the app.
diff --git a/test/benchmark/ddstream.ru b/test/benchmark/ddstream.ru
index b14c973..fd40ced 100644
--- a/test/benchmark/ddstream.ru
+++ b/test/benchmark/ddstream.ru
@@ -1,3 +1,4 @@
+# frozen_string_literal: false
 # This app is intended to test large HTTP responses with or without
 # a fully-buffering reverse proxy such as nginx. Without a fully-buffering
 # reverse proxy, unicorn will be unresponsive when client count exceeds
diff --git a/test/benchmark/readinput.ru b/test/benchmark/readinput.ru
index c91bec3..95c0226 100644
--- a/test/benchmark/readinput.ru
+++ b/test/benchmark/readinput.ru
@@ -1,3 +1,4 @@
+# frozen_string_literal: false
 # This app is intended to test large HTTP requests with or without
 # a fully-buffering reverse proxy such as nginx. Without a fully-buffering
 # reverse proxy, unicorn will be unresponsive when client count exceeds
diff --git a/test/benchmark/stack.ru b/test/benchmark/stack.ru
index fc9193f..17a565b 100644
--- a/test/benchmark/stack.ru
+++ b/test/benchmark/stack.ru
@@ -1,3 +1,4 @@
+# frozen_string_literal: false
 run(lambda { |env|
   body = "#{caller.size}\n"
   h = {
diff --git a/test/exec/test_exec.rb b/test/exec/test_exec.rb
index 8494452..807f724 100644
--- a/test/exec/test_exec.rb
+++ b/test/exec/test_exec.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 # Don't add to this file, new tests are in Perl 5. See t/README
 FLOCK_PATH = File.expand_path(__FILE__)
 require './test/test_helper'
diff --git a/test/test_helper.rb b/test/test_helper.rb
index d86f83b..0bf3c90 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 
 # Copyright (c) 2005 Zed A. Shaw
 # You can redistribute it and/or modify it under the same terms as Ruby 1.8 or
diff --git a/test/unit/test_ccc.rb b/test/unit/test_ccc.rb
index f518230..a0a2bff 100644
--- a/test/unit/test_ccc.rb
+++ b/test/unit/test_ccc.rb
@@ -1,3 +1,4 @@
+# frozen_string_literal: false
 require 'socket'
 require 'unicorn'
 require 'io/wait'
diff --git a/test/unit/test_configurator.rb b/test/unit/test_configurator.rb
index 1298f0e..1a89aca 100644
--- a/test/unit/test_configurator.rb
+++ b/test/unit/test_configurator.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 
 require 'test/unit'
 require 'tempfile'
diff --git a/test/unit/test_droplet.rb b/test/unit/test_droplet.rb
index 81ad82b..4b2d2d0 100644
--- a/test/unit/test_droplet.rb
+++ b/test/unit/test_droplet.rb
@@ -1,3 +1,4 @@
+# frozen_string_literal: false
 require 'test/unit'
 require 'unicorn'
 
diff --git a/test/unit/test_http_parser.rb b/test/unit/test_http_parser.rb
index 697af44..adcc84f 100644
--- a/test/unit/test_http_parser.rb
+++ b/test/unit/test_http_parser.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 
 # Copyright (c) 2005 Zed A. Shaw
 # You can redistribute it and/or modify it under the same terms as Ruby 1.8 or
diff --git a/test/unit/test_http_parser_ng.rb b/test/unit/test_http_parser_ng.rb
index 425d5ad..fd47246 100644
--- a/test/unit/test_http_parser_ng.rb
+++ b/test/unit/test_http_parser_ng.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 
 require './test/test_helper'
 require 'digest/md5'
diff --git a/test/unit/test_request.rb b/test/unit/test_request.rb
index 53ae944..9d1b350 100644
--- a/test/unit/test_request.rb
+++ b/test/unit/test_request.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 
 # Copyright (c) 2009 Eric Wong
 # You can redistribute it and/or modify it under the same terms as Ruby 1.8 or
diff --git a/test/unit/test_server.rb b/test/unit/test_server.rb
index 7ffa48f..5a2252f 100644
--- a/test/unit/test_server.rb
+++ b/test/unit/test_server.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 
 # Copyright (c) 2005 Zed A. Shaw
 # You can redistribute it and/or modify it under the same terms as Ruby 1.8 or
diff --git a/test/unit/test_signals.rb b/test/unit/test_signals.rb
index 6c48754..49ff3c7 100644
--- a/test/unit/test_signals.rb
+++ b/test/unit/test_signals.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 
 # Copyright (c) 2009 Eric Wong
 # You can redistribute it and/or modify it under the same terms as Ruby 1.8 or
diff --git a/test/unit/test_socket_helper.rb b/test/unit/test_socket_helper.rb
index a446f06..4363474 100644
--- a/test/unit/test_socket_helper.rb
+++ b/test/unit/test_socket_helper.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 
 require './test/test_helper'
 require 'tempfile'
diff --git a/test/unit/test_stream_input.rb b/test/unit/test_stream_input.rb
index 7986ca7..7ee98e4 100644
--- a/test/unit/test_stream_input.rb
+++ b/test/unit/test_stream_input.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 
 require 'test/unit'
 require 'digest/sha1'
diff --git a/test/unit/test_tee_input.rb b/test/unit/test_tee_input.rb
index 607ce87..8f05c77 100644
--- a/test/unit/test_tee_input.rb
+++ b/test/unit/test_tee_input.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 
 require 'test/unit'
 require 'digest/sha1'
diff --git a/test/unit/test_util.rb b/test/unit/test_util.rb
index bc7b233..ce53b86 100644
--- a/test/unit/test_util.rb
+++ b/test/unit/test_util.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 
 require './test/test_helper'
 require 'tempfile'
diff --git a/test/unit/test_waiter.rb b/test/unit/test_waiter.rb
index 0995de2..a20994b 100644
--- a/test/unit/test_waiter.rb
+++ b/test/unit/test_waiter.rb
@@ -1,3 +1,4 @@
+# frozen_string_literal: false
 require 'test/unit'
 require 'unicorn'
 require 'unicorn/select_waiter'
diff --git a/unicorn.gemspec b/unicorn.gemspec
index e7e3ef7..36700a8 100644
--- a/unicorn.gemspec
+++ b/unicorn.gemspec
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 manifest = File.exist?('.manifest') ?
   IO.readlines('.manifest').map!(&:chomp!) : `git ls-files`.split("\n")
 

^ permalink raw reply related	[relevance 1%]

* [PATCH 2/1] httpdate: fix build with Ruby 2.7 (at least)
  @ 2023-06-05  9:28  9% ` Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2023-06-05  9:28 UTC (permalink / raw)
  To: unicorn-public

<time.h> is still required for gmtime_r(3), and not all versions
of <ruby.h> include <time.h>, already.

Fixes: a6463151bd1db5b9 (httpdate: favor gettimeofday(2) over time(2) for correctness, 2023-06-01)
---
 ext/unicorn_http/httpdate.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ext/unicorn_http/httpdate.c b/ext/unicorn_http/httpdate.c
index 27a8f51..0faf5da 100644
--- a/ext/unicorn_http/httpdate.c
+++ b/ext/unicorn_http/httpdate.c
@@ -1,4 +1,5 @@
 #include <ruby.h>
+#include <time.h>
 #include <sys/time.h>
 #include <stdio.h>
 

^ permalink raw reply related	[relevance 9%]

* [ANN] unicorn 6.1.0 - Rack HTTP server for fast clients and *nix
@ 2021-12-25 18:06  4% Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2021-12-25 18:06 UTC (permalink / raw)
  To: ruby-talk, unicorn-public

unicorn is an HTTP server for Rack applications designed to only serve
fast clients on low-latency, high-bandwidth connections and take
advantage of features in Unix/Unix-like kernels.  Slow clients should
only be served by placing a reverse proxy capable of fully buffering
both the the request and response in between unicorn and slow clients.

Disclaimer:

Due to its ability to tolerate crashes and isolate clients, unicorn
is unfortunately known to prolong the existence of bugs in applications
and libraries which run on top of it.

Consider this just an announcement to inform existing users of a
new version, not something to convince you to switch to something
that set the entire Ruby world back decades in terms of concurrency.

Note:
.onion URLs below are available for Tor users and can reduce
our operating costs:

* https://yhbt.net/unicorn/
  http://unicorn.7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/
* public list: unicorn-public@yhbt.net
* mail archives: https://yhbt.net/unicorn-public/
  http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/unicorn-public/
* git clone https://yhbt.net/unicorn.git
  torsocks git clone http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/unicorn.git
* https://yhbt.net/unicorn/NEWS.atom.xml
  http://unicorn.7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/NEWS.atom.xml
* nntps://news.public-inbox.org/inbox.comp.lang.ruby.unicorn
  nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.lang.ruby.unicorn
  imaps://yhbt.net/inbox.comp.lang.ruby.unicorn.0
  imap://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.lang.ruby.unicorn.0

Changes:

    This release reduces CPU usage for Linux 4.5+ in most cases.
    See "[PATCH 6/6] use EPOLLEXCLUSIVE on Linux 4.5+" for more details:
      https://yhbt.net/unicorn-public/20211001030923.26705-7-bofh@yhbt.net/

    There's a couple of updates for Ruby 3.1, but we've finally
    started relying on Ruby 2.0.0 features after 9 years :P
    (so Ruby 1.9.3 users are stuck with older versions).

    And the usual round of doc updates and some build speedups.

    13 changes by the Bozo Doofus maintainer since v6.0.0:

          test_util: less excessive encoding tests
          drop Ruby 1.9.3 support, require 2.0+ for now
          drop unnecessary IO#close_on_exec=true assignment
          extconf.rb: get rid of unnecessary checks
          makefile: reduce unnecessary rebuilds
          HACKING: drop outdated information about pandoc
          http_server: get rid of Process.ppid check
          worker_loop: get rid of select() avoidance hack
          use EPOLLEXCLUSIVE on Linux 4.5+
          allow Ruby to deduplicate remaining globals
          epollexclusive: remove rb_gc_force_recycle call
          drop Ruby version warning, fix speling errer
          doc: v3 .onion updates, nntp => nntps, minor wording changes

^ permalink raw reply	[relevance 4%]

* [PATCH 2/3] drop Ruby version warning, fix speling errer
  @ 2021-12-25 17:41  6% ` Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2021-12-25 17:41 UTC (permalink / raw)
  To: unicorn-public

The warning was probably lost in the noise of the build, anyways.
---
 ext/unicorn_http/extconf.rb | 5 -----
 unicorn.gemspec             | 2 +-
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/ext/unicorn_http/extconf.rb b/ext/unicorn_http/extconf.rb
index 13dec412..80d00e56 100644
--- a/ext/unicorn_http/extconf.rb
+++ b/ext/unicorn_http/extconf.rb
@@ -1,11 +1,6 @@
 # -*- encoding: binary -*-
 require 'mkmf'
 
-unless RUBY_VERSION < '3.1'
-  warn "Unicorn was only tested against MRI up to 3.0.\n" \
-       "It might not properly work with #{RUBY_VERSION}"
-end
-
 have_func("rb_hash_clear", "ruby.h") or abort 'Ruby 2.0+ required'
 
 message('checking if String#-@ (str_uminus) dedupes... ')
diff --git a/unicorn.gemspec b/unicorn.gemspec
index 9230199d..b12cf9d3 100644
--- a/unicorn.gemspec
+++ b/unicorn.gemspec
@@ -25,7 +25,7 @@
   s.homepage = 'https://yhbt.net/unicorn/'
   s.test_files = test_files
 
-  # 2.0.0 is the minumum supported version. We don't specify
+  # 2.0.0 is the minimum supported version. We don't specify
   # a maximum version to make it easier to test pre-releases,
   # but we do warn users if they install unicorn on an untested
   # version in extconf.rb

^ permalink raw reply related	[relevance 6%]

* [PATCH 3/6] HACKING: drop outdated information about pandoc
  @ 2021-10-01  3:09 21% ` Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2021-10-01  3:09 UTC (permalink / raw)
  To: unicorn-public

It's been outdated since d9b5943af26d5df5 (doc: replace
pandoc-"Markdown" with real manpages, 2019-12-15)
---
 HACKING | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/HACKING b/HACKING
index 7c41eba..020209e 100644
--- a/HACKING
+++ b/HACKING
@@ -50,9 +50,6 @@ programming experience will come in handy (or be learned) here.
 
 === Documentation
 
-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.
 
@@ -102,10 +99,6 @@ don't email the git mailing list or maintainer with Unicorn patches :)
 
 == Building a Gem
 
-In order to build the gem, you must install the following components:
-
- * pandoc
-
 You can build the Unicorn gem with the following command:
 
   gmake gem

^ permalink raw reply related	[relevance 21%]

* [PATCH] build: publish_doc: remove created.rid and index.html from site
@ 2020-12-24 20:40  8% Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2020-12-24 20:40 UTC (permalink / raw)
  To: unicorn-public

created.rid has no business being published anyways, and
index.html is redundant given README.html.  Avoid confusing
search engines with identical documents at different URLs.

Our "homepage" is just a directory listing, now, which should
help discoverability of non-HTML docs.  Old content is at
https://yhbt.net/unicorn/README.html
---
 GNUmakefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/GNUmakefile b/GNUmakefile
index d80e6080..dd0a761a 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -245,7 +245,8 @@ publish_doc:
 	$(MAKE) doc
 	$(MAKE) doc_gz
 	chmod 644 $$(find doc -type f)
-	$(RSYNC) -av doc/ yhbt.net:/srv/yhbt/unicorn/
+	$(RSYNC) -av doc/ yhbt.net:/srv/yhbt/unicorn/ \
+		--exclude index.html* --exclude created.rid*
 	git ls-files | xargs touch
 
 # Create gzip variants of the same timestamp as the original so nginx

^ permalink raw reply related	[relevance 8%]

* Re: [PATCH] Update ruby_version requirement to allow ruby 3.0
  2020-09-08  8:50  8%                           ` Eric Wong
@ 2020-09-08  8:56  6%                             ` Jean Boussier
  0 siblings, 0 replies; 89+ results
From: Jean Boussier @ 2020-09-08  8:56 UTC (permalink / raw)
  To: Eric Wong; +Cc: unicorn-public

>>> Ah, perhaps adding some checks to extconf.rb would be useful?
>>> Or moving the ragel invocation into the extconf.rb-generated
>>> Makefile? (not too sure how to do that...).
>> 
>> Not really no. And it would make ragel a build dependency.
> 
> No, the generated .c file would still be distributed with the
> gem as it is today.

I meant if the gem is used as a "git gem" through bundler.
That's why some other gems like puma commit the generated
.c files.

> Changing the .rl file might result in ragel running (or emit
> warning if ragel isn't installed).  Not too sure how to do that
> via mkmf, though...  Or it would just throw a warning and drop a
> hint to run "make ragel" at the top-level if the .c file is
> missing...

The thing is ragel isn't part of packages such as build-essentials
etc. So really it wouldn't help much.

It just took me a while to figure out because I was tired, but in
the end it wasn't that bad: 
https://github.com/Shopify/unicorn/compare/upstream-master...Shopify:ruby-3.0




^ permalink raw reply	[relevance 6%]

* Re: [PATCH] Update ruby_version requirement to allow ruby 3.0
  2020-09-08  8:00  8%                         ` Jean Boussier
@ 2020-09-08  8:50  8%                           ` Eric Wong
  2020-09-08  8:56  6%                             ` Jean Boussier
  0 siblings, 1 reply; 89+ results
From: Eric Wong @ 2020-09-08  8:50 UTC (permalink / raw)
  To: Jean Boussier; +Cc: unicorn-public

Jean Boussier <jean.boussier@shopify.com> wrote:
> > Ah, perhaps adding some checks to extconf.rb would be useful?
> > Or moving the ragel invocation into the extconf.rb-generated
> > Makefile? (not too sure how to do that...).
> 
> Not really no. And it would make ragel a build dependency.

No, the generated .c file would still be distributed with the
gem as it is today.  I'm absolutely against introducing new
build requirements (optional dependencies, maybe, but not
requirements).

Changing the .rl file might result in ragel running (or emit
warning if ragel isn't installed).  Not too sure how to do that
via mkmf, though...  Or it would just throw a warning and drop a
hint to run "make ragel" at the top-level if the .c file is
missing...

> But really I don't think so many people need to use unicorn
> branches.

*shrug*  I figure for any one person that posts a comment for
something on any public forum, there's probably 10 that feel the
same way.

> > OK, soon.  Maybe with just the aforementioned ragel check above;
> > or not even...  
> 
> I'd say not even. It's just for people like me trying to run branches.

Alright, we can experiment with more build system changes
another time another (and I zoned out while writing the 5.7
release notes and forgot to note the minor build system changes
I made right after th 5.6.0 release :x)

https://yhbt.net/unicorn-public/20200908084429.GA16521@dcvr/

^ permalink raw reply	[relevance 8%]

* Re: [PATCH] Update ruby_version requirement to allow ruby 3.0
  @ 2020-09-08  8:00  8%                         ` Jean Boussier
  2020-09-08  8:50  8%                           ` Eric Wong
  0 siblings, 1 reply; 89+ results
From: Jean Boussier @ 2020-09-08  8:00 UTC (permalink / raw)
  To: Eric Wong; +Cc: unicorn-public

> Ah, perhaps adding some checks to extconf.rb would be useful?
> Or moving the ragel invocation into the extconf.rb-generated
> Makefile? (not too sure how to do that...).

Not really no. And it would make ragel a build dependency.

> I'm not remotely knowledgeable when it comes to bundler.

That's fine, it just makes unicorn a bit harder to use outside of
rubygems releases. But long story short bundler git gems is
pretty much:

  - git clone repo
  - gem build repo.gemspec
  - gem install repo-...

So nothing is executed besides the extconf.rb. Which mean
the version file and the generated.c file would need to be
committed in the repository rather than in .gitignore.

But really I don't think so many people need to use unicorn
branches.

> OK, soon.  Maybe with just the aforementioned ragel check above;
> or not even...  

I'd say not even. It's just for people like me trying to run branches.

^ permalink raw reply	[relevance 8%]

* Re: [PATCH] Update ruby_version requirement to allow ruby 3.0
  2020-09-03  8:29  6%           ` Jean Boussier
@ 2020-09-03  9:31  6%             ` Eric Wong
    0 siblings, 1 reply; 89+ results
From: Eric Wong @ 2020-09-03  9:31 UTC (permalink / raw)
  To: Jean Boussier; +Cc: unicorn-public

Jean Boussier <jean.boussier@shopify.com> wrote:
> >> I'm trying to figure out why the symbol isn't exported,
> >> I might come back with another patch. But just in case
> >> you might have an idea what's going on.
> > 
> > I haven't built+tested ruby.git in ages (my computers are too slow).
> > It could be a failure to completely clean out the old 2.8 stuff
> > (either in the Ruby worktree, install paths, or unicorn worktree).
> 
> I don't think so, I'm building from a fresh docker image + fresh unicorn
> clone.
> 
> I also tested other similar gems (e.g. puma) and they export the functions
> just fine. 

Do the current dependencies (kgio, raindrops) export alright, as well?
Might be worth comparing the generated Makefile with other gems
and see if there's missing flags or such.

> I have to admit that I don't understand enough about the build process
> to figure out what's going on, so I'm not very confident I'll find a fix.

I'm not a build/linker expert, either.  Also, did things work a
few days/weeks ago when ruby.git was still 2.8?  Maybe mkmf.log
has clues, somewhere, too...

*shrug* my brain hurts from other stuff

^ permalink raw reply	[relevance 6%]

* Re: [PATCH] Update ruby_version requirement to allow ruby 3.0
  @ 2020-09-03  8:29  6%           ` Jean Boussier
  2020-09-03  9:31  6%             ` Eric Wong
  0 siblings, 1 reply; 89+ results
From: Jean Boussier @ 2020-09-03  8:29 UTC (permalink / raw)
  To: Eric Wong; +Cc: unicorn-public

>> That could work yes. Something akin to:
>> "This ruby version wasn't tested, blah blah".
> 
> OK, can you send a patch for that?

I will once I have something working on 3.0.

>> I'm trying to figure out why the symbol isn't exported,
>> I might come back with another patch. But just in case
>> you might have an idea what's going on.
> 
> I haven't built+tested ruby.git in ages (my computers are too slow).
> It could be a failure to completely clean out the old 2.8 stuff
> (either in the Ruby worktree, install paths, or unicorn worktree).

I don't think so, I'm building from a fresh docker image + fresh unicorn
clone.

I also tested other similar gems (e.g. puma) and they export the functions
just fine. 

I have to admit that I don't understand enough about the build process
to figure out what's going on, so I'm not very confident I'll find a fix.

^ permalink raw reply	[relevance 6%]

* [PATCH 2/2] build: revamp and avoid unnecessary rebuilds
  2020-07-26  1:57  6% [PATCH 0/2] minor test improvements Eric Wong
@ 2020-07-26  1:57 12% ` Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2020-07-26  1:57 UTC (permalink / raw)
  To: unicorn-public

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.
---
 GNUmakefile   | 160 ++++++++++++++++++++++++++++++++------------------
 t/GNUmakefile |  75 +----------------------
 2 files changed, 105 insertions(+), 130 deletions(-)

diff --git a/GNUmakefile b/GNUmakefile
index eac3473f..d80e6080 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -10,6 +10,7 @@ RAGEL = ragel
 RSYNC = rsync
 OLDDOC = olddoc
 RDOC = rdoc
+INSTALL = install
 
 GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
 	@./GIT-VERSION-GEN
@@ -25,7 +26,38 @@ endif
 
 RUBY_ENGINE := $(shell $(RUBY) -e 'puts((RUBY_ENGINE rescue "ruby"))')
 
-MYLIBS = $(RUBYLIB)
+# we should never package more than one ext to avoid DSO proliferation:
+# https://udrepper.livejournal.com/8790.html
+ext := $(firstword $(wildcard ext/*))
+
+ragel: $(ext)/unicorn_http.c
+
+rl_files := $(wildcard $(ext)/*.rl)
+ragel: $(ext)/unicorn_http.c
+$(ext)/unicorn_http.c: $(rl_files)
+	cd $(@D) && $(RAGEL) unicorn_http.rl -C $(RLFLAGS) -o $(@F)
+ext_pfx := test/$(RUBY_ENGINE)-$(RUBY_VERSION)
+tmp_bin := $(ext_pfx)/bin
+ext_h := $(wildcard $(ext)/*/*.h $(ext)/*.h)
+ext_src := $(sort $(wildcard $(ext)/*.c) $(ext_h) $(ext)/unicorn_http.c)
+ext_pfx_src := $(addprefix $(ext_pfx)/,$(ext_src))
+ext_dir := $(ext_pfx)/$(ext)
+$(ext)/extconf.rb: $(wildcard $(ext)/*.h)
+	@>>$@
+$(ext_dir) $(tmp_bin) man/man1 doc/man1 pkg t/trash:
+	@mkdir -p $@
+$(ext_pfx)/$(ext)/%: $(ext)/% | $(ext_dir)
+	$(INSTALL) -m 644 $< $@
+$(ext_pfx)/$(ext)/Makefile: $(ext)/extconf.rb $(ext_h) | $(ext_dir)
+	$(RM) -f $(@D)/*.o
+	cd $(@D) && $(RUBY) $(CURDIR)/$(ext)/extconf.rb $(EXTCONF_ARGS)
+ext_sfx := _ext.$(DLEXT)
+ext_dl := $(ext_pfx)/$(ext)/$(notdir $(ext)_ext.$(DLEXT))
+$(ext_dl): $(ext_src) $(ext_pfx_src) $(ext_pfx)/$(ext)/Makefile
+	$(MAKE) -C $(@D)
+lib := $(CURDIR)/lib:$(CURDIR)/$(ext_pfx)/$(ext)
+http build: $(ext_dl)
+$(ext_pfx)/$(ext)/unicorn_http.c: ext/unicorn_http/unicorn_http.c
 
 # 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
@@ -37,44 +69,21 @@ T := $(filter-out $(slow_tests), $(wildcard test/*/test*.rb))
 T_n := $(shell $(awk_slow) $(slow_tests))
 T_log := $(subst .rb,$(log_suffix),$(T))
 T_n_log := $(subst .n,$(log_suffix),$(T_n))
-test_prefix = $(CURDIR)/test/$(RUBY_ENGINE)-$(RUBY_VERSION)
 
-ext := ext/unicorn_http
-c_files := $(ext)/unicorn_http.c $(ext)/httpdate.c $(wildcard $(ext)/*.h)
-rl_files := $(wildcard $(ext)/*.rl)
 base_bins := unicorn unicorn_rails
 bins := $(addprefix bin/, $(base_bins))
 man1_rdoc := $(addsuffix _1, $(base_bins))
 man1_bins := $(addsuffix .1, $(base_bins))
 man1_paths := $(addprefix man/man1/, $(man1_bins))
-rb_files := $(bins) $(shell find lib ext -type f -name '*.rb')
-inst_deps := $(c_files) $(rb_files) GNUmakefile test/test_helper.rb
-
-ragel: $(ext)/unicorn_http.c
-$(ext)/unicorn_http.c: $(rl_files)
-	cd $(@D) && $(RAGEL) unicorn_http.rl -C $(RLFLAGS) -o $(@F)
-$(ext)/Makefile: $(ext)/extconf.rb $(c_files)
-	cd $(@D) && $(RUBY) extconf.rb
-$(ext)/unicorn_http.$(DLEXT): $(ext)/Makefile
-	$(MAKE) -C $(@D)
-http: $(ext)/unicorn_http.$(DLEXT)
+tmp_bins = $(addprefix $(tmp_bin)/, unicorn unicorn_rails)
+pid := $(shell echo $$PPID)
 
-# only used for tests
-http-install: $(ext)/unicorn_http.$(DLEXT)
-	install -m644 $< lib/
+$(tmp_bin)/%: bin/% | $(tmp_bin)
+	$(INSTALL) -m 755 $< $@.$(pid)
+	$(MRI) -i -p -e '$$_.gsub!(%r{^#!.*$$},"#!$(ruby_bin)")' $@.$(pid)
+	mv $@.$(pid) $@
 
-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-install shebang RUBY="$(RUBY)"
-	> $@
-
-# this is only intended to be run within $(test_prefix)
-shebang: $(bins)
-	$(MRI) -i -p -e '$$_.gsub!(%r{^#!.*$$},"#!$(ruby_bin)")' $^
+bins: $(tmp_bins)
 
 t_log := $(T_log) $(T_n_log)
 test: $(T) $(T_n)
@@ -83,15 +92,54 @@ test: $(T) $(T_n)
 
 test-exec: $(wildcard test/exec/test_*.rb)
 test-unit: $(wildcard test/unit/test_*.rb)
-$(slow_tests): $(test_prefix)/.stamp
+$(slow_tests): $(ext_dl)
 	@$(MAKE) $(shell $(awk_slow) $@)
 
 # ensure we can require just the HTTP parser without the rest of unicorn
-test-require: $(ext)/unicorn_http.$(DLEXT)
-	$(RUBY) --disable-gems -I$(ext) -runicorn_http -e Unicorn
+test-require: $(ext_dl)
+	$(RUBY) --disable-gems -I$(ext_pfx)/$(ext) -runicorn_http -e Unicorn
+
+test_prereq := $(tmp_bins) $(ext_dl)
+
+SH_TEST_OPTS =
+ifdef V
+  ifeq ($(V),2)
+    SH_TEST_OPTS += --trace
+  else
+    SH_TEST_OPTS += --verbose
+  endif
+endif
 
-test-integration: $(test_prefix)/.stamp
-	$(MAKE) -C t
+# do we trust Ruby behavior to be stable? some tests are
+# (mostly) POSIX sh (not bash or ksh93, so no "set -o pipefail"
+# TRACER = strace -f -o $(t_pfx).strace -s 100000
+# TRACER = /usr/bin/time -o $(t_pfx).time
+t_pfx = trash/$@-$(RUBY_ENGINE)-$(RUBY_VERSION)
+T_sh = $(wildcard t/t[0-9][0-9][0-9][0-9]-*.sh)
+$(T_sh): export RUBY := $(RUBY)
+$(T_sh): export PATH := $(CURDIR)/$(tmp_bin):$(PATH)
+$(T_sh): export RUBYLIB := $(lib):$(RUBYLIB)
+$(T_sh): dep $(test_prereq) t/random_blob t/trash/.gitignore
+	cd t && $(TRACER) $(SHELL) $(SH_TEST_OPTS) $(@F) $(TEST_OPTS)
+
+t/trash/.gitignore : | t/trash
+	echo '*' >$@
+
+dependencies := socat curl
+deps := $(addprefix t/.dep+,$(dependencies))
+$(deps): dep_bin = $(lastword $(subst +, ,$@))
+$(deps):
+	@which $(dep_bin) > $@.$(pid) 2>/dev/null || :
+	@test -s $@.$(pid) || \
+	  { echo >&2 "E '$(dep_bin)' not found in PATH=$(PATH)"; exit 1; }
+	@mv $@.$(pid) $@
+dep: $(deps)
+
+t/random_blob:
+	dd if=/dev/urandom bs=1M count=30 of=$@.$(pid)
+	mv $@.$(pid) $@
+
+test-integration: $(T_sh)
 
 check: test-require test test-integration
 test-all: check
@@ -122,16 +170,16 @@ 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)/lib:$(MYLIBS)
-%.n: $(test_prefix)/.stamp
+%.n: export PATH := $(CURDIR)/$(tmp_bin):$(PATH)
+%.n: export RUBYLIB := $(lib):$(RUBYLIB)
+%.n: $(test_prereq)
 	$(run_test)
 
 $(T): arg = $@
 $(T): t = $(subst .rb,$(log_suffix),$@)
-$(T): export PATH := $(test_prefix)/bin:$(PATH)
-$(T): export RUBYLIB := $(test_prefix)/lib:$(MYLIBS)
-$(T): $(test_prefix)/.stamp
+$(T): export PATH := $(CURDIR)/$(tmp_bin):$(PATH)
+$(T): export RUBYLIB := $(lib):$(RUBYLIB)
+$(T): $(test_prereq)
 	$(run_test)
 
 install: $(bins) $(ext)/unicorn_http.c
@@ -152,18 +200,16 @@ clean:
 	-$(MAKE) -C $(ext) clean
 	$(RM) $(ext)/Makefile
 	$(RM) $(setup_rb_files) $(t_log)
-	$(RM) -r $(test_prefix) man
-	$(RM) $(man1) $(html1)
+	$(RM) -r $(ext_pfx) man t/trash
+	$(RM) $(html1)
 
 man1 := $(addprefix Documentation/, unicorn.1 unicorn_rails.1)
 html1 := $(addsuffix .html, $(man1))
-man :
-	mkdir -p man/man1
-	install -m 644 $(man1) man/man1
+man : $(man1) | man/man1
+	$(INSTALL) -m 644 $(man1) man/man1
 
-html : $(html1)
-	mkdir -p doc/man1
-	install -m 644 $(html1) doc/man1
+html : $(html1) | doc/man1
+	$(INSTALL) -m 644 $(html1) doc/man1
 
 %.1.html: %.1
 	$(OLDDOC) man2html -o $@ ./$<
@@ -187,10 +233,10 @@ doc: .document $(ext)/unicorn_http.c man html .olddoc.yml $(PLACEHOLDERS)
 	$(OLDDOC) prepare
 	$(RDOC) -f dark216
 	$(OLDDOC) merge
-	install -m644 COPYING doc/COPYING
-	install -m644 NEWS.atom.xml doc/NEWS.atom.xml
-	install -m644 $(shell LC_ALL=C grep '^[A-Z]' .document) doc/
-	install -m644 $(man1_paths) doc/
+	$(INSTALL) -m 644 COPYING doc/COPYING
+	$(INSTALL) -m 644 NEWS.atom.xml doc/NEWS.atom.xml
+	$(INSTALL) -m 644 $(shell LC_ALL=C grep '^[A-Z]' .document) doc/
+	$(INSTALL) -m 644 $(man1_paths) doc/
 	tar cf - $$(git ls-files examples/) | (cd doc && tar xf -)
 
 # publishes docs to https://yhbt.net/unicorn/
@@ -231,9 +277,8 @@ gem: $(pkggem)
 install-gem: $(pkggem)
 	gem install --local $(CURDIR)/$<
 
-$(pkggem): .manifest fix-perms
+$(pkggem): .manifest fix-perms | pkg
 	gem build $(rfpackage).gemspec
-	mkdir -p pkg
 	mv $(@F) $@
 
 $(pkgtgz): distdir = $(basename $@)
@@ -264,5 +309,4 @@ check-warnings:
 	  do $(RUBY) --disable-gems -d -W2 -c \
 	  $$i; done) | grep -v '^Syntax OK$$' || :
 
-.PHONY: .FORCE-GIT-VERSION-FILE doc $(T) $(slow_tests) man
-.PHONY: test-install
+.PHONY: .FORCE-GIT-VERSION-FILE doc $(T) $(slow_tests) man $(T_sh) clean
diff --git a/t/GNUmakefile b/t/GNUmakefile
index 5f5d9bc3..0ac9b9a3 100644
--- a/t/GNUmakefile
+++ b/t/GNUmakefile
@@ -1,74 +1,5 @@
-# we can run tests in parallel with GNU make
+# there used to be more, here, but we stopped relying on recursive make
 all::
+	$(MAKE) -C .. test-integration
 
-pid := $(shell echo $$PPID)
-
-RUBY = ruby
-RAKE = rake
--include ../local.mk
-ifeq ($(RUBY_VERSION),)
-  RUBY_VERSION := $(shell $(RUBY) -e 'puts RUBY_VERSION')
-endif
-
-ifeq ($(RUBY_VERSION),)
-  $(error unable to detect RUBY_VERSION)
-endif
-
-RUBY_ENGINE := $(shell $(RUBY) -e 'puts((RUBY_ENGINE rescue "ruby"))')
-export RUBY_ENGINE
-
-MYLIBS := $(RUBYLIB)
-
-T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
-
-all:: $(T)
-
-# can't rely on "set -o pipefail" since we don't require bash or ksh93 :<
-t_pfx = trash/$@-$(RUBY_ENGINE)-$(RUBY_VERSION)
-TEST_OPTS =
-# TRACER = strace -f -o $(t_pfx).strace -s 100000
-# TRACER = /usr/bin/time -o $(t_pfx).time
-
-ifdef V
-  ifeq ($(V),2)
-    TEST_OPTS += --trace
-  else
-    TEST_OPTS += --verbose
-  endif
-endif
-
-random_blob:
-	dd if=/dev/urandom bs=1M count=30 of=$@.$(pid)
-	mv $@.$(pid) $@
-
-$(T): random_blob
-
-dependencies := socat curl
-deps := $(addprefix .dep+,$(dependencies))
-$(deps): dep_bin = $(lastword $(subst +, ,$@))
-$(deps):
-	@which $(dep_bin) > $@.$(pid) 2>/dev/null || :
-	@test -s $@.$(pid) || \
-	  { echo >&2 "E '$(dep_bin)' not found in PATH=$(PATH)"; exit 1; }
-	@mv $@.$(pid) $@
-dep: $(deps)
-
-test_prefix := $(CURDIR)/../test/$(RUBY_ENGINE)-$(RUBY_VERSION)
-$(test_prefix)/.stamp:
-	$(MAKE) -C .. test-install
-
-$(T): export RUBY := $(RUBY)
-$(T): export RAKE := $(RAKE)
-$(T): export PATH := $(test_prefix)/bin:$(PATH)
-$(T): export RUBYLIB := $(test_prefix)/lib:$(MYLIBS)
-$(T): dep $(test_prefix)/.stamp trash/.gitignore
-	$(TRACER) $(SHELL) $(SH_TEST_OPTS) $@ $(TEST_OPTS)
-
-trash/.gitignore:
-	mkdir -p $(@D)
-	echo '*' > $@
-
-clean:
-	$(RM) -r trash/*
-
-.PHONY: $(T) clean
+.PHONY: all

^ permalink raw reply related	[relevance 12%]

* [PATCH 0/2] minor test improvements
@ 2020-07-26  1:57  6% Eric Wong
  2020-07-26  1:57 12% ` [PATCH 2/2] build: revamp and avoid unnecessary rebuilds Eric Wong
  0 siblings, 1 reply; 89+ results
From: Eric Wong @ 2020-07-26  1:57 UTC (permalink / raw)
  To: unicorn-public

Lightly tested, but seems much better than before w.r.t.
unnecessary rebuilds.

Eric Wong (2):
  test_helper: support TAIL= env for watching tests
  build: revamp and avoid unnecessary rebuilds

 GNUmakefile         | 160 ++++++++++++++++++++++++++++----------------
 t/GNUmakefile       |  75 +--------------------
 test/test_helper.rb |  21 ++++--
 3 files changed, 122 insertions(+), 134 deletions(-)

^ permalink raw reply	[relevance 6%]

* [PATCH] doc: s/bogomips.org/yhbt.net/g
  @ 2020-01-14  7:46  1% ` Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2020-01-14  7:46 UTC (permalink / raw)
  To: unicorn-public

bogomips.org is due to expire, soon, and I'm not willing to pay
extortionist fees to Ethos Capital/PIR/ICANN to keep a .org.  So
it's at yhbt.net, for now, but it will change again to
whatever's affordable...  Identity is overrated.

Tor users can use .onions and kick ICANN to the curb:

	torsocks w3m http://unicorn.ou63pmih66umazou.onion/
	torsocks git clone http://ou63pmih66umazou.onion/unicorn.git/
	torsocks w3m http://ou63pmih66umazou.onion/unicorn-public/

While we're at it, `s/news.gmane.org/news.gmane.io/g', too.
(but I suspect that'll need to be resynched since our mail
"List-Id:" header is changing).
---
 .olddoc.yml                      | 19 ++++++++++++-------
 Documentation/unicorn.1          |  8 ++++----
 Documentation/unicorn_rails.1    |  8 ++++----
 FAQ                              |  2 +-
 GNUmakefile                      |  4 ++--
 HACKING                          |  2 +-
 ISSUES                           | 24 ++++++++++++------------
 KNOWN_ISSUES                     |  4 ++--
 Links                            | 10 +++++-----
 README                           | 12 ++++++------
 SIGNALS                          |  2 +-
 Sandbox                          |  4 ++--
 archive/slrnpull.conf            |  2 +-
 examples/big_app_gc.rb           |  2 +-
 examples/logrotate.conf          |  4 ++--
 examples/nginx.conf              |  2 +-
 examples/unicorn.conf.minimal.rb |  4 ++--
 examples/unicorn.conf.rb         |  4 ++--
 ext/unicorn_http/unicorn_http.rl |  2 +-
 lib/unicorn.rb                   |  2 +-
 lib/unicorn/configurator.rb      |  6 +++---
 lib/unicorn/http_server.rb       |  2 +-
 lib/unicorn/oob_gc.rb            |  4 ++--
 unicorn.gemspec                  |  4 ++--
 24 files changed, 71 insertions(+), 66 deletions(-)

diff --git a/.olddoc.yml b/.olddoc.yml
index d2d340f..0609bdb 100644
--- a/.olddoc.yml
+++ b/.olddoc.yml
@@ -1,8 +1,9 @@
 ---
-cgit_url: https://bogomips.org/unicorn.git
-git_url: https://bogomips.org/unicorn.git
-rdoc_url: https://bogomips.org/unicorn/
-ml_url: https://bogomips.org/unicorn-public/
+cgit_url: https://yhbt.net/unicorn.git
+rdoc_url: https://yhbt.net/unicorn/
+ml_url:
+- https://yhbt.net/unicorn-public/
+- http://ou63pmih66umazou.onion/unicorn-public/
 merge_html:
   unicorn_1: Documentation/unicorn.1.html
   unicorn_rails_1: Documentation/unicorn_rails.1.html
@@ -11,7 +12,11 @@ noindex:
 - LATEST
 - TODO
 - unicorn_rails_1
-public_email: unicorn-public@bogomips.org
+public_email: unicorn-public@yhbt.net
 nntp_url:
-  - nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn
-  - nntp://news.gmane.org/gmane.comp.lang.ruby.unicorn.general
+- nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn
+- nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.unicorn
+- nntp://news.gmane.io/gmane.comp.lang.ruby.unicorn.general
+source_code:
+- git clone https://yhbt.net/unicorn.git
+- torsocks git clone http://ou63pmih66umazou.onion/unicorn.git
diff --git a/Documentation/unicorn.1 b/Documentation/unicorn.1
index 3f8cb96..d76d40f 100644
--- a/Documentation/unicorn.1
+++ b/Documentation/unicorn.1
@@ -154,7 +154,7 @@ TTIN \- increment the number of worker processes by one
 .IP \[bu] 2
 TTOU \- decrement the number of worker processes by one
 .PP
-See the SIGNALS (https://bogomips.org/unicorn/SIGNALS.html) document for
+See the SIGNALS (https://yhbt.net/unicorn/SIGNALS.html) document for
 full description of all signals used by Unicorn.
 .SH RACK ENVIRONMENT
 .PP
@@ -204,11 +204,11 @@ the unicorn config file.
 \f[I]Rack::Builder\f[] ri/RDoc
 .IP \[bu] 2
 \f[I]Unicorn::Configurator\f[] ri/RDoc
-.UR https://bogomips.org/unicorn/Unicorn/Configurator.html
+.UR https://yhbt.net/unicorn/Unicorn/Configurator.html
 .UE
 .IP \[bu] 2
 unicorn RDoc
-.UR https://bogomips.org/unicorn/
+.UR https://yhbt.net/unicorn/
 .UE
 .IP \[bu] 2
 Rack RDoc
@@ -219,4 +219,4 @@ Rackup HowTo
 .UR https://github.com/rack/rack/wiki/(tutorial)-rackup-howto
 .UE
 .SH AUTHORS
-The Unicorn Community <unicorn-public@bogomips.org>.
+The Unicorn Community <unicorn-public@yhbt.net>.
diff --git a/Documentation/unicorn_rails.1 b/Documentation/unicorn_rails.1
index 71c80be..fec0a2a 100644
--- a/Documentation/unicorn_rails.1
+++ b/Documentation/unicorn_rails.1
@@ -180,7 +180,7 @@ TTIN \- increment the number of worker processes by one
 .IP \[bu] 2
 TTOU \- decrement the number of worker processes by one
 .PP
-See the SIGNALS (https://bogomips.org/unicorn/SIGNALS.html) document for
+See the SIGNALS (https://yhbt.net/unicorn/SIGNALS.html) document for
 full description of all signals used by Unicorn.
 .SH SEE ALSO
 .IP \[bu] 2
@@ -189,11 +189,11 @@ unicorn(1)
 \f[I]Rack::Builder\f[] ri/RDoc
 .IP \[bu] 2
 \f[I]Unicorn::Configurator\f[] ri/RDoc
-.UR https://bogomips.org/unicorn/Unicorn/Configurator.html
+.UR https://yhbt.net/unicorn/Unicorn/Configurator.html
 .UE
 .IP \[bu] 2
 unicorn RDoc
-.UR https://bogomips.org/unicorn/
+.UR https://yhbt.net/unicorn/
 .UE
 .IP \[bu] 2
 Rack RDoc
@@ -204,4 +204,4 @@ Rackup HowTo
 .UR https://github.com/rack/rack/wiki/(tutorial)-rackup-howto
 .UE
 .SH AUTHORS
-The Unicorn Community <unicorn-public@bogomips.org>.
+The Unicorn Community <unicorn-public@yhbt.net>.
diff --git a/FAQ b/FAQ
index 4ae2034..018ca92 100644
--- a/FAQ
+++ b/FAQ
@@ -7,7 +7,7 @@ drained entirely by the application.  This may happen when request
 bodies are gzipped, as unicorn reads request body data lazily to avoid
 overhead from bad requests.
 
-Ref: https://bogomips.org/unicorn-public/FC91211E-FD32-432C-92FC-0318714C2170@zendesk.com/
+Ref: https://yhbt.net/unicorn-public/FC91211E-FD32-432C-92FC-0318714C2170@zendesk.com/
 
 === Why aren't my Rails log files rotated when I use SIGUSR1?
 
diff --git a/GNUmakefile b/GNUmakefile
index 94c46ee..eac3473 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -193,13 +193,13 @@ doc: .document $(ext)/unicorn_http.c man html .olddoc.yml $(PLACEHOLDERS)
 	install -m644 $(man1_paths) doc/
 	tar cf - $$(git ls-files examples/) | (cd doc && tar xf -)
 
-# publishes docs to https://bogomips.org/unicorn/
+# publishes docs to https://yhbt.net/unicorn/
 publish_doc:
 	-git set-file-times
 	$(MAKE) doc
 	$(MAKE) doc_gz
 	chmod 644 $$(find doc -type f)
-	$(RSYNC) -av doc/ bogomips.org:/srv/bogomips/unicorn/
+	$(RSYNC) -av doc/ yhbt.net:/srv/yhbt/unicorn/
 	git ls-files | xargs touch
 
 # Create gzip variants of the same timestamp as the original so nginx
diff --git a/HACKING b/HACKING
index be1bb85..976bf92 100644
--- a/HACKING
+++ b/HACKING
@@ -57,7 +57,7 @@ Please wrap documentation at 72 characters-per-line or less (long URLs
 are exempt) so it is comfortably readable from terminals.
 
 When referencing mailing list posts, use
-<tt>https://bogomips.org/unicorn-public/$MESSAGE_ID/</tt> if possible
+<tt>https://yhbt.net/unicorn-public/$MESSAGE_ID/</tt> if possible
 since the Message-ID remains searchable even if a particular site
 becomes unavailable.
 
diff --git a/ISSUES b/ISSUES
index 473da2f..d11dc56 100644
--- a/ISSUES
+++ b/ISSUES
@@ -1,9 +1,9 @@
 = Issues
 
-mailto:unicorn-public@bogomips.org is the best place to report bugs,
+mailto:unicorn-public@yhbt.net is the best place to report bugs,
 submit patches and/or obtain support after you have searched the
-{email archives}[https://bogomips.org/unicorn-public/] and
-{documentation}[https://bogomips.org/unicorn/].
+{email archives}[https://yhbt.net/unicorn-public/] and
+{documentation}[https://yhbt.net/unicorn/].
 
 * No subscription will ever be required to email us
 * Cc: all participants in a thread or commit, as subscription is optional
@@ -12,12 +12,12 @@ submit patches and/or obtain support after you have searched the
 * Do not send HTML mail or images,
   they hurt reader privacy and will be flagged as spam
 * Anonymous and pseudonymous messages will ALWAYS be welcome
-* The email submission port (587) is enabled on the bogomips.org MX:
-  https://bogomips.org/unicorn-public/20141004232241.GA23908@dcvr.yhbt.net/t/
+* The email submission port (587) is enabled on the yhbt.net MX:
+  https://yhbt.net/unicorn-public/20141004232241.GA23908@dcvr.yhbt.net/t/
 
 We will never have a centralized or formal bug tracker.  Instead we
 can interoperate with any bug tracker which can Cc: us plain-text to
-mailto:unicorn-public@bogomips.org   This includes the Debian BTS
+mailto:unicorn-public@yhbt.net   This includes the Debian BTS
 at https://bugs.debian.org/unicorn and possibly others.
 
 If your issue is of a sensitive nature or you're just shy in public,
@@ -73,10 +73,10 @@ document distributed with git) on guidelines for patch submission.
 
 == Contact Info
 
-* public: mailto:unicorn-public@bogomips.org
-* nntp://news.gmane.org/gmane.comp.lang.ruby.unicorn.general
+* public: mailto:unicorn-public@yhbt.net
+* nntp://news.gmane.io/gmane.comp.lang.ruby.unicorn.general
 * nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn
-* https://bogomips.org/unicorn-public/
+* https://yhbt.net/unicorn-public/
 * http://ou63pmih66umazou.onion/unicorn-public/
 
 Mailing list subscription is optional, so Cc: all participants.
@@ -84,13 +84,13 @@ Mailing list subscription is optional, so Cc: all participants.
 You can follow along via NNTP (read-only):
 
 	nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn
-	nntp://news.gmane.org/gmane.comp.lang.ruby.unicorn.general
+	nntp://news.gmane.io/gmane.comp.lang.ruby.unicorn.general
 
 Or Atom feeds:
 
-	https://bogomips.org/unicorn-public/new.atom
+	https://yhbt.net/unicorn-public/new.atom
 	http://ou63pmih66umazou.onion/unicorn-public/new.atom
 
-	The HTML archives at https://bogomips.org/unicorn-public/
+	The HTML archives at https://yhbt.net/unicorn-public/
 	also has links to per-thread Atom feeds and downloadable
 	mboxes.
diff --git a/KNOWN_ISSUES b/KNOWN_ISSUES
index ebd4822..0017f20 100644
--- a/KNOWN_ISSUES
+++ b/KNOWN_ISSUES
@@ -9,7 +9,7 @@ acceptable solution.  Those issues are documented here.
   handlers.
 
 * Issues with FreeBSD jails can be worked around as documented by Tatsuya Ono:
-  https://bogomips.org/unicorn-public/CAHBuKRj09FdxAgzsefJWotexw-7JYZGJMtgUp_dhjPz9VbKD6Q@mail.gmail.com/
+  https://yhbt.net/unicorn-public/CAHBuKRj09FdxAgzsefJWotexw-7JYZGJMtgUp_dhjPz9VbKD6Q@mail.gmail.com/
 
 * PRNGs (pseudo-random number generators) loaded before forking
   (e.g. "preload_app true") may need to have their internal state
@@ -60,7 +60,7 @@ acceptable solution.  Those issues are documented here.
   application to use Rails 2.3.2 and you have no other choice, then
   you may edit your unicorn gemspec and remove the Rack dependency.
 
-  ref: https://bogomips.org/unicorn-public/20091014221552.GA30624@dcvr.yhbt.net/
+  ref: https://yhbt.net/unicorn-public/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.
 
diff --git a/Links b/Links
index 10551a6..f81142d 100644
--- a/Links
+++ b/Links
@@ -2,7 +2,7 @@
 
 If you're interested in unicorn, you may be interested in some of the projects
 listed below.  If you have any links to add/change/remove, please tell us at
-mailto:unicorn-public@bogomips.org!
+mailto:unicorn-public@yhbt.net!
 
 == Disclaimer
 
@@ -23,10 +23,10 @@ or services behind them.
 * {golden_brindle}[https://github.com/simonoff/golden_brindle] - tool to
   manage multiple unicorn instances/applications on a single server
 
-* {raindrops}[https://bogomips.org/raindrops/] - real-time stats for
+* {raindrops}[https://yhbt.net/raindrops/] - real-time stats for
   preforking Rack servers
 
-* {UnXF}[https://bogomips.org/unxf/]  Un-X-Forward* the Rack environment,
+* {UnXF}[https://yhbt.net/unxf/]  Un-X-Forward* the Rack environment,
   useful since unicorn is designed to be deployed behind a reverse proxy.
 
 === unicorn is written to work with
@@ -52,7 +52,7 @@ or services behind them.
 * {Mongrel}[https://rubygems.org/gems/mongrel] - the awesome webserver
   unicorn is based on.  A historical archive of the mongrel dev list
   featuring early discussions of unicorn is available at:
-  https://bogomips.org/mongrel-devel/
+  https://yhbt.net/mongrel-devel/
 
-* {david}[https://bogomips.org/david.git] - a tool to explain why you need
+* {david}[https://yhbt.net/david.git] - a tool to explain why you need
   nginx in front of unicorn
diff --git a/README b/README
index 89467fc..0e95f48 100644
--- a/README
+++ b/README
@@ -80,12 +80,12 @@ You may install it via RubyGems on RubyGems.org:
 You can get the latest source via git from the following locations
 (these versions may not be stable):
 
-  https://bogomips.org/unicorn.git
+  https://yhbt.net/unicorn.git
   https://repo.or.cz/unicorn.git (mirror)
 
 You may browse the code from the web:
 
-* https://bogomips.org/unicorn.git
+* https://yhbt.net/unicorn.git
 * https://repo.or.cz/w/unicorn.git (gitweb)
 
 See the HACKING guide on how to contribute and build prerelease gems
@@ -133,13 +133,13 @@ and libraries which run on top of it.
 
 All feedback (bug reports, user/development dicussion, patches, pull
 requests) go to the mailing list/newsgroup.  See the ISSUES document for
-information on the {mailing list}[mailto:unicorn-public@bogomips.org].
+information on the {mailing list}[mailto:unicorn-public@yhbt.net].
 
-The mailing list is archived at https://bogomips.org/unicorn-public/
+The mailing list is archived at https://yhbt.net/unicorn-public/
 Read-only NNTP access is available at:
 nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn and
-nntp://news.gmane.org/gmane.comp.lang.ruby.unicorn.general
+nntp://news.gmane.io/gmane.comp.lang.ruby.unicorn.general
 
 For the latest on unicorn releases, you may also finger us at
-unicorn@bogomips.org or check our NEWS page (and subscribe to our Atom
+unicorn@yhbt.net or check our NEWS page (and subscribe to our Atom
 feed).
diff --git a/SIGNALS b/SIGNALS
index 1af851d..7321f2b 100644
--- a/SIGNALS
+++ b/SIGNALS
@@ -8,7 +8,7 @@ should be possible to easily share process management scripts between
 Unicorn and nginx.
 
 One example init script is distributed with unicorn:
-https://bogomips.org/unicorn/examples/init.sh
+https://yhbt.net/unicorn/examples/init.sh
 
 === Master Process
 
diff --git a/Sandbox b/Sandbox
index d0f915e..651e5cd 100644
--- a/Sandbox
+++ b/Sandbox
@@ -34,7 +34,7 @@ is the primary issue with sandboxing tools such as Bundler and Isolate.
 If you're bundling unicorn, use "bundle exec unicorn" (or "bundle exec
 unicorn_rails") to start unicorn with the correct environment variables
 
-ref: https://bogomips.org/unicorn-public/9ECF07C4-5216-47BE-961D-AFC0F0C82060@internetfamo.us/
+ref: https://yhbt.net/unicorn-public/9ECF07C4-5216-47BE-961D-AFC0F0C82060@internetfamo.us/
 
 Otherwise (if you choose to not sandbox your unicorn installation), we
 expect the tips for Isolate (below) apply, too.
@@ -44,7 +44,7 @@ expect the tips for Isolate (below) apply, too.
 This is no longer be an issue as of bundler 0.9.17
 
 ref:
-https://bogomips.org/unicorn-public/8FC34B23-5994-41CC-B5AF-7198EF06909E@tramchase.com/
+https://yhbt.net/unicorn-public/8FC34B23-5994-41CC-B5AF-7198EF06909E@tramchase.com/
 
 === BUNDLE_GEMFILE for Capistrano users
 
diff --git a/archive/slrnpull.conf b/archive/slrnpull.conf
index fcfcafe..fd04f97 100644
--- a/archive/slrnpull.conf
+++ b/archive/slrnpull.conf
@@ -1,4 +1,4 @@
 # group_name                         max        expire     headers_only
 gmane.comp.lang.ruby.unicorn.general 1000000000 1000000000 0
 
-# usage: slrnpull -d $PWD -h news.gmane.org --no-post
+# usage: slrnpull -d $PWD -h news.gmane.io --no-post
diff --git a/examples/big_app_gc.rb b/examples/big_app_gc.rb
index 9d05719..c1bae10 100644
--- a/examples/big_app_gc.rb
+++ b/examples/big_app_gc.rb
@@ -1,2 +1,2 @@
-# see {Unicorn::OobGC}[https://bogomips.org/unicorn/Unicorn/OobGC.html]
+# see {Unicorn::OobGC}[https://yhbt.net/unicorn/Unicorn/OobGC.html]
 # Unicorn::OobGC was broken in Unicorn v3.3.1 - v3.6.1 and fixed in v3.6.2
diff --git a/examples/logrotate.conf b/examples/logrotate.conf
index 77a01b5..c3aa40d 100644
--- a/examples/logrotate.conf
+++ b/examples/logrotate.conf
@@ -5,7 +5,7 @@
 #    https://linux.die.net/man/8/logrotate
 #
 # public logrotate-related discussion in our archives:
-#    https://bogomips.org/unicorn-public/?q=logrotate
+#    https://yhbt.net/unicorn-public/?q=logrotate
 
 # Modify the following glob to match the logfiles your app writes to:
 /var/log/unicorn_app/*.log {
@@ -33,7 +33,7 @@
 		systemctl kill -s SIGUSR1 unicorn@2.service
 
 		# Examples for other process management systems appreciated
-		# Mail us at unicorn-public@bogomips.org
+		# Mail us at unicorn-public@yhbt.net
 		# (see above for archives)
 
 		# If you use a pid file and assuming your pid file
diff --git a/examples/nginx.conf b/examples/nginx.conf
index b6b69c1..c5026f9 100644
--- a/examples/nginx.conf
+++ b/examples/nginx.conf
@@ -113,7 +113,7 @@ http {
     # try_files directive appeared in in nginx 0.7.27 and has stabilized
     # over time.  Older versions of nginx (e.g. 0.6.x) requires
     # "if (!-f $request_filename)" which was less efficient:
-    # https://bogomips.org/unicorn.git/tree/examples/nginx.conf?id=v3.3.1#n127
+    # https://yhbt.net/unicorn.git/tree/examples/nginx.conf?id=v3.3.1#n127
     try_files $uri/index.html $uri.html $uri @app;
 
     location @app {
diff --git a/examples/unicorn.conf.minimal.rb b/examples/unicorn.conf.minimal.rb
index 2d1bf0a..46fd634 100644
--- a/examples/unicorn.conf.minimal.rb
+++ b/examples/unicorn.conf.minimal.rb
@@ -1,9 +1,9 @@
 # Minimal sample configuration file for Unicorn (not Rack) when used
 # with daemonization (unicorn -D) started in your working directory.
 #
-# See https://bogomips.org/unicorn/Unicorn/Configurator.html for complete
+# See https://yhbt.net/unicorn/Unicorn/Configurator.html for complete
 # documentation.
-# See also https://bogomips.org/unicorn/examples/unicorn.conf.rb for
+# See also https://yhbt.net/unicorn/examples/unicorn.conf.rb for
 # a more verbose configuration using more features.
 
 listen 2007 # by default Unicorn listens on port 8080
diff --git a/examples/unicorn.conf.rb b/examples/unicorn.conf.rb
index d2897ef..d90bdc4 100644
--- a/examples/unicorn.conf.rb
+++ b/examples/unicorn.conf.rb
@@ -2,10 +2,10 @@
 #
 # This configuration file documents many features of Unicorn
 # that may not be needed for some applications. See
-# https://bogomips.org/unicorn/examples/unicorn.conf.minimal.rb
+# https://yhbt.net/unicorn/examples/unicorn.conf.minimal.rb
 # for a much simpler configuration file.
 #
-# See https://bogomips.org/unicorn/Unicorn/Configurator.html for complete
+# See https://yhbt.net/unicorn/Unicorn/Configurator.html for complete
 # documentation.
 
 # Use at least one worker per core if you're on a dedicated server,
diff --git a/ext/unicorn_http/unicorn_http.rl b/ext/unicorn_http/unicorn_http.rl
index 8ef23bc..dfe3a63 100644
--- a/ext/unicorn_http/unicorn_http.rl
+++ b/ext/unicorn_http/unicorn_http.rl
@@ -487,7 +487,7 @@ static void set_url_scheme(VALUE env, VALUE *server_port)
      * and X-Forwarded-Proto handling from this parser?  We've had it
      * forever and nobody has said anything against it, either.
      * Anyways, please send comments to our public mailing list:
-     * unicorn-public@bogomips.org (no HTML mail, no subscription necessary)
+     * unicorn-public@yhbt.net (no HTML mail, no subscription necessary)
      */
     scheme = rb_hash_aref(env, g_http_x_forwarded_ssl);
     if (!NIL_P(scheme) && STR_CSTR_EQ(scheme, "on")) {
diff --git a/lib/unicorn.rb b/lib/unicorn.rb
index dd5dff4..d5991fe 100644
--- a/lib/unicorn.rb
+++ b/lib/unicorn.rb
@@ -96,7 +96,7 @@ def self.builder(ru, op)
 
   # returns an array of strings representing TCP listen socket addresses
   # and Unix domain socket paths.  This is useful for use with
-  # Raindrops::Middleware under Linux: https://bogomips.org/raindrops/
+  # Raindrops::Middleware under Linux: https://yhbt.net/raindrops/
   def self.listener_names
     Unicorn::HttpServer::LISTENERS.map do |io|
       Unicorn::SocketHelper.sock_name(io)
diff --git a/lib/unicorn/configurator.rb b/lib/unicorn/configurator.rb
index e8b76f5..c3a4f2d 100644
--- a/lib/unicorn/configurator.rb
+++ b/lib/unicorn/configurator.rb
@@ -3,11 +3,11 @@
 
 # Implements a simple DSL for configuring a unicorn server.
 #
-# See https://bogomips.org/unicorn/examples/unicorn.conf.rb and
-# https://bogomips.org/unicorn/examples/unicorn.conf.minimal.rb
+# See https://yhbt.net/unicorn/examples/unicorn.conf.rb and
+# https://yhbt.net/unicorn/examples/unicorn.conf.minimal.rb
 # example configuration files.  An example config file for use with
 # nginx is also available at
-# https://bogomips.org/unicorn/examples/nginx.conf
+# https://yhbt.net/unicorn/examples/nginx.conf
 #
 # See the link:/TUNING.html document for more information on tuning unicorn.
 class Unicorn::Configurator
diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index 5334fa0..a52931a 100644
--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
@@ -6,7 +6,7 @@
 # forked worker children.
 #
 # Users do not need to know the internals of this class, but reading the
-# {source}[https://bogomips.org/unicorn.git/tree/lib/unicorn/http_server.rb]
+# {source}[https://yhbt.net/unicorn.git/tree/lib/unicorn/http_server.rb]
 # is education for programmers wishing to learn how unicorn works.
 # See Unicorn::Configurator for information on how to configure unicorn.
 class Unicorn::HttpServer
diff --git a/lib/unicorn/oob_gc.rb b/lib/unicorn/oob_gc.rb
index c4741a0..3b2f488 100644
--- a/lib/unicorn/oob_gc.rb
+++ b/lib/unicorn/oob_gc.rb
@@ -43,8 +43,8 @@
 #     use Unicorn::OobGC, 2, %r{\A/(?:expensive/foo|more_expensive/foo)}
 #
 # Feedback from users of early implementations of this module:
-# * https://bogomips.org/unicorn-public/0BFC98E9-072B-47EE-9A70-05478C20141B@lukemelia.com/
-# * https://bogomips.org/unicorn-public/AANLkTilUbgdyDv9W1bi-s_W6kq9sOhWfmuYkKLoKGOLj@mail.gmail.com/
+# * https://yhbt.net/unicorn-public/0BFC98E9-072B-47EE-9A70-05478C20141B@lukemelia.com/
+# * https://yhbt.net/unicorn-public/AANLkTilUbgdyDv9W1bi-s_W6kq9sOhWfmuYkKLoKGOLj@mail.gmail.com/
 
 module Unicorn::OobGC
 
diff --git a/unicorn.gemspec b/unicorn.gemspec
index ceea831..a189f8d 100644
--- a/unicorn.gemspec
+++ b/unicorn.gemspec
@@ -15,14 +15,14 @@
   s.authors = ['unicorn hackers']
   s.summary = 'Rack HTTP server for fast clients and Unix'
   s.description = File.read('README').split("\n\n")[1]
-  s.email = %q{unicorn-public@bogomips.org}
+  s.email = %q{unicorn-public@yhbt.net}
   s.executables = %w(unicorn unicorn_rails)
   s.extensions = %w(ext/unicorn_http/extconf.rb)
   s.extra_rdoc_files = IO.readlines('.document').map!(&:chomp!).keep_if do |f|
     File.exist?(f)
   end
   s.files = manifest
-  s.homepage = 'https://bogomips.org/unicorn/'
+  s.homepage = 'https://yhbt.net/unicorn/'
   s.test_files = test_files
 
   # technically we need ">= 1.9.3", too, but avoid the array here since

^ permalink raw reply related	[relevance 1%]

* [ANN] unicorn 5.5.1 - Rack HTTP server for fast clients and
@ 2019-05-06  6:50  5% Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2019-05-06  6:50 UTC (permalink / raw)
  To: ruby-talk, unicorn-public; +Cc: Jeremy Evans, Stan Pitucha, Stephen Demjanenko

unicorn is an HTTP server for Rack applications designed to only serve
fast clients on low-latency, high-bandwidth connections and take
advantage of features in Unix/Unix-like kernels.  Slow clients should
only be served by placing a reverse proxy capable of fully buffering
both the the request and response in between unicorn and slow clients.

Disclaimer:

Due to its ability to tolerate crashes and isolate clients, unicorn
is unfortunately known to prolong the existence of bugs in applications
and libraries which run on top of it.

* https://bogomips.org/unicorn/
* public list: unicorn-public@bogomips.org
* mail archives: https://bogomips.org/unicorn-public/
* git clone https://bogomips.org/unicorn.git
* https://bogomips.org/unicorn/NEWS.atom.xml
* nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn

This release fixes and works around issues from v5.5.0 (2019-03-04)

Stephen Demjanenko worked around a pipe resource accounting bug
present in old Linux kernels.  Linux 3.x users from 3.16.57 and
on are unaffected.  Linux 4.x users from 4.9 and on are
unaffected.

https://bogomips.org/unicorn-public/1556922018-24096-1-git-send-email-sdemjanenko@gmail.com/

Stan Pitucha reported a bug with the old `unicorn_rails' wrapper
(intended for Rails 2.x users) which was promptly fixed by
Jeremy Evans:

https://bogomips.org/unicorn-public/CAJ2_uEPifcv_ux4sX=t0C4zHTHGhqVfcLcSB2kTU3Rb_6pQ3nw@mail.gmail.com/

There's also some doc updates to warn users off `unicorn_rails';
the homepage is now energy-efficient for OLEDs and CRTs;
and I'm no longer advertising mailing list subscriptions
(because I hate centralization and mail archives are the priority)

Eric Wong (3):
      doc: unicorn_rails: clarify that it is intended for rails <= 2.x
      doc: stop advertising mailing list subscription
      doc: switch homepage to dark216

Jeremy Evans (1):
      unicorn_rails: fix regression with Rails >= 3.x in app build

Stephen Demjanenko (1):
      Rescue failed pipe resizes due to permissions

havpbea: orngvat n qrnq ubefr hagvy gur fgvpx trgf fghpx va vg'f fxhyy

^ permalink raw reply	[relevance 5%]

* [PATCH] unicorn_rails: fix regression with Rails >= 3.x in app build
  @ 2019-03-07  2:28 13%           ` Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2019-03-07  2:28 UTC (permalink / raw)
  To: Stan Pitucha, Jeremy Evans; +Cc: unicorn-public

Stan Pitucha <stan.pitucha@envato.com> wrote:
> That was indeed with `preload_app true`.
> 
> The patch you posted fixed the second issue and now both `unicorn` and
> `unicorn_rails` start successfully.

Thanks both.  Pushed out a pre-release with Jeremy's patch:

	gem install --pre unicorn 5.5.0.1.g6836

commit 6836d0674efdb1a6b79953285f10d8edd7e20432

Will tag and release 5.5.1 final in a day or two assuming all
goes well.
------8<-------
From: Jeremy Evans <code@jeremyevans.net>
Subject: [PATCH] unicorn_rails: fix regression with Rails >= 3.x in app build

Note: `unicorn_rails' was only intended for Rails <= 2.x projects
in the old days.

Fixes: 5985dd50a9bd7238 ("Support default_middleware configuration option")

From: Jeremy Evans <code@jeremyevans.net>
  cf. https://bogomips.org/unicorn-public/20190306055734.GC61406@jeremyevans.local/
Signed-off-by: Eric Wong <e@80x24.org>
  [ew: commit message]
---
 bin/unicorn_rails | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bin/unicorn_rails b/bin/unicorn_rails
index ea4f822..354c1df 100755
--- a/bin/unicorn_rails
+++ b/bin/unicorn_rails
@@ -132,11 +132,11 @@ def rails_builder(ru, op, daemonize)
 
   # this lambda won't run until after forking if preload_app is false
   # this runs after config file reloading
-  lambda do ||
+  lambda do |x, server|
     # Rails 3 includes a config.ru, use it if we find it after
     # working_directory is bound.
     ::File.exist?('config.ru') and
-      return Unicorn.builder('config.ru', op).call
+      return Unicorn.builder('config.ru', op).call(x, server)
 
     # Load Rails and (possibly) the private version of Rack it bundles.
     begin
-- 
EW

^ permalink raw reply related	[relevance 13%]

* Re: Bug#918916: Unicorn not reporting proper version for gemfile?
  2019-01-10 20:28  6%   ` Bug#918916: Unicorn not reporting proper version for gemfile? Eric Wong
@ 2019-01-12  9:42  0%     ` Hleb Valoshka
  0 siblings, 0 replies; 89+ results
From: Hleb Valoshka @ 2019-01-12  9:42 UTC (permalink / raw)
  To: 918916; +Cc: Dominik George, Justin Hallett, unicorn-public

On 1/10/19, Eric Wong <e@80x24.org> wrote:
>> +-  s.version = (ENV['VERSION'] || '5.4.1').dup
>> ++  s.version = '5.4.1'
>
> Why is ignoring ENV['VERSION'] necessary for the Debian build?
> I can probably remove that check if desired from the upstream
> package before the 5.5.0 release.

I've checked debian's git, this patch was introduced when
ENV["VERSION"] was required to use the gemspec. Now as the upstream
gemspec provides the same it's not required.

The problem is not in Unicorn. The problem is in gem2deb which
generated incorrect unicorn-0.gemspec for the package.

^ permalink raw reply	[relevance 0%]

* Re: Bug#918916: Unicorn not reporting proper version for gemfile?
       [not found]     ` <20190110200102.GA14520@portux.naturalnet.de>
@ 2019-01-10 20:28  6%   ` Eric Wong
  2019-01-12  9:42  0%     ` Hleb Valoshka
  0 siblings, 1 reply; 89+ results
From: Eric Wong @ 2019-01-10 20:28 UTC (permalink / raw)
  To: Dominik George, 918916; +Cc: Justin Hallett, unicorn-public

(unicorn upstream here, adding unicorn-public to Cc,
 for context: <https://bugs.debian.org/918916> )

Dominik George <natureshadow@debian.org> wrote:
> +--- a/unicorn.gemspec
> ++++ b/unicorn.gemspec
> +@@ -11,7 +11,7 @@ end.compact
> + 
> + Gem::Specification.new do |s|
> +   s.name = %q{unicorn}
> +-  s.version = (ENV['VERSION'] || '5.4.1').dup
> ++  s.version = '5.4.1'

Why is ignoring ENV['VERSION'] necessary for the Debian build?
I can probably remove that check if desired from the upstream
package before the 5.5.0 release.

^ permalink raw reply	[relevance 6%]

* [PATCH] doc: update more URLs to use HTTPS and avoid redirects
@ 2018-11-07 23:38  3% Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2018-11-07 23:38 UTC (permalink / raw)
  To: unicorn-public

Latency from redirects is painful, and HTTPS can protect privacy
in some cases.
---
 .olddoc.yml                       |  2 +-
 Application_Timeouts              |  8 ++++----
 Documentation/unicorn.1.txt       |  2 +-
 Documentation/unicorn_rails.1.txt |  2 +-
 LICENSE                           |  4 ++--
 Links                             | 12 ++++++------
 README                            |  8 ++++----
 Sandbox                           |  4 ++--
 examples/logrotate.conf           |  2 +-
 examples/nginx.conf               |  5 +++--
 lib/unicorn/configurator.rb       |  2 +-
 lib/unicorn/http_request.rb       |  2 +-
 lib/unicorn/http_server.rb        |  2 +-
 lib/unicorn/util.rb               |  2 +-
 t/README                          |  8 ++++----
 15 files changed, 33 insertions(+), 32 deletions(-)

diff --git a/.olddoc.yml b/.olddoc.yml
index cacc0ab..d2d340f 100644
--- a/.olddoc.yml
+++ b/.olddoc.yml
@@ -1,6 +1,6 @@
 ---
 cgit_url: https://bogomips.org/unicorn.git
-git_url: git://bogomips.org/unicorn.git
+git_url: https://bogomips.org/unicorn.git
 rdoc_url: https://bogomips.org/unicorn/
 ml_url: https://bogomips.org/unicorn-public/
 merge_html:
diff --git a/Application_Timeouts b/Application_Timeouts
index 561a1cc..4dcd954 100644
--- a/Application_Timeouts
+++ b/Application_Timeouts
@@ -23,10 +23,10 @@ Most database adapters allow configurable timeouts.
 Net::HTTP and Net::SMTP in the Ruby standard library allow
 configurable timeouts.
 
-Even for things as fast as {memcached}[http://memcached.org/],
-{dalli}[http://rubygems.org/gems/dalli],
-{memcached}[http://rubygems.org/gems/memcached] and
-{memcache-client}[http://rubygems.org/gems/memcache-client] RubyGems all
+Even for things as fast as {memcached}[https://memcached.org/],
+{dalli}[https://rubygems.org/gems/dalli],
+{memcached}[https://rubygems.org/gems/memcached] and
+{memcache-client}[https://rubygems.org/gems/memcache-client] RubyGems all
 offer configurable timeouts.
 
 Consult the relevant documentation for the libraries you use on
diff --git a/Documentation/unicorn.1.txt b/Documentation/unicorn.1.txt
index e692078..da7281d 100644
--- a/Documentation/unicorn.1.txt
+++ b/Documentation/unicorn.1.txt
@@ -182,6 +182,6 @@ the unicorn config file.
 * [Rackup HowTo][3]
 
 [1]: https://bogomips.org/unicorn/
-[2]: http://www.rubydoc.info/github/rack/rack/
+[2]: https://www.rubydoc.info/github/rack/rack/
 [3]: https://github.com/rack/rack/wiki/tutorial-rackup-howto
 [4]: https://bogomips.org/unicorn/SIGNALS.html
diff --git a/Documentation/unicorn_rails.1.txt b/Documentation/unicorn_rails.1.txt
index 088e2ff..fb0e60f 100644
--- a/Documentation/unicorn_rails.1.txt
+++ b/Documentation/unicorn_rails.1.txt
@@ -170,6 +170,6 @@ used by Unicorn.
 * [Rackup HowTo][3]
 
 [1]: https://bogomips.org/unicorn/
-[2]: http://www.rubydoc.info/github/rack/rack/
+[2]: https://www.rubydoc.info/github/rack/rack/
 [3]: https://github.com/rack/rack/wiki/tutorial-rackup-howto
 [4]: https://bogomips.org/unicorn/SIGNALS.html
diff --git a/LICENSE b/LICENSE
index 5b6458e..e986865 100644
--- a/LICENSE
+++ b/LICENSE
@@ -8,8 +8,8 @@ any later version.  We currently prefer the GPLv3 or later for
 derivative works, but the GPLv2 is fine.
 
 The complete texts of the GPLv2 and GPLv3 are below:
-GPLv2 - http://www.gnu.org/licenses/gpl-2.0.txt
-GPLv3 - http://www.gnu.org/licenses/gpl-3.0.txt
+GPLv2 - https://www.gnu.org/licenses/gpl-2.0.txt
+GPLv3 - https://www.gnu.org/licenses/gpl-3.0.txt
 
 You may (against our _preference_) also use the Ruby 1.8 license terms
 which we inherited from the original Mongrel project when we forked it:
diff --git a/Links b/Links
index 475a6c0..baba9c7 100644
--- a/Links
+++ b/Links
@@ -10,7 +10,7 @@ The unicorn project is not responsible for the content in these links.
 Furthermore, the unicorn project has never, does not and will never endorse:
 
 * any for-profit entities or services
-* any non-{Free Software}[http://www.gnu.org/philosophy/free-sw.html]
+* any non-{Free Software}[https://www.gnu.org/philosophy/free-sw.html]
 
 The existence of these links does not imply endorsement of any entities
 or services behind them.
@@ -31,25 +31,25 @@ or services behind them.
 
 === unicorn is written to work with
 
-* {Rack}[http://rack.github.io/] - a minimal interface between webservers
+* {Rack}[https://rack.github.io/] - a minimal interface between webservers
   supporting Ruby and Ruby frameworks
 
 * {Ruby}[https://www.ruby-lang.org/en/] - the programming language of
   Rack and unicorn
 
-* {nginx}[http://nginx.org/] (Free versions) -
+* {nginx}[https://nginx.org/] (Free versions) -
   the reverse proxy for use with unicorn
 
 === Derivatives
 
-* {Green Unicorn}[http://gunicorn.org/] - a Python version of unicorn
+* {Green Unicorn}[https://gunicorn.org/] - a Python version of unicorn
 
-* {Starman}[http://search.cpan.org/dist/Starman/] - Plack/PSGI version
+* {Starman}[https://metacpan.org/release/Starman/] - Plack/PSGI version
   of unicorn
 
 === Prior Work
 
-* {Mongrel}[http://rubygems.org/gems/mongrel] - the awesome webserver
+* {Mongrel}[https://rubygems.org/gems/mongrel] - the awesome webserver
   unicorn is based on
 
 * {david}[https://bogomips.org/david.git] - a tool to explain why you need
diff --git a/README b/README
index 29e04b4..5e5ccf7 100644
--- a/README
+++ b/README
@@ -10,7 +10,7 @@ both the the request and response in between unicorn and slow clients.
 
 * Designed for Rack, Unix, fast clients, and ease-of-debugging.  We
   cut out everything that is better supported by the operating system,
-  {nginx}[http://nginx.org/] or {Rack}[http://rack.github.io/].
+  {nginx}[https://nginx.org/] or {Rack}[https://rack.github.io/].
 
 * Compatible with Ruby 1.9.3 and later.
   unicorn 4.x remains supported for Ruby 1.8 users.
@@ -77,13 +77,13 @@ You may install it via RubyGems on RubyGems.org:
 You can get the latest source via git from the following locations
 (these versions may not be stable):
 
-  git://bogomips.org/unicorn.git
-  git://repo.or.cz/unicorn.git (mirror)
+  https://bogomips.org/unicorn.git
+  https://repo.or.cz/unicorn.git (mirror)
 
 You may browse the code from the web:
 
 * https://bogomips.org/unicorn.git
-* http://repo.or.cz/w/unicorn.git (gitweb)
+* https://repo.or.cz/w/unicorn.git (gitweb)
 
 See the HACKING guide on how to contribute and build prerelease gems
 from git.
diff --git a/Sandbox b/Sandbox
index e10b36d..d0f915e 100644
--- a/Sandbox
+++ b/Sandbox
@@ -3,7 +3,7 @@
 Since unicorn includes executables and is usually used to start a Ruby
 process, there are certain caveats to using it with tools that sandbox
 RubyGems installations such as
-{Bundler}[http://bundler.io/] or
+{Bundler}[https://bundler.io/] or
 {Isolate}[https://github.com/jbarnette/isolate].
 
 == General deployment
@@ -66,7 +66,7 @@ before_exec hook as illustrated by https://gist.github.com/534668
 Ruby 2.0.0 enforces FD_CLOEXEC on file descriptors by default.  unicorn
 has been prepared for this behavior since unicorn 4.1.0, and bundler
 needs the "--keep-file-descriptors" option for "bundle exec":
-http://bundler.io/man/bundle-exec.1.html
+https://bundler.io/man/bundle-exec.1.html
 
 == Isolate
 
diff --git a/examples/logrotate.conf b/examples/logrotate.conf
index 437f6c6..77a01b5 100644
--- a/examples/logrotate.conf
+++ b/examples/logrotate.conf
@@ -2,7 +2,7 @@
 # /etc/logrotate.d/unicorn_app on my Debian systems
 #
 # See the logrotate(8) manpage for more information:
-#    http://linux.die.net/man/8/logrotate
+#    https://linux.die.net/man/8/logrotate
 #
 # public logrotate-related discussion in our archives:
 #    https://bogomips.org/unicorn-public/?q=logrotate
diff --git a/examples/nginx.conf b/examples/nginx.conf
index e25712f..b6b69c1 100644
--- a/examples/nginx.conf
+++ b/examples/nginx.conf
@@ -56,7 +56,8 @@ http {
   # to configure it all in one place here for static files and also
   # to disable gzip for clients who don't get gzip/deflate right.
   # There are other gzip settings that may be needed used to deal with
-  # bad clients out there, see http://wiki.nginx.org/NginxHttpGzipModule
+  # bad clients out there, see
+  # https://nginx.org/en/docs/http/ngx_http_gzip_module.html
   gzip on;
   gzip_http_version 1.0;
   gzip_proxied any;
@@ -117,7 +118,7 @@ http {
 
     location @app {
       # an HTTP header important enough to have its own Wikipedia entry:
-      #   http://en.wikipedia.org/wiki/X-Forwarded-For
+      #   https://en.wikipedia.org/wiki/X-Forwarded-For
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 
       # enable this if you forward HTTPS traffic to unicorn,
diff --git a/lib/unicorn/configurator.rb b/lib/unicorn/configurator.rb
index d426edf..e8b76f5 100644
--- a/lib/unicorn/configurator.rb
+++ b/lib/unicorn/configurator.rb
@@ -238,7 +238,7 @@ def before_exec(*args, &block)
   #      server 192.168.0.9:8080 fail_timeout=0;
   #    }
   #
-  # See http://nginx.org/en/docs/http/ngx_http_upstream_module.html
+  # See https://nginx.org/en/docs/http/ngx_http_upstream_module.html
   # for more details on nginx upstream configuration.
   def timeout(seconds)
     set_int(:timeout, seconds, 3)
diff --git a/lib/unicorn/http_request.rb b/lib/unicorn/http_request.rb
index 8bb884b..bcc1f2d 100644
--- a/lib/unicorn/http_request.rb
+++ b/lib/unicorn/http_request.rb
@@ -65,7 +65,7 @@ def read(socket)
     clear
     e = env
 
-    # From http://www.ietf.org/rfc/rfc3875:
+    # From https://www.ietf.org/rfc/rfc3875:
     # "Script authors should be aware that the REMOTE_ADDR and
     #  REMOTE_HOST meta-variables (see sections 4.1.8 and 4.1.9)
     #  may not identify the ultimate source of the request.  They
diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index 62f6171..5334fa0 100644
--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
@@ -84,7 +84,7 @@ def initialize(app, options = {})
     # * The master process never closes or reinitializes this once
     # initialized.  Signal handlers in the master process will write to
     # it to wake up the master from IO.select in exactly the same manner
-    # djb describes in http://cr.yp.to/docs/selfpipe.html
+    # djb describes in https://cr.yp.to/docs/selfpipe.html
     #
     # * The workers immediately close the pipe they inherit.  See the
     # Unicorn::Worker class for the pipe workers use.
diff --git a/lib/unicorn/util.rb b/lib/unicorn/util.rb
index 501930c..b826de4 100644
--- a/lib/unicorn/util.rb
+++ b/lib/unicorn/util.rb
@@ -64,7 +64,7 @@ def self.reopen_logs
           fp.reopen(fp.path, "a")
         else
           # We should not need this workaround, Ruby can be fixed:
-          #    http://bugs.ruby-lang.org/issues/9036
+          #    https://bugs.ruby-lang.org/issues/9036
           # MRI will not call call fclose(3) or freopen(3) here
           # since there's no associated std{in,out,err} FILE * pointer
           # This should atomically use dup3(2) (or dup2(2)) syscall
diff --git a/t/README b/t/README
index bcaf3ce..0d9b697 100644
--- a/t/README
+++ b/t/README
@@ -10,17 +10,17 @@ comfortable writing integration tests with.
 
 == Requirements
 
-* {Ruby 1.9.3+}[https://www.ruby-lang.org/] (duh!)
-* {GNU make}[http://www.gnu.org/software/make/]
+* {Ruby 1.9.3+}[https://www.ruby-lang.org/en/] (duh!)
+* {GNU make}[https://www.gnu.org/software/make/]
 * {socat}[http://www.dest-unreach.org/socat/]
-* {curl}[http://curl.haxx.se/]
+* {curl}[https://curl.haxx.se/]
 * standard UNIX shell utilities (Bourne sh, awk, sed, grep, ...)
 
 We do not use bashisms or any non-portable, non-POSIX constructs
 in our shell code.  We use the "pipefail" option if available and
 mainly test with {ksh}[http://kornshell.com/], but occasionally
 with {dash}[http://gondor.apana.org.au/~herbert/dash/] and
-{bash}[http://www.gnu.org/software/bash/], too.
+{bash}[https://www.gnu.org/software/bash/], too.
 
 == Running Tests
 
-- 
EW


^ permalink raw reply related	[relevance 3%]

* Re: Random crash when sending USR2 + QUIT signals to Unicorn process
  2017-08-07  6:16  5%                     ` Jeremy Evans
@ 2017-08-07 20:18  0%                       ` Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2017-08-07 20:18 UTC (permalink / raw)
  To: Jeremy Evans
  Cc: Pere Joan Martorell, unicorn-public, Philip Cunningham,
	Jonathan del Strother

Jeremy Evans <code@jeremyevans.net> wrote:
> On 07/24 01:25, Eric Wong wrote:
> > Jeremy Evans <code@jeremyevans.net> wrote:
> > > Running with GC.stress didn't catch the error for me.  But I'm using a
> > > fairly old compiler (GCC 4.2.1, the OpenBSD default), so this may be
> > > something that only shows up on a newer compiler that does more
> > > optimizations.
> > 
> > Pere: just curious if you've had a chance to test my patch for
> > sequel_pg from Jeremy's latest sequel_pg.git
> > 
> > In any case, I'm certain my patch fixes a bug which manifests
> > in a compiler-dependent manner; but here could always be other
> > bugs in a similar vein.  Thanks.
> 
> I can't get it to crash with sequel_pg 1.7.0 when compiled using clang
> 4.0.0 either.  I even tried to build a special program designed to
> trigger the crash.

From anecdotes on ruby-core, clang still seems less aggressive
at optimizations than modern gcc.

Fwiw, a few GC bugs in Ruby trunk got fixed recently and the
fixes should be in 2.4.2 (soon):
https://public-inbox.org/ruby-core/?q=T_NONE+d%3A20161225..20170808

Not identical to T_NODE which Pere got, but if it's a GC bug,
but both T_NONE and T_NODE triggers are symptoms of GC bugs.

^ permalink raw reply	[relevance 0%]

* Re: Random crash when sending USR2 + QUIT signals to Unicorn process
  @ 2017-08-07  6:16  5%                     ` Jeremy Evans
  2017-08-07 20:18  0%                       ` Eric Wong
  0 siblings, 1 reply; 89+ results
From: Jeremy Evans @ 2017-08-07  6:16 UTC (permalink / raw)
  To: Eric Wong
  Cc: Pere Joan Martorell, unicorn-public, Philip Cunningham,
	Jonathan del Strother

On 07/24 01:25, Eric Wong wrote:
> Jeremy Evans <code@jeremyevans.net> wrote:
> > Running with GC.stress didn't catch the error for me.  But I'm using a
> > fairly old compiler (GCC 4.2.1, the OpenBSD default), so this may be
> > something that only shows up on a newer compiler that does more
> > optimizations.
> 
> Pere: just curious if you've had a chance to test my patch for
> sequel_pg from Jeremy's latest sequel_pg.git
> 
> In any case, I'm certain my patch fixes a bug which manifests
> in a compiler-dependent manner; but here could always be other
> bugs in a similar vein.  Thanks.

I can't get it to crash with sequel_pg 1.7.0 when compiled using clang
4.0.0 either.  I even tried to build a special program designed to
trigger the crash.

Compiler used:

$ cc -v
OpenBSD clang version 4.0.0 (tags/RELEASE_400/final) (based on LLVM 4.0.0)
Target: amd64-unknown-openbsd6.1
Thread model: posix
InstalledDir: /usr/bin

Program used:

require 'sequel'
DB = Sequel.postgres(:test=>false)
DB.extension :pg_array
# pg_array.txt contains ([[1] * 100] * 100) in PostgreSQL array format
t = File.read('pg_array.txt')
dot = '.'
trap(:HUP){}
Thread.new do
  while true
    sleep 1
    Process.kill(:HUP, $$)
  end
end
GC.stress = true
(0..2).map do
  Thread.new do
    i = 0
    pr = lambda{|v| print dot if ((i+=1) % 100) == 0; "#{v}#{v}"}
    while true
      print 'L'
      Sequel::Postgres.parse_pg_array(t.dup, pr)
    end
  end
end.map(&:join)

Pere, can you test this program and see if it crashes in your
environment?  If not, can you put together a reproducible example that
does crash in your environment?

Thanks,
Jeremy

^ permalink raw reply	[relevance 5%]

* Re: Random crash when sending USR2 + QUIT signals to Unicorn process
  2017-07-13 19:34  7% ` Eric Wong
@ 2017-07-14 10:21  0%   ` Pere Joan Martorell
    0 siblings, 1 reply; 89+ results
From: Pere Joan Martorell @ 2017-07-14 10:21 UTC (permalink / raw)
  To: Eric Wong; +Cc: unicorn-public, Philip Cunningham, Jonathan del Strother

2017-07-13 21:34 GMT+02:00 Eric Wong <e@80x24.org>:
> +Cc: Philip and Jonathan  since they encountered this three years
> ago, but we never heard back from them:
>
>         https://bogomips.org/unicorn-public/?q=T_NODE+d:..20170713
>
>
> Pere Joan Martorell <pere.joan@camaloon.com> wrote:
>> > /home/deployer/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/unicorn-5.3.0/lib/unicorn/http_request.rb:80:in `parse': method `hash' called on unexpected T_NODE object (0x0055b15b973508 flags=0xaa31b) (NotImplementedError)
>
>> Any idea what is happening?
>
> This is most likely a bug in a C extension not using write
> barriers correctly (perhaps via undocumented C-API functions in
> Ruby).
>
> I don't think I've seen this on ruby-core bug reports in a few years:
>
>         https://public-inbox.org/ruby-core/?q=T_NODE
>
> Fwiw, Appendix D on Generational GC in the Ruby source is
> worth reading to any C extension authors:
>
>         https://80x24.org/mirrors/ruby.git/plain/doc/extension.rdoc
>
> There are probably build warnings when using some dangerous methods/macros,
> maybe you can check build logs for const warnings.
>
>
> Can you share the list of RubyGems you have loaded and maybe try
> upgrading/replacing/eliminating the ones with C extensions
> one-by-one until the error stops?

Thank you very much for your fast reply. I'm not using Bundler to
manage my dependencies, but I checked it and there's not any conflict
between gem versions.
Seems that I solved the issue removing some of the gems. This was my gem list:

    cuba -v 3.8.0
    slim -v 3.0.8
    cutest -v 1.2.3
    rack-test -v 0.6.3
    sequel -v 4.46.0
    pg -v 0.20.0
    shotgun -v 0.9.2
    shield -v 2.1.1
    sequel_pg -v 1.6.19
    unicorn -v 5.3.0
    capistrano-rbenv -v 2.1.1

And I finally removed these gems:

    cutest -v 1.2.3
    rack-test -v 0.6.3
    shotgun -v 0.9.2
    sequel_pg -v 1.6.19

I suspect that the conflicting gem was 'sequel_pg' (sequel_pg
overwrites the inner loop of the Sequel postgres adapter row fetching
code with a C version. The C version is significantly faster than the
pure ruby version that Sequel uses by default), but given I didn't
remove these gems one by one I can't completely ensure that.

If the problem reemerges I'll keep you informed.

Thanks!! :)


>
> Also, perhaps the output of "pmap $PID_OF_WORKER" if you're on
> Linux (or equivalent command if you're on another OS).
>
> Anyways, I didn't notice anything suspicious in your config.
>
> I'll do another self-audit of the unicorn + kgio + raindrops
> extensions, too, but judging from the lack of reports and how
> much they get used; I suspect the bug is elsewhere (more eyes
> welcome, of course).
>
> Thanks for the report and any more info you can provide!

^ permalink raw reply	[relevance 0%]

* Re: Random crash when sending USR2 + QUIT signals to Unicorn process
  @ 2017-07-13 19:34  7% ` Eric Wong
  2017-07-14 10:21  0%   ` Pere Joan Martorell
  0 siblings, 1 reply; 89+ results
From: Eric Wong @ 2017-07-13 19:34 UTC (permalink / raw)
  To: Pere Joan Martorell
  Cc: unicorn-public, Philip Cunningham, Jonathan del Strother

+Cc: Philip and Jonathan  since they encountered this three years
ago, but we never heard back from them:

	https://bogomips.org/unicorn-public/?q=T_NODE+d:..20170713


Pere Joan Martorell <pere.joan@camaloon.com> wrote:
> > /home/deployer/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/unicorn-5.3.0/lib/unicorn/http_request.rb:80:in `parse': method `hash' called on unexpected T_NODE object (0x0055b15b973508 flags=0xaa31b) (NotImplementedError)

> Any idea what is happening?

This is most likely a bug in a C extension not using write
barriers correctly (perhaps via undocumented C-API functions in
Ruby).

I don't think I've seen this on ruby-core bug reports in a few years:

	https://public-inbox.org/ruby-core/?q=T_NODE

Fwiw, Appendix D on Generational GC in the Ruby source is
worth reading to any C extension authors:

	https://80x24.org/mirrors/ruby.git/plain/doc/extension.rdoc

There are probably build warnings when using some dangerous methods/macros,
maybe you can check build logs for const warnings.


Can you share the list of RubyGems you have loaded and maybe try
upgrading/replacing/eliminating the ones with C extensions
one-by-one until the error stops?

Also, perhaps the output of "pmap $PID_OF_WORKER" if you're on
Linux (or equivalent command if you're on another OS).

Anyways, I didn't notice anything suspicious in your config.

I'll do another self-audit of the unicorn + kgio + raindrops
extensions, too, but judging from the lack of reports and how
much they get used; I suspect the bug is elsewhere (more eyes
welcome, of course).

Thanks for the report and any more info you can provide!

^ permalink raw reply	[relevance 7%]

* [ANN] unicorn 5.3.0 - Rack HTTP server for fast clients and Unix
@ 2017-04-01  8:08  3% Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2017-04-01  8:08 UTC (permalink / raw)
  To: ruby-talk, unicorn-public
  Cc: Jeremy Evans, Simon Eskildsen, Dylan Thacker-Smith

unicorn is an HTTP server for Rack applications designed to only serve
fast clients on low-latency, high-bandwidth connections and take
advantage of features in Unix/Unix-like kernels.  Slow clients should
only be served by placing a reverse proxy capable of fully buffering
both the the request and response in between unicorn and slow clients.

* https://bogomips.org/unicorn/
* public list: unicorn-public@bogomips.org
* mail archives: https://bogomips.org/unicorn-public/
* git clone git://bogomips.org/unicorn.git
* https://bogomips.org/unicorn/NEWS.atom.xml
* nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn

Changes:

unicorn 5.3.0

A couple of portability fixes from Dylan Thacker-Smith and
Jeremy Evans since 5.3.0.pre1 over a week ago, but this looks
ready for a stable release, today.

When I started this over 8 years ago, I wondered if this would
just end up being an April Fools' joke.  Guess not.  I guess I
somehow tricked people into using a terribly marketed web server
that cannot talk directly to untrusted clients :x  Anyways,
unicorn won't be able to handle slow clients 8 years from now,
either, or 80 years from now.  And I vow never to learn to use
new-fangled things like epoll, kqueue, or threads :P

Anyways, this is a largish release with several new features,
and no backwards incompatibilities.

Simon Eskildsen contributed heavily using TCP_INFO under Linux
to implement the (now 5 year old) check_client_connection feature:

  https://bogomips.org/unicorn/Unicorn/Configurator.html#method-i-check_client_connection
  https://bogomips.org/unicorn-public/?q=s:check_client_connection&d:..20170401&x=t

This also led to FreeBSD and OpenBSD portability improvements in
one of our dependencies, raindrops:

   https://bogomips.org/raindrops-public/20170323024829.GA5190@dcvr/T/#u

Jeremy Evans contributed several new features.  First he
implemented after_worker_exit to aid debugging:

  https://bogomips.org/unicorn/Unicorn/Configurator.html#method-i-after_worker_exit
  https://bogomips.org/unicorn-public/?q=s:after_worker_exit&d:..20170401&x=t#t

And then security-related features to isolate workers.  Workers
may now chroot to drop access to the master filesystem, and the
new after_worker_ready configuration hook now exists to aid with
chroot support in workers:

  https://bogomips.org/unicorn/Unicorn/Configurator.html#method-i-after_worker_ready
  https://bogomips.org/unicorn/Unicorn/Worker.html#method-i-user
  https://bogomips.org/unicorn-public/?q=s:after_worker_ready&d:..20170401&x=t#t
  https://bogomips.org/unicorn-public/?q=s:chroot&d:..20170401&x=t#t

Additionally, workers may run in a completely different VM space
(nullifying preload_app and any CoW savings) with the new
worker_exec option:

  https://bogomips.org/unicorn/Unicorn/Configurator.html#method-i-worker_exec
  https://bogomips.org/unicorn-public/?q=s:worker_exec&d:..20170401&x=t#t

There are also several improvements to FreeBSD and OpenBSD
support with the addition of these features.

shortlog of changes since v5.2.0 (2016-10-31):

Dylan Thacker-Smith (1):
      Check for Socket::TCP_INFO constant before trying to get TCP_INFO

Eric Wong (30):
      drop rb_str_set_len compatibility replacement
      TUNING: document THP caveat for Linux users
      tee_input: simplify condition for IO#write
      remove response_start_sent
      http_request: freeze constant strings passed IO#write
      Revert "remove response_start_sent"
      t/t0012-reload-empty-config.sh: access ivars directly if needed
      t0011-active-unix-socket.sh: fix race condition in test
      new test for check_client_connection
      revert signature change to HttpServer#process_client
      support "struct tcp_info" on non-Linux and Ruby 2.2+
      unicorn_http: reduce rb_global_variable calls
      oob_gc: rely on opt_aref_with optimization on Ruby 2.2+
      http_request: reduce insn size for check_client_connection
      freebsd: avoid EINVAL when setting accept filter
      test-lib: expr(1) portability fix
      tests: keep disabled tests defined
      test_exec: SO_KEEPALIVE value only needs to be true
      doc: fix links to raindrops project
      http_request: support proposed Raindrops::TCP states on non-Linux
      ISSUES: expand on mail archive info + subscription disclaimer
      test_ccc: use a pipe to synchronize test
      doc: remove private email support address
      input: update documentation and hide internals.
      http_server: initialize @pid ivar
      gemspec: remove olddoc from build dependency
      doc: add version annotations for new features
      unicorn 5.3.0.pre1
      doc: note after_worker_exit is also 5.3.0+
      test_exec: SO_KEEPALIVE value only needs to be true (take #2)

Jeremy Evans (7):
      Add after_worker_exit configuration option
      Fix code example in after_worker_exit documentation
      Add support for chroot to Worker#user
      Add after_worker_ready configuration option
      Add worker_exec configuration option
      Don't pass a block for fork when forking workers
      Check for SocketError on first ccc attempt

Simon Eskildsen (1):
      check_client_connection: use tcp state on linux

-- 
Yes, this release is real despite the date.

^ permalink raw reply	[relevance 3%]

* [ANN] unicorn 5.3.0.pre1 - Rack HTTP server for fast clients and Unix
@ 2017-03-24  0:28  4% Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2017-03-24  0:28 UTC (permalink / raw)
  To: ruby-talk, unicorn-public; +Cc: Jeremy Evans, Simon Eskildsen

unicorn is an HTTP server for Rack applications designed to only serve
fast clients on low-latency, high-bandwidth connections and take
advantage of features in Unix/Unix-like kernels.  Slow clients should
only be served by placing a reverse proxy capable of fully buffering
both the the request and response in between unicorn and slow clients.

* https://bogomips.org/unicorn/
* public list: unicorn-public@bogomips.org
* mail archives: https://bogomips.org/unicorn-public/
* git clone git://bogomips.org/unicorn.git
* https://bogomips.org/unicorn/NEWS.atom.xml
* nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn

This is a pre-release RubyGem intended for testing.

Changes:

unicorn 5.3.0.pre1

A largish release with several new features.

Simon Eskildsen contributed heavily using TCP_INFO under Linux
to implement the (now 5 year old) check_client_connection feature:

  https://bogomips.org/unicorn/Unicorn/Configurator.html#method-i-check_client_connection
  https://bogomips.org/unicorn-public/?q=s:check_client_connection&d:..20170324&x=t

This also led to FreeBSD and OpenBSD portability improvements in
one of our dependencies, raindrops:

  https://bogomips.org/raindrops-public/20170323024829.GA5190@dcvr/T/#u

Jeremy Evans contributed several new features.  First he
implemented after_worker_exit to aid debugging:

  https://bogomips.org/unicorn/Unicorn/Configurator.html#method-i-after_worker_exit
  https://bogomips.org/unicorn-public/?q=s:after_worker_exit&d:..20170324&x=t#t

And then security-related features to isolate workers.  Workers
may now chroot to drop access to the master filesystem, and the
new after_worker_ready configuration hook now exists to aid with
chroot support in workers:

  https://bogomips.org/unicorn/Unicorn/Configurator.html#method-i-after_worker_ready
  https://bogomips.org/unicorn/Unicorn/Worker.html#method-i-user
  https://bogomips.org/unicorn-public/?q=s:after_worker_ready&d:..20170324&x=t#t
  https://bogomips.org/unicorn-public/?q=s:chroot&d:..20170324&x=t#t

Additionally, workers may run in a completely different VM space
(nullifying preload_app and any CoW savings) with the new
worker_exec option:

  https://bogomips.org/unicorn/Unicorn/Configurator.html#method-i-worker_exec
  https://bogomips.org/unicorn-public/?q=s:worker_exec&d:..20170324&x=t#t

There are also several improvements to FreeBSD and OpenBSD
support with the addition of these features.

34 changes since 5.2.0 (2016-10-31):

Eric Wong (27):
      drop rb_str_set_len compatibility replacement
      TUNING: document THP caveat for Linux users
      tee_input: simplify condition for IO#write
      remove response_start_sent
      http_request: freeze constant strings passed IO#write
      Revert "remove response_start_sent"
      t/t0012-reload-empty-config.sh: access ivars directly if needed
      t0011-active-unix-socket.sh: fix race condition in test
      new test for check_client_connection
      revert signature change to HttpServer#process_client
      support "struct tcp_info" on non-Linux and Ruby 2.2+
      unicorn_http: reduce rb_global_variable calls
      oob_gc: rely on opt_aref_with optimization on Ruby 2.2+
      http_request: reduce insn size for check_client_connection
      freebsd: avoid EINVAL when setting accept filter
      test-lib: expr(1) portability fix
      tests: keep disabled tests defined
      test_exec: SO_KEEPALIVE value only needs to be true
      doc: fix links to raindrops project
      http_request: support proposed Raindrops::TCP states on non-Linux
      ISSUES: expand on mail archive info + subscription disclaimer
      test_ccc: use a pipe to synchronize test
      doc: remove private email support address
      input: update documentation and hide internals.
      http_server: initialize @pid ivar
      gemspec: remove olddoc from build dependency
      doc: add version annotations for new features

Jeremy Evans (6):
      Add after_worker_exit configuration option
      Fix code example in after_worker_exit documentation
      Add support for chroot to Worker#user
      Add after_worker_ready configuration option
      Add worker_exec configuration option
      Don't pass a block for fork when forking workers

Simon Eskildsen (1):
      check_client_connection: use tcp state on linux

-- 
5.3.0 in a week, maybe?

^ permalink raw reply	[relevance 4%]

* [PATCH] gemspec: remove olddoc from build dependency
  2016-11-03 15:46  9%     ` Pirate Praveen
@ 2017-03-23 23:34 21%       ` Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2017-03-23 23:34 UTC (permalink / raw)
  To: Pirate Praveen; +Cc: Hleb Valoshka, debian-ruby, unicorn-public

Pirate Praveen <praveen@onenetbeyond.org> wrote:
> If you can make it optional that would be great. For now I've just
> patched out the gemspec to not use olddoc. The patch and fix in rules is
> ugly.

Pushed the following to "master" of git://bogomips.org/unicorn

-----8<----
Subject: [PATCH] gemspec: remove olddoc from build dependency

It's a little less DRY, and there'll be no NEWS file generated,
but it's one less thing to install, so perhaps that's worth it.
The website at https://bogomips.org/unicorn/ will continue
to use olddoc, of course,
---
 HACKING         |  1 -
 unicorn.gemspec | 22 ++++++++++------------
 2 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/HACKING b/HACKING
index d55f1c7..be1bb85 100644
--- a/HACKING
+++ b/HACKING
@@ -104,7 +104,6 @@ don't email the git mailing list or maintainer with Unicorn patches :)
 
 In order to build the gem, you must install the following components:
 
- * olddoc (RubyGem)
  * pandoc
 
 You can build the Unicorn gem with the following command:
diff --git a/unicorn.gemspec b/unicorn.gemspec
index cf65aef..6dc0086 100644
--- a/unicorn.gemspec
+++ b/unicorn.gemspec
@@ -1,9 +1,6 @@
 # -*- encoding: binary -*-
-ENV["VERSION"] or abort "VERSION= must be specified"
-manifest = File.readlines('.manifest').map! { |x| x.chomp! }
-require 'olddoc'
-extend Olddoc::Gemspec
-name, summary, title = readme_metadata
+manifest = File.exist?('.manifest') ?
+  IO.readlines('.manifest').map!(&:chomp!) : `git ls-files`.split("\n")
 
 # don't bother with tests that fork, not worth our time to get working
 # with `gem check -t` ... (of course we care for them when testing with
@@ -14,16 +11,18 @@
 
 Gem::Specification.new do |s|
   s.name = %q{unicorn}
-  s.version = ENV["VERSION"].dup
-  s.authors = ["#{name} hackers"]
-  s.summary = summary
-  s.description = readme_description
+  s.version = (ENV['VERSION'] || '5.2.0').dup
+  s.authors = ['unicorn hackers']
+  s.summary = 'Rack HTTP server for fast clients and Unix'
+  s.description = File.read('README').split("\n\n")[1]
   s.email = %q{unicorn-public@bogomips.org}
   s.executables = %w(unicorn unicorn_rails)
   s.extensions = %w(ext/unicorn_http/extconf.rb)
-  s.extra_rdoc_files = extra_rdoc_files(manifest)
+  s.extra_rdoc_files = IO.readlines('.document').map!(&:chomp!).keep_if do |f|
+    File.exist?(f)
+  end
   s.files = manifest
-  s.homepage = Olddoc.config['rdoc_url']
+  s.homepage = 'https://bogomips.org/unicorn/'
   s.test_files = test_files
 
   # technically we need ">= 1.9.3", too, but avoid the array here since
@@ -40,7 +39,6 @@
   s.add_dependency(%q<raindrops>, '~> 0.7')
 
   s.add_development_dependency('test-unit', '~> 3.0')
-  s.add_development_dependency('olddoc', '~> 1.2')
 
   # Note: To avoid ambiguity, we intentionally avoid the SPDX-compatible
   # 'Ruby' here since Ruby 1.9.3 switched to BSD-2-Clause, but we
-- 
EW

^ permalink raw reply related	[relevance 21%]

* [ANN] raindrops 0.18.0 - real-time stats for preforking Rack servers
@ 2017-03-23  2:48  4% Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2017-03-23  2:48 UTC (permalink / raw)
  To: ruby-talk, raindrops-public; +Cc: unicorn-public, Simon Eskildsen, Jeremy Evans

raindrops is a real-time stats toolkit to show statistics for Rack HTTP
servers.  It is designed for preforking servers such as unicorn, but
should support any Rack HTTP server on platforms supporting POSIX shared
memory.  It may also be used as a generic scoreboard for sharing atomic
counters across multiple processes.

* https://bogomips.org/raindrops/
* No subscription necessary, no HTML mail:
  raindrops-public@bogomips.org
* mail archives: https://bogomips.org/raindrops-public/
  http://ou63pmih66umazou.onion/raindrops-public/
  nntp://news.public-inbox.org/inbox.comp.lang.ruby.raindrops
  nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.raindrops
* git clone git://bogomips.org/raindrops.git
* https://bogomips.org/raindrops/NEWS.atom.xml
* Demo site: https://raindrops-demo.bogomips.org:8443/

Changes:

    raindrops 0.18.0
    
    The most notable feature of this release is the addition of
    FreeBSD and OpenBSD TCP_INFO support.  This includes the
    Raindrops::TCP for portably mapping TCP state names to
    platform-dependent numeric values:
    
      https://bogomips.org/raindrops/Raindrops.html#TCP
    
    Thanks to Jeremy Evans and Simon Eskildsen on the
    unicorn-public@bogomips.org mailing list for inspiring
    these changes to raindrops.
    
    There's also a few internal cleanups, and documentation
    improvements, including some fixes to the largely-forgotten
    Raindrops::Aggreage::PMQ class:
    
      https://bogomips.org/raindrops/Raindrops/Aggregate/PMQ.html
    
    20 changes since 0.17.0:
    
          test_inet_diag_socket: fix Fixnum deprecation warning
          TODO: add item for IPv6 breakage
          ext: fix documentation for C ext-defined classes
          TCP_Info: custom documentation for #get!
          TypedData C-API conversion
          test_watcher: disable test correctly when aggregate is missing
          tcp_info: support this struct under FreeBSD
          define Raindrops::TCP hash for TCP states
          linux_inet_diag: reduce stack usage and simplify
          avoid reading errno repeatedly
          aggregate/pmq: avoid false sharing of lock buffers
          aggregate/pmq: remove io-extra requirement
          aggregate/pmq: avoid File#stat allocation
          Merge remote-tracking branch 'origin/freebsd'
          Merge remote-tracking branch 'origin/aggregate-pmq'
          doc: remove private email support address
          doc: update location of TCP_INFO-related stuff
          build: avoid olddoc for building the RubyGem
          doc: document Raindrops::TCP hash
          aggregate/pmq: update version numbers for Ruby and Linux

^ permalink raw reply	[relevance 4%]

* Re: WTF is up with memory usage nowadays?
  2016-12-12  2:10  3% WTF is up with memory usage nowadays? Eric Wong
  2016-12-12  4:05  0% ` Sam Saffron
  2016-12-12  9:49  5% ` hukl
@ 2017-02-08 20:00  0% ` Eric Wong
  2 siblings, 0 replies; 89+ results
From: Eric Wong @ 2017-02-08 20:00 UTC (permalink / raw)
  To: unicorn-public

Eric Wong <e@80x24.org> wrote:
>   The Rack response body only needs to respond to #each.
>   There should be no reason to build giant response
>   documents in memory before sending them to a client.
> 
>   unicorn can't do the following for you automatically since
>   we don't know how/if a Rack app will reuse a string;
>   but upstack authors can String#clear after yielding
>   in #each to ensure any malloced heap memory is immediately
>   available for future use (but beware of downstream middlewares
>   which do not expect this, too(**)):
> 
>     def each
>       # .. do something to generate a giant string
>       yield giant_string

... The yield above is so unicorn (or any server) can call
IO#write or similar (send(,_nonblock), write_nonblock, etc...).

That means once IO#write is complete, the contents of the string
is shipped off to the OS TCP stack and Ruby can forget about it:

>       giant_string.clear # String#clear
>     end

However, this is largely ineffective since Ruby 2.0.0 - 2.4.0
has a thread-safety fix which causes excessive garbage:

https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=34847
https://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/io.c?r1=34847&r2=34846&pathrev=34847

And it looks like that went unnoticed for a few years...
Shame on all of us! :<

Anyways, it looks like an acceptable fix finally got accepted
for Ruby 2.5 (December 2017): https://bugs.ruby-lang.org/issues/13085

I've considered backporting a workaround into unicorn; but I'm
leaning against it since most apps do not recycle buffers at the
moment, so they make a lot of garbage, anyways.

Another place unicorn uses IO#write is buffering large files in
the TeeInput class; but I'm not sure if enough people care about
large uploads.  Embarrassingly, most of the large I/O apps I
maintain are still on 1.9.3, so I did not notice it :x
In any case, anybody running an up-to-date trunk or willing
to wait until Ruby 2.5 won't have to worry or think about this.


But yeah, all of this means there's still a both a runtime and
code complexity cost for supporting 1:1 native threads (at least
the way MRI does it).  This cost is there regardless of whether
or not the code you run uses threads.

^ permalink raw reply	[relevance 0%]

* Re: WTF is up with memory usage nowadays?
  2016-12-12  2:10  3% WTF is up with memory usage nowadays? Eric Wong
  2016-12-12  4:05  0% ` Sam Saffron
@ 2016-12-12  9:49  5% ` hukl
  2017-02-08 20:00  0% ` Eric Wong
  2 siblings, 0 replies; 89+ results
From: hukl @ 2016-12-12  9:49 UTC (permalink / raw)
  To: unicorn-public

I agree with most of what you've written. I drew my conclusions a while 
ago and switched to using Erlang (not Elixir!) for all my backend jobs 
in the past couple of years. In a way it is a more constraint / 
restricted environment. There are less libraries and frameworks 
available and the language itself is smaller in terms of available 
constructs, ways of doing things and how dynamic it feels. But I like 
the constraints. A small language is easier to reason about especially 
if there are not 23 different ways of assigning a value to a variable etc.

Looking back at my Ruby times I often feel like that Ruby was not 
created with the intention to become a universal, high performance 
backend programming language and its amazing that still it got that far. 
Unicorn was one of the big steps enabling us to build somewhat large 
scale backend and that was a big help.

However it feels like people keep putting lipstick on a pig, hoping that 
eventually it will become a shiny, metallic, high performance backend 
programming environment. But it will always remain a pig … or Ruby - no 
matter how many layers of lipstick or abstractions you put on it - and 
in Rubyland people love adding more layers :)

I'm happy with Erlang now because it feels much more designed for the 
task and it has a very interesting and practical mix of design decisions.

What you've described is not an isolated Ruby problem of course as the 
general trend is always towards more abstractions than less, but I guess 
its a little amplified in this particular eco system.

Coming back to what I initially wrote:

I agree with most of what you've written, I just came to a different 
conclusion which is basically giving up the constraint or desire to keep 
programming in Ruby. (But I'm still reading this mailing list ;) )

~ John











Eric Wong wrote:
> <rant>  Came across this in my feeds today:
>
> https://about.gitlab.com/2016/12/11/proposed-server-purchase-for-gitlab-com/
>
> ... Yeah, they cite 0.5 GB of memory usage per unicorn worker.
> I guess this is typical nowadays, but damn, it sucks :<
>
> This is not the future I had in mind or ever wanted unicorn to
> be associated with back in 2009 when I started.
>
> I don't think it's the fault of unicorn itself; unicorn recycles
> request buffers, uses pre-frozen hash keys, and even
> uses String#clear nowadays to discard heap memory, and never
> buffers more than it has to.
>
> Since day one, unicorn was built to handle multi-gigabyte
> uploads and responses; even from a crappy 256MB laptop.
> "curl -T-" is my co-pilot :)
>
>
> So... I guess the problem is up the stack in the app or
> framework.  Maybe Rails?  *shrug*  I don't use that anymore...
>
> I remember using Rails over a decade ago and being shocked at
> 50MB (yes, fifty megabytes) of RSS usage.  This was on 32-bit,
> but even in the worst case on 64-bit, it would be 100MB.
> Of course, nowadays Rails has grown to the point where I'm
> afraid to go near it; instead I work directly off Rack.
>
> And yes, I still freak out nowadays when my Rack processes
> exceed 100MB...
>
>
> So, what can and should we do about it?
>
> * First step: Limit ourselves.
>
>    Use slower, older hardware, slower Internet connection so you
>    force yourself to eke out every bit of performance out of
>    what you have.
>
>    It's utterly hilarious for me to hear about people complain
>    about laptops which can "only" have 16GB RAM.
>
>    I've definitely made transgressions in the past, and the worst
>    code I've written was on powerful hardware.
>
>
> Disclaimer: Some of the following may not be very Ruby-ish :P
> And everything else is optional and the result of the first step
> above.
>
> * Recycle.  Don't waste object slots: {Array,Hash,String}#clear
>    can allow you to recycle heap memory for large objects
>    and minimize GC pressure.  Using thread-local variables
>    in your app helps maintain compatibility with multi-threaded
>    Rack servers; or perhaps go Rack env-local for compatibility
>    with single-threaded non-blocking servers.
>
>
> * Can't recycle?  Discard objects you don't need, ASAP,
>    and continue #clear-ing what you can. Take advantage
>    of streaming built into Rack.
>
>    The Rack response body only needs to respond to #each.
>    There should be no reason to build giant response
>    documents in memory before sending them to a client.
>
>    unicorn can't do the following for you automatically since
>    we don't know how/if a Rack app will reuse a string;
>    but upstack authors can String#clear after yielding
>    in #each to ensure any malloced heap memory is immediately
>    available for future use (but beware of downstream middlewares
>    which do not expect this, too(**)):
>
>      def each
>        # .. do something to generate a giant string
>        yield giant_string
>        giant_string.clear # String#clear
>      end
>
>    A Rack response body may also respond to #close; it can
>    be used to explicitly release any response-local resources.
>    Rack::TempfileReaper + Rack::BodyProxy is an example of
>    this for Tempfiles.
>
>    Smaller functions and smaller code helps keep this manageable.
>
> * Avoid slurping.  Large datasets do not need everything up
>    front.  For example, threading 10K messages entirely
>    in memory is no problem: just don't load entire messages
>    into memory up front, only what you need.
>    JWZ's algorithm was doing this in the 90s:
>    https://www.jwz.org/doc/threading.html
>
> Disclaimer: Some of these things may hurt throughput and
> performance in benchmarks, especially with smaller datasets;
> but I consider predictable and consistent performance more
> far more important than burst throughput.
>
>
> ** Know your entire stack; top to bottom.
>     You ought to be able to track every single line of code
>     in a high-level Rack app you maintain down through each
>     and every layer of framework, middleware, Rack server,
>     Ruby VM, C library, down to the OS kernel.
>
>     Yes, this limits you to using smaller and simpler stacks :P
>
>
> *** Why stick with Ruby if you care about memory usage?
>
> I'm too impatient to wait on compilers, and don't like the extra
> storage of binaries.  Scripting languages forces authors to
> distribute (hopefully non-obfuscated) code; reducing network and
> storage costs, and that also lowers the barrier from user to
> hacker.  Fwiw, I actually prefer Perl5 with the predictability
> (and caveats of) refcounting over a GC like Ruby's.
>
> </rant>
> --
> unsubscribe: unicorn-public+unsubscribe@bogomips.org
> archive: https://bogomips.org/unicorn-public/
>

^ permalink raw reply	[relevance 5%]

* Re: WTF is up with memory usage nowadays?
  2016-12-12  2:10  3% WTF is up with memory usage nowadays? Eric Wong
@ 2016-12-12  4:05  0% ` Sam Saffron
  2016-12-12  9:49  5% ` hukl
  2017-02-08 20:00  0% ` Eric Wong
  2 siblings, 0 replies; 89+ results
From: Sam Saffron @ 2016-12-12  4:05 UTC (permalink / raw)
  To: unicorn-public

As to who is at fault here, it is a little bit of "everyone" in a big bucket.

- The new GC is far more memory hungry than 1.9 line, even with
`RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.5` it is still a lot more space
than it used to

- Ruby have been very slow at dealing with the "elephant in the room"
which is larger processes, stuff like
https://bugs.ruby-lang.org/issues/12967 goes ignored and is sadly
unlikely to happen for upcoming release

- The current focus for "Ruby" is 3x3 (ruby 3 being 3 times faster)
... there is no focus on reducing memory usage

- Most people use default c memory allocator, despite tcmalloc
offering quite a decent win
https://github.com/SamSaffron/allocator_bench

- mime types gem is a pariah... apparently EVERY install of rails
needs to hold 46 megabytes of mime types in memory cause ... I don't
know why ... (even with 'mime/types/columnar')

- Booting a rails app eats up half a million slots in your ruby heaps,
clearly the vast majority of this is unneeded waste. Stuff like
keeping the string "MIT" in memory 125 times forever cause "rubygems",
jumps out.  There is zero focus anywhere to fix this issue.

- Ruby heaps grow too fast, even if you put on the breaks, it is hard
to diagnose how you reached 7000 heaps at runtime when 6000 of them
are empty.

Overall there is tons that can be done, but unfortunately there is no
focus anywhere to fix stuff.

On Mon, Dec 12, 2016 at 1:10 PM, Eric Wong <e@80x24.org> wrote:
> <rant> Came across this in my feeds today:
>
> https://about.gitlab.com/2016/12/11/proposed-server-purchase-for-gitlab-com/
>
> ... Yeah, they cite 0.5 GB of memory usage per unicorn worker.
> I guess this is typical nowadays, but damn, it sucks :<
>
> This is not the future I had in mind or ever wanted unicorn to
> be associated with back in 2009 when I started.
>
> I don't think it's the fault of unicorn itself; unicorn recycles
> request buffers, uses pre-frozen hash keys, and even
> uses String#clear nowadays to discard heap memory, and never
> buffers more than it has to.
>
> Since day one, unicorn was built to handle multi-gigabyte
> uploads and responses; even from a crappy 256MB laptop.
> "curl -T-" is my co-pilot :)
>
>
> So... I guess the problem is up the stack in the app or
> framework.  Maybe Rails?  *shrug*  I don't use that anymore...
>
> I remember using Rails over a decade ago and being shocked at
> 50MB (yes, fifty megabytes) of RSS usage.  This was on 32-bit,
> but even in the worst case on 64-bit, it would be 100MB.
> Of course, nowadays Rails has grown to the point where I'm
> afraid to go near it; instead I work directly off Rack.
>
> And yes, I still freak out nowadays when my Rack processes
> exceed 100MB...
>
>
> So, what can and should we do about it?
>
> * First step: Limit ourselves.
>
>   Use slower, older hardware, slower Internet connection so you
>   force yourself to eke out every bit of performance out of
>   what you have.
>
>   It's utterly hilarious for me to hear about people complain
>   about laptops which can "only" have 16GB RAM.
>
>   I've definitely made transgressions in the past, and the worst
>   code I've written was on powerful hardware.
>
>
> Disclaimer: Some of the following may not be very Ruby-ish :P
> And everything else is optional and the result of the first step
> above.
>
> * Recycle.  Don't waste object slots: {Array,Hash,String}#clear
>   can allow you to recycle heap memory for large objects
>   and minimize GC pressure.  Using thread-local variables
>   in your app helps maintain compatibility with multi-threaded
>   Rack servers; or perhaps go Rack env-local for compatibility
>   with single-threaded non-blocking servers.
>
>
> * Can't recycle?  Discard objects you don't need, ASAP,
>   and continue #clear-ing what you can. Take advantage
>   of streaming built into Rack.
>
>   The Rack response body only needs to respond to #each.
>   There should be no reason to build giant response
>   documents in memory before sending them to a client.
>
>   unicorn can't do the following for you automatically since
>   we don't know how/if a Rack app will reuse a string;
>   but upstack authors can String#clear after yielding
>   in #each to ensure any malloced heap memory is immediately
>   available for future use (but beware of downstream middlewares
>   which do not expect this, too(**)):
>
>     def each
>       # .. do something to generate a giant string
>       yield giant_string
>       giant_string.clear # String#clear
>     end
>
>   A Rack response body may also respond to #close; it can
>   be used to explicitly release any response-local resources.
>   Rack::TempfileReaper + Rack::BodyProxy is an example of
>   this for Tempfiles.
>
>   Smaller functions and smaller code helps keep this manageable.
>
> * Avoid slurping.  Large datasets do not need everything up
>   front.  For example, threading 10K messages entirely
>   in memory is no problem: just don't load entire messages
>   into memory up front, only what you need.
>   JWZ's algorithm was doing this in the 90s:
>   https://www.jwz.org/doc/threading.html
>
> Disclaimer: Some of these things may hurt throughput and
> performance in benchmarks, especially with smaller datasets;
> but I consider predictable and consistent performance more
> far more important than burst throughput.
>
>
> ** Know your entire stack; top to bottom.
>    You ought to be able to track every single line of code
>    in a high-level Rack app you maintain down through each
>    and every layer of framework, middleware, Rack server,
>    Ruby VM, C library, down to the OS kernel.
>
>    Yes, this limits you to using smaller and simpler stacks :P
>
>
> *** Why stick with Ruby if you care about memory usage?
>
> I'm too impatient to wait on compilers, and don't like the extra
> storage of binaries.  Scripting languages forces authors to
> distribute (hopefully non-obfuscated) code; reducing network and
> storage costs, and that also lowers the barrier from user to
> hacker.  Fwiw, I actually prefer Perl5 with the predictability
> (and caveats of) refcounting over a GC like Ruby's.
>
> </rant>
> --
> unsubscribe: unicorn-public+unsubscribe@bogomips.org
> archive: https://bogomips.org/unicorn-public/
>

^ permalink raw reply	[relevance 0%]

* WTF is up with memory usage nowadays?
@ 2016-12-12  2:10  3% Eric Wong
  2016-12-12  4:05  0% ` Sam Saffron
                   ` (2 more replies)
  0 siblings, 3 replies; 89+ results
From: Eric Wong @ 2016-12-12  2:10 UTC (permalink / raw)
  To: unicorn-public

<rant> Came across this in my feeds today:

https://about.gitlab.com/2016/12/11/proposed-server-purchase-for-gitlab-com/

... Yeah, they cite 0.5 GB of memory usage per unicorn worker.
I guess this is typical nowadays, but damn, it sucks :<

This is not the future I had in mind or ever wanted unicorn to
be associated with back in 2009 when I started.

I don't think it's the fault of unicorn itself; unicorn recycles
request buffers, uses pre-frozen hash keys, and even
uses String#clear nowadays to discard heap memory, and never
buffers more than it has to.

Since day one, unicorn was built to handle multi-gigabyte
uploads and responses; even from a crappy 256MB laptop.
"curl -T-" is my co-pilot :)


So... I guess the problem is up the stack in the app or
framework.  Maybe Rails?  *shrug*  I don't use that anymore...

I remember using Rails over a decade ago and being shocked at
50MB (yes, fifty megabytes) of RSS usage.  This was on 32-bit,
but even in the worst case on 64-bit, it would be 100MB.
Of course, nowadays Rails has grown to the point where I'm
afraid to go near it; instead I work directly off Rack.

And yes, I still freak out nowadays when my Rack processes
exceed 100MB...


So, what can and should we do about it?

* First step: Limit ourselves.

  Use slower, older hardware, slower Internet connection so you
  force yourself to eke out every bit of performance out of
  what you have.

  It's utterly hilarious for me to hear about people complain
  about laptops which can "only" have 16GB RAM.

  I've definitely made transgressions in the past, and the worst
  code I've written was on powerful hardware.


Disclaimer: Some of the following may not be very Ruby-ish :P
And everything else is optional and the result of the first step
above.

* Recycle.  Don't waste object slots: {Array,Hash,String}#clear
  can allow you to recycle heap memory for large objects
  and minimize GC pressure.  Using thread-local variables
  in your app helps maintain compatibility with multi-threaded
  Rack servers; or perhaps go Rack env-local for compatibility
  with single-threaded non-blocking servers.


* Can't recycle?  Discard objects you don't need, ASAP,
  and continue #clear-ing what you can. Take advantage
  of streaming built into Rack.

  The Rack response body only needs to respond to #each.
  There should be no reason to build giant response
  documents in memory before sending them to a client.

  unicorn can't do the following for you automatically since
  we don't know how/if a Rack app will reuse a string;
  but upstack authors can String#clear after yielding
  in #each to ensure any malloced heap memory is immediately
  available for future use (but beware of downstream middlewares
  which do not expect this, too(**)):

    def each
      # .. do something to generate a giant string
      yield giant_string
      giant_string.clear # String#clear
    end

  A Rack response body may also respond to #close; it can
  be used to explicitly release any response-local resources.
  Rack::TempfileReaper + Rack::BodyProxy is an example of
  this for Tempfiles.

  Smaller functions and smaller code helps keep this manageable.

* Avoid slurping.  Large datasets do not need everything up
  front.  For example, threading 10K messages entirely
  in memory is no problem: just don't load entire messages
  into memory up front, only what you need.
  JWZ's algorithm was doing this in the 90s:
  https://www.jwz.org/doc/threading.html

Disclaimer: Some of these things may hurt throughput and
performance in benchmarks, especially with smaller datasets;
but I consider predictable and consistent performance more
far more important than burst throughput.


** Know your entire stack; top to bottom.
   You ought to be able to track every single line of code
   in a high-level Rack app you maintain down through each
   and every layer of framework, middleware, Rack server,
   Ruby VM, C library, down to the OS kernel.

   Yes, this limits you to using smaller and simpler stacks :P


*** Why stick with Ruby if you care about memory usage?

I'm too impatient to wait on compilers, and don't like the extra
storage of binaries.  Scripting languages forces authors to
distribute (hopefully non-obfuscated) code; reducing network and
storage costs, and that also lowers the barrier from user to
hacker.  Fwiw, I actually prefer Perl5 with the predictability
(and caveats of) refcounting over a GC like Ruby's.

</rant>

^ permalink raw reply	[relevance 3%]

* Re: Build error of 5.1.0 due to RString
  2016-11-08  8:56  2%   ` Olivier FAURAX
@ 2016-11-08  9:43 17%     ` Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2016-11-08  9:43 UTC (permalink / raw)
  To: Olivier FAURAX; +Cc: unicorn-public

Olivier FAURAX <olivier.faurax@anyces.com> wrote:
> Thanks for the support!
> 
> Here is the mkmf.log:
> $ cat ./vendor/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0-static/unicorn-5.1.0/mkmf.log

No problem, trimming out irrelevant parts...

> have_func: checking for rb_str_set_len() in ruby.h... --------------------
> no
> 
> "gcc -o conftest -I/opt/bitnami/ruby/include/ruby-2.1.0/x86_64-linux
> -I/opt/bitnami/ruby/include/ruby-2.1.0/ruby/backward
> -I/opt/bitnami/ruby/include/ruby-2.1.0 -I. -DAI_ADDRCONFIG=0
> -I/bitnami/megastack-linux-x64/output/sqlite/include
> -I/opt/bitnami/common/include -I/opt/bitnami/common/include/sasl
> -I/opt/bitnami/common/include   -fPIC -I/opt/bitnami/common/include -fPIC
> -I/opt/bitnami/common/include -I/opt/bitnami/common/include -fPIC
> -I/bitnami/megastack-linux-x64/output/ImageMagick/include/ImageMagick
> -I/bitnami/megastack-linux-x64/output/ImageMagick/include/ImageMagick -O3
> conftest.c  -L. -L/opt/bitnami/ruby/lib -Wl,-R/opt/bitnami/ruby/lib -L.
> -L/opt/bitnami/common/lib -L/opt/bitnami/common/lib
> -L/bitnami/megastack-linux-x64/output/sqlite/lib
> -L/bitnami/megastack-linux-x64/output/python/lib -L/opt/bitnami/common/lib
> -L/bitnami/megastack-linux-x64/output/ImageMagick/lib
> -L/bitnami/megastack-linux-x64/output/ImageMagick/lib -fstack-protector
> -rdynamic -Wl,-export-dynamic  -m64   -Wl,-R -Wl,/opt/bitnami/ruby/lib
> -L/opt/bitnami/ruby/lib -lruby-static  -lpthread -lrt -lgmp -ldl -lcrypt -lm
> -lc"
> /usr/bin/ld: /opt/bitnami/ruby/lib/libruby-static.a(string.o): unrecognized
> relocation (0x2a) in section `.text'
> /usr/bin/ld: final link failed: Bad value
> collect2: error: ld returned 1 exit status

As I suspected, something is wrong with the install or build
of Ruby itself (not unicorn).

Does Bitnami build your Ruby installation or do you build and
install Ruby in your local environment using Bitnami?

It could be they used a buggy version of binutils
(or you have a buggy version installed locally).

Can you ask the Bitnami folks for help?

Thanks.


[ Btw, with the '+' in your Subject: line, was it from following
  the mailto: link on the https://bogomips.org/unicorn-public/
  mail archive links?
  The archive code might need to switch to %20 for escaping spaces... ]

^ permalink raw reply	[relevance 17%]

* Re:+Build+error+of+5.1.0+due+to+RString
  2016-11-07 20:39  8% ` Eric Wong
@ 2016-11-08  8:56  2%   ` Olivier FAURAX
  2016-11-08  9:43 17%     ` Build error of 5.1.0 due to RString Eric Wong
  0 siblings, 1 reply; 89+ results
From: Olivier FAURAX @ 2016-11-08  8:56 UTC (permalink / raw)
  To: e; +Cc: olivier.faurax, unicorn-public

Thanks for the support!

Here is the mkmf.log:
$ cat 
./vendor/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0-static/unicorn-5.1.0/mkmf.log
have_macro: checking for SIZEOF_OFF_T in ruby.h... -------------------- yes

"gcc -o conftest -I/opt/bitnami/ruby/include/ruby-2.1.0/x86_64-linux 
-I/opt/bitnami/ruby/include/ruby-2.1.0/ruby/backward 
-I/opt/bitnami/ruby/include/ruby-2.1.0 -I. -DAI_ADDRCONFIG=0 
-I/bitnami/megastack-linux-x64/output/sqlite/include 
-I/opt/bitnami/common/include -I/opt/bitnami/common/include/sasl 
-I/opt/bitnami/common/include   -fPIC -I/opt/bitnami/common/include 
-fPIC -I/opt/bitnami/common/include -I/opt/bitnami/common/include -fPIC 
-I/bitnami/megastack-linux-x64/output/ImageMagick/include/ImageMagick 
-I/bitnami/megastack-linux-x64/output/ImageMagick/include/ImageMagick 
-O3 conftest.c  -L. -L/opt/bitnami/ruby/lib -Wl,-R/opt/bitnami/ruby/lib 
-L. -L/opt/bitnami/common/lib -L/opt/bitnami/common/lib 
-L/bitnami/megastack-linux-x64/output/sqlite/lib 
-L/bitnami/megastack-linux-x64/output/python/lib 
-L/opt/bitnami/common/lib 
-L/bitnami/megastack-linux-x64/output/ImageMagick/lib 
-L/bitnami/megastack-linux-x64/output/ImageMagick/lib -fstack-protector 
-rdynamic -Wl,-export-dynamic  -m64   -Wl,-R -Wl,/opt/bitnami/ruby/lib 
-L/opt/bitnami/ruby/lib -lruby-static  -lpthread -lrt -lgmp -ldl -lcrypt 
-lm   -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

"gcc -I/opt/bitnami/ruby/include/ruby-2.1.0/x86_64-linux 
-I/opt/bitnami/ruby/include/ruby-2.1.0/ruby/backward 
-I/opt/bitnami/ruby/include/ruby-2.1.0 -I. -DAI_ADDRCONFIG=0 
-I/bitnami/megastack-linux-x64/output/sqlite/include 
-I/opt/bitnami/common/include -I/opt/bitnami/common/include/sasl 
-I/opt/bitnami/common/include   -fPIC -I/opt/bitnami/common/include 
-fPIC -I/opt/bitnami/common/include -I/opt/bitnami/common/include -fPIC 
-I/bitnami/megastack-linux-x64/output/ImageMagick/include/ImageMagick 
-I/bitnami/megastack-linux-x64/output/ImageMagick/include/ImageMagick 
-O3 -m64  -c conftest.c"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <ruby.h>
4: /*top*/
5: #ifndef SIZEOF_OFF_T
6: # error
7: |:/ === SIZEOF_OFF_T undefined === /:|
8: #endif
/* end */

--------------------

have_macro: checking for SIZEOF_SIZE_T in ruby.h... -------------------- yes

"gcc -I/opt/bitnami/ruby/include/ruby-2.1.0/x86_64-linux 
-I/opt/bitnami/ruby/include/ruby-2.1.0/ruby/backward 
-I/opt/bitnami/ruby/include/ruby-2.1.0 -I. -DAI_ADDRCONFIG=0 
-I/bitnami/megastack-linux-x64/output/sqlite/include 
-I/opt/bitnami/common/include -I/opt/bitnami/common/include/sasl 
-I/opt/bitnami/common/include   -fPIC -I/opt/bitnami/common/include 
-fPIC -I/opt/bitnami/common/include -I/opt/bitnami/common/include -fPIC 
-I/bitnami/megastack-linux-x64/output/ImageMagick/include/ImageMagick 
-I/bitnami/megastack-linux-x64/output/ImageMagick/include/ImageMagick 
-O3 -m64  -c conftest.c"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <ruby.h>
4: /*top*/
5: #ifndef SIZEOF_SIZE_T
6: # error
7: |:/ === SIZEOF_SIZE_T undefined === /:|
8: #endif
/* end */

--------------------

have_macro: checking for SIZEOF_LONG in ruby.h... -------------------- yes

"gcc -I/opt/bitnami/ruby/include/ruby-2.1.0/x86_64-linux 
-I/opt/bitnami/ruby/include/ruby-2.1.0/ruby/backward 
-I/opt/bitnami/ruby/include/ruby-2.1.0 -I. -DAI_ADDRCONFIG=0 
-I/bitnami/megastack-linux-x64/output/sqlite/include 
-I/opt/bitnami/common/include -I/opt/bitnami/common/include/sasl 
-I/opt/bitnami/common/include   -fPIC -I/opt/bitnami/common/include 
-fPIC -I/opt/bitnami/common/include -I/opt/bitnami/common/include -fPIC 
-I/bitnami/megastack-linux-x64/output/ImageMagick/include/ImageMagick 
-I/bitnami/megastack-linux-x64/output/ImageMagick/include/ImageMagick 
-O3 -m64  -c conftest.c"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <ruby.h>
4: /*top*/
5: #ifndef SIZEOF_LONG
6: # error
7: |:/ === SIZEOF_LONG undefined === /:|
8: #endif
/* end */

--------------------

have_func: checking for rb_str_set_len() in ruby.h... 
-------------------- no

"gcc -o conftest -I/opt/bitnami/ruby/include/ruby-2.1.0/x86_64-linux 
-I/opt/bitnami/ruby/include/ruby-2.1.0/ruby/backward 
-I/opt/bitnami/ruby/include/ruby-2.1.0 -I. -DAI_ADDRCONFIG=0 
-I/bitnami/megastack-linux-x64/output/sqlite/include 
-I/opt/bitnami/common/include -I/opt/bitnami/common/include/sasl 
-I/opt/bitnami/common/include   -fPIC -I/opt/bitnami/common/include 
-fPIC -I/opt/bitnami/common/include -I/opt/bitnami/common/include -fPIC 
-I/bitnami/megastack-linux-x64/output/ImageMagick/include/ImageMagick 
-I/bitnami/megastack-linux-x64/output/ImageMagick/include/ImageMagick 
-O3 conftest.c  -L. -L/opt/bitnami/ruby/lib -Wl,-R/opt/bitnami/ruby/lib 
-L. -L/opt/bitnami/common/lib -L/opt/bitnami/common/lib 
-L/bitnami/megastack-linux-x64/output/sqlite/lib 
-L/bitnami/megastack-linux-x64/output/python/lib 
-L/opt/bitnami/common/lib 
-L/bitnami/megastack-linux-x64/output/ImageMagick/lib 
-L/bitnami/megastack-linux-x64/output/ImageMagick/lib -fstack-protector 
-rdynamic -Wl,-export-dynamic  -m64   -Wl,-R -Wl,/opt/bitnami/ruby/lib 
-L/opt/bitnami/ruby/lib -lruby-static  -lpthread -lrt -lgmp -ldl -lcrypt 
-lm   -lc"
/usr/bin/ld: /opt/bitnami/ruby/lib/libruby-static.a(string.o): 
unrecognized relocation (0x2a) in section `.text'
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
checked program was:
/* begin */
  1: #include "ruby.h"
  2:
  3: #include <ruby.h>
  4:
  5: /*top*/
  6: extern int t(void);
  7: int main(int argc, char **argv)
  8: {
  9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12:
13:   return 0;
14: }
15: int t(void) { void ((*volatile p)()); p = (void 
((*)()))rb_str_set_len; return 0; }
/* end */

"gcc -o conftest -I/opt/bitnami/ruby/include/ruby-2.1.0/x86_64-linux 
-I/opt/bitnami/ruby/include/ruby-2.1.0/ruby/backward 
-I/opt/bitnami/ruby/include/ruby-2.1.0 -I. -DAI_ADDRCONFIG=0 
-I/bitnami/megastack-linux-x64/output/sqlite/include 
-I/opt/bitnami/common/include -I/opt/bitnami/common/include/sasl 
-I/opt/bitnami/common/include   -fPIC -I/opt/bitnami/common/include 
-fPIC -I/opt/bitnami/common/include -I/opt/bitnami/common/include -fPIC 
-I/bitnami/megastack-linux-x64/output/ImageMagick/include/ImageMagick 
-I/bitnami/megastack-linux-x64/output/ImageMagick/include/ImageMagick 
-O3 conftest.c  -L. -L/opt/bitnami/ruby/lib -Wl,-R/opt/bitnami/ruby/lib 
-L. -L/opt/bitnami/common/lib -L/opt/bitnami/common/lib 
-L/bitnami/megastack-linux-x64/output/sqlite/lib 
-L/bitnami/megastack-linux-x64/output/python/lib 
-L/opt/bitnami/common/lib 
-L/bitnami/megastack-linux-x64/output/ImageMagick/lib 
-L/bitnami/megastack-linux-x64/output/ImageMagick/lib -fstack-protector 
-rdynamic -Wl,-export-dynamic  -m64   -Wl,-R -Wl,/opt/bitnami/ruby/lib 
-L/opt/bitnami/ruby/lib -lruby-static  -lpthread -lrt -lgmp -ldl -lcrypt 
-lm   -lc"
conftest.c: In function ‘t’:
conftest.c:15:1: error: too few arguments to function ‘rb_str_set_len’
  int t(void) { rb_str_set_len(); return 0; }
  ^
In file included from 
/opt/bitnami/ruby/include/ruby-2.1.0/ruby/ruby.h:1702:0,
                  from /opt/bitnami/ruby/include/ruby-2.1.0/ruby.h:33,
                  from conftest.c:1:
/opt/bitnami/ruby/include/ruby-2.1.0/ruby/intern.h:747:6: note: declared 
here
  void rb_str_set_len(VALUE, long);
       ^
checked program was:
/* begin */
  1: #include "ruby.h"
  2:
  3: #include <ruby.h>
  4:
  5: /*top*/
  6: extern int t(void);
  7: int main(int argc, char **argv)
  8: {
  9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12:
13:   return 0;
14: }
15: int t(void) { rb_str_set_len(); return 0; }
/* end */

--------------------

have_func: checking for rb_hash_clear() in ruby.h... -------------------- no

"gcc -o conftest -I/opt/bitnami/ruby/include/ruby-2.1.0/x86_64-linux 
-I/opt/bitnami/ruby/include/ruby-2.1.0/ruby/backward 
-I/opt/bitnami/ruby/include/ruby-2.1.0 -I. -DAI_ADDRCONFIG=0 
-I/bitnami/megastack-linux-x64/output/sqlite/include 
-I/opt/bitnami/common/include -I/opt/bitnami/common/include/sasl 
-I/opt/bitnami/common/include   -fPIC -I/opt/bitnami/common/include 
-fPIC -I/opt/bitnami/common/include -I/opt/bitnami/common/include -fPIC 
-I/bitnami/megastack-linux-x64/output/ImageMagick/include/ImageMagick 
-I/bitnami/megastack-linux-x64/output/ImageMagick/include/ImageMagick 
-O3 conftest.c  -L. -L/opt/bitnami/ruby/lib -Wl,-R/opt/bitnami/ruby/lib 
-L. -L/opt/bitnami/common/lib -L/opt/bitnami/common/lib 
-L/bitnami/megastack-linux-x64/output/sqlite/lib 
-L/bitnami/megastack-linux-x64/output/python/lib 
-L/opt/bitnami/common/lib 
-L/bitnami/megastack-linux-x64/output/ImageMagick/lib 
-L/bitnami/megastack-linux-x64/output/ImageMagick/lib -fstack-protector 
-rdynamic -Wl,-export-dynamic  -m64   -Wl,-R -Wl,/opt/bitnami/ruby/lib 
-L/opt/bitnami/ruby/lib -lruby-static  -lpthread -lrt -lgmp -ldl -lcrypt 
-lm   -lc"
/usr/bin/ld: /opt/bitnami/ruby/lib/libruby-static.a(hash.o): 
unrecognized relocation (0x2a) in section `.text'
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
checked program was:
/* begin */
  1: #include "ruby.h"
  2:
  3: #include <ruby.h>
  4:
  5: /*top*/
  6: extern int t(void);
  7: int main(int argc, char **argv)
  8: {
  9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12:
13:   return 0;
14: }
15: int t(void) { void ((*volatile p)()); p = (void 
((*)()))rb_hash_clear; return 0; }
/* end */

"gcc -o conftest -I/opt/bitnami/ruby/include/ruby-2.1.0/x86_64-linux 
-I/opt/bitnami/ruby/include/ruby-2.1.0/ruby/backward 
-I/opt/bitnami/ruby/include/ruby-2.1.0 -I. -DAI_ADDRCONFIG=0 
-I/bitnami/megastack-linux-x64/output/sqlite/include 
-I/opt/bitnami/common/include -I/opt/bitnami/common/include/sasl 
-I/opt/bitnami/common/include   -fPIC -I/opt/bitnami/common/include 
-fPIC -I/opt/bitnami/common/include -I/opt/bitnami/common/include -fPIC 
-I/bitnami/megastack-linux-x64/output/ImageMagick/include/ImageMagick 
-I/bitnami/megastack-linux-x64/output/ImageMagick/include/ImageMagick 
-O3 conftest.c  -L. -L/opt/bitnami/ruby/lib -Wl,-R/opt/bitnami/ruby/lib 
-L. -L/opt/bitnami/common/lib -L/opt/bitnami/common/lib 
-L/bitnami/megastack-linux-x64/output/sqlite/lib 
-L/bitnami/megastack-linux-x64/output/python/lib 
-L/opt/bitnami/common/lib 
-L/bitnami/megastack-linux-x64/output/ImageMagick/lib 
-L/bitnami/megastack-linux-x64/output/ImageMagick/lib -fstack-protector 
-rdynamic -Wl,-export-dynamic  -m64   -Wl,-R -Wl,/opt/bitnami/ruby/lib 
-L/opt/bitnami/ruby/lib -lruby-static  -lpthread -lrt -lgmp -ldl -lcrypt 
-lm   -lc"
conftest.c: In function ‘t’:
conftest.c:15:1: error: too few arguments to function ‘rb_hash_clear’
  int t(void) { rb_hash_clear(); return 0; }
  ^
In file included from 
/opt/bitnami/ruby/include/ruby-2.1.0/ruby/ruby.h:1702:0,
                  from /opt/bitnami/ruby/include/ruby-2.1.0/ruby.h:33,
                  from conftest.c:1:
/opt/bitnami/ruby/include/ruby-2.1.0/ruby/intern.h:504:7: note: declared 
here
  VALUE rb_hash_clear(VALUE);
        ^
checked program was:
/* begin */
  1: #include "ruby.h"
  2:
  3: #include <ruby.h>
  4:
  5: /*top*/
  6: extern int t(void);
  7: int main(int argc, char **argv)
  8: {
  9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12:
13:   return 0;
14: }
15: int t(void) { rb_hash_clear(); return 0; }
/* end */

--------------------

have_func: checking for gmtime_r() in time.h... -------------------- yes

"gcc -o conftest -I/opt/bitnami/ruby/include/ruby-2.1.0/x86_64-linux 
-I/opt/bitnami/ruby/include/ruby-2.1.0/ruby/backward 
-I/opt/bitnami/ruby/include/ruby-2.1.0 -I. -DAI_ADDRCONFIG=0 
-I/bitnami/megastack-linux-x64/output/sqlite/include 
-I/opt/bitnami/common/include -I/opt/bitnami/common/include/sasl 
-I/opt/bitnami/common/include   -fPIC -I/opt/bitnami/common/include 
-fPIC -I/opt/bitnami/common/include -I/opt/bitnami/common/include -fPIC 
-I/bitnami/megastack-linux-x64/output/ImageMagick/include/ImageMagick 
-I/bitnami/megastack-linux-x64/output/ImageMagick/include/ImageMagick 
-O3 conftest.c  -L. -L/opt/bitnami/ruby/lib -Wl,-R/opt/bitnami/ruby/lib 
-L. -L/opt/bitnami/common/lib -L/opt/bitnami/common/lib 
-L/bitnami/megastack-linux-x64/output/sqlite/lib 
-L/bitnami/megastack-linux-x64/output/python/lib 
-L/opt/bitnami/common/lib 
-L/bitnami/megastack-linux-x64/output/ImageMagick/lib 
-L/bitnami/megastack-linux-x64/output/ImageMagick/lib -fstack-protector 
-rdynamic -Wl,-export-dynamic  -m64   -Wl,-R -Wl,/opt/bitnami/ruby/lib 
-L/opt/bitnami/ruby/lib -lruby-static  -lpthread -lrt -lgmp -ldl -lcrypt 
-lm   -lc"
checked program was:
/* begin */
  1: #include "ruby.h"
  2:
  3: #include <time.h>
  4:
  5: /*top*/
  6: extern int t(void);
  7: int main(int argc, char **argv)
  8: {
  9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12:
13:   return 0;
14: }
15: int t(void) { void ((*volatile p)()); p = (void ((*)()))gmtime_r; 
return 0; }
/* end */

--------------------


^ permalink raw reply	[relevance 2%]

* Re: Build error of 5.1.0 due to RString
  2016-11-07 17:13 13% Build error of 5.1.0 due to RString Olivier FAURAX
@ 2016-11-07 20:39  8% ` Eric Wong
  2016-11-08  8:56  2%   ` Olivier FAURAX
  0 siblings, 1 reply; 89+ results
From: Eric Wong @ 2016-11-07 20:39 UTC (permalink / raw)
  To: Olivier FAURAX; +Cc: unicorn-public

Olivier FAURAX <olivier.faurax@anyces.com> wrote:
> It is about a RString that has not some members, so perhaps an API has been
> modified somewhere.

<snip>

> /opt/bitnami/apps/gitlab/htdocs/vendor/bundle/ruby/2.1.0/gems/unicorn-5.1.0/unicorn.gemspec
> Building native extensions.  This could take a while...
> /opt/bitnami/ruby/bin/ruby extconf.rb
> checking for SIZEOF_OFF_T in ruby.h... yes
> checking for SIZEOF_SIZE_T in ruby.h... yes
> checking for SIZEOF_LONG in ruby.h... yes

OK, ruby.h is there, so development headers exist...

> checking for rb_str_set_len() in ruby.h... no
> checking for rb_hash_clear() in ruby.h... no

These last two lines do not look right.  Can you show us your
mkmf.log file?  The output you originally posted is not enough
as it doesn't show the long compiler options and paths used.

Perhaps a library file is missing for static linking,
since these function checks require.

I'm not familiar with bitnami and how it builds/installs
Ruby, so maybe it's missing libruby*static.a or looking
in the wrong place somehow.

<snip> The failing code should've never been compiled
in the first place and should probably be removed.
However, the rb_hash_clear() detection is still necessary...

Thanks for reporting this.  You might want to loop in somebody
familiar with bitnami to poke around, too.

^ permalink raw reply	[relevance 8%]

* Build error of 5.1.0 due to RString
@ 2016-11-07 17:13 13% Olivier FAURAX
  2016-11-07 20:39  8% ` Eric Wong
  0 siblings, 1 reply; 89+ results
From: Olivier FAURAX @ 2016-11-07 17:13 UTC (permalink / raw)
  To: unicorn-public

Hello,

I'm new to Ruby & Unicorn, and I get a build error trying to compile 
unicorn 5.1.0.

It is about a RString that has not some members, so perhaps an API has 
been modified somewhere.
I tried with unicorn 5.2.0, and I get the same error.

Thanks in advance
Olivier

$ uname -a
Linux git.example.com 3.16.0-76-generic #98~14.04.1-Ubuntu SMP Fri Jun 
24 17:04:54 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

$ ruby --version
ruby 2.1.9p490 (2016-03-30 revision 54437) [x86_64-linux]

$ gem install unicorn -v '5.1.0' -i vendor/bundle/ruby/2.1.0 --verbose
GET https://api.rubygems.org/specs.4.8.gz
200 OK
HEAD https://api.rubygems.org/api/v1/dependencies
200 OK
GET https://api.rubygems.org/api/v1/dependencies?gems=unicorn
200 OK
GET https://api.rubygems.org/api/v1/dependencies?gems=raindrops
200 OK
GET https://api.rubygems.org/api/v1/dependencies?gems=kgio
200 OK
/opt/bitnami/apps/gitlab/htdocs/vendor/bundle/ruby/2.1.0/gems/unicorn-5.1.0/.CHANGELOG.old
...
[long list of unicorn-5.1.0 files]
...
/opt/bitnami/apps/gitlab/htdocs/vendor/bundle/ruby/2.1.0/gems/unicorn-5.1.0/unicorn.gemspec
Building native extensions.  This could take a while...
/opt/bitnami/ruby/bin/ruby extconf.rb
checking for SIZEOF_OFF_T in ruby.h... yes
checking for SIZEOF_SIZE_T in ruby.h... yes
checking for SIZEOF_LONG in ruby.h... yes
checking for rb_str_set_len() in ruby.h... no
checking for rb_hash_clear() in ruby.h... no
checking for gmtime_r() in time.h... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling httpdate.c
compiling unicorn_http.c
In file included from unicorn_http.rl:8:0:
ext_help.h: In function ‘rb_18_str_set_len’:
ext_help.h:18:15: error: ‘struct RString’ has no member named ‘len’
    RSTRING(str)->len = len;
                ^
ext_help.h:19:15: error: ‘struct RString’ has no member named ‘ptr’
    RSTRING(str)->ptr[len] = '\0';
                ^
make: *** [unicorn_http.o] Error 1
ERROR:  Error installing unicorn:
         ERROR: Failed to build gem native extension.

     Building has failed. See above output for more information on the 
failure.
make failed, exit code 2

Gem files will remain installed in 
/opt/bitnami/apps/gitlab/htdocs/vendor/bundle/ruby/2.1.0/gems/unicorn-5.1.0 
for inspection.
Results logged to 
/opt/bitnami/apps/gitlab/htdocs/vendor/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0-static/unicorn-5.1.0/gem_make.out

^ permalink raw reply	[relevance 13%]

* Re: trying to update unicorn to 5.1, build failure: VERSION= must be specified
  2016-10-28  0:23 15%   ` trying to update unicorn to 5.1, build failure: VERSION= must be specified Eric Wong
@ 2016-11-03 15:46  9%     ` Pirate Praveen
  2017-03-23 23:34 21%       ` [PATCH] gemspec: remove olddoc from build dependency Eric Wong
  0 siblings, 1 reply; 89+ results
From: Pirate Praveen @ 2016-11-03 15:46 UTC (permalink / raw)
  To: Eric Wong, Hleb Valoshka; +Cc: debian-ruby, unicorn-public

[-- Attachment #1: Type: text/plain, Size: 889 bytes --]

On Friday 28 October 2016 05:53 AM, Eric Wong wrote:
> I understand olddoc may not be worth the effort to package in
> Debian.  (I already tried to reduce dependencies in olddoc
> compared to wrongdoc, but a package is a package...)
> 
> Anyways, I suggest you guys grab the generated gemspec from the
> Rubygem or tar.gz.  You already seem to be doing that with NEWS
> and the manpages to avoid a build-dep on pandoc(*).

We are already using the rubygems.org .gem file and it has olddoc.

> Maybe the gemspec in git could have olddoc become optional, too,
> while still remaining DRY.  The email address for the public
> mailing list is already specified in multiple places, so maybe
> over-DRY-ing isn't worth it...

If you can make it optional that would be great. For now I've just
patched out the gemspec to not use olddoc. The patch and fix in rules is
ugly.



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[relevance 9%]

* [ANN] unicorn 5.2.0 - Rack HTTP server for fast clients and *nix
       [not found]     <20161031-unicorn-5.2.0-released@bogomips.org>
@ 2016-10-31 20:04  5% ` Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2016-10-31 20:04 UTC (permalink / raw)
  To: ruby-talk, unicorn-public; +Cc: Mishael A Sibiryakov

unicorn is an HTTP server for Rack applications designed to only serve
fast clients on low-latency, high-bandwidth connections and take
advantage of features in Unix/Unix-like kernels.  Slow clients should
only be served by placing a reverse proxy capable of fully buffering
both the the request and response in between unicorn and slow clients.

* https://bogomips.org/unicorn/
* public list: unicorn-public@bogomips.org
* mail archives: https://bogomips.org/unicorn-public/
* git clone git://bogomips.org/unicorn.git
* https://bogomips.org/unicorn/NEWS.atom.xml
* nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn

Changes:

    Most notably, this release allows us to support requests with
    lines delimited by LF-only, as opposed to the standard CRLF
    pair and allowed by RFC 2616 sec 19.3.

    Thanks to Mishael A Sibiryakov for the explanation and change:

      https://bogomips.org/unicorn-public/1476954332.1736.156.camel@junki.org/

    Thanks to Let's Encrypt, the website also moves to HTTPS
    <https://bogomips.org/unicorn/> to improve reader privacy.  The
    "unicorn.bogomips.org" subdomain will be retired soon to reduce
    subjectAltName bloat and speed up certificate renewals.

    There's also the usual round of documentation and example
    updates, too.

    Eric Wong (7):
          examples/init.sh: update to reduce upgrade raciness
          doc: systemd should only kill master in example
          examples/logrotate.conf: update example for systemd
          doc: update gmane URLs to point to our own archives
          relocate website to https://bogomips.org/unicorn/
          TODO: remove Rack 2.x item
          build: "install-gem" target avoids network

    Mishael A Sibiryakov (1):
          Add some tolerance (RFC2616 sec. 19.3)

^ permalink raw reply	[relevance 5%]

* Re: trying to update unicorn to 5.1, build failure: VERSION= must be specified
       [not found]     ` <CAAB-Kcnwzc8Tcszv3FCPkyJRKRCsHRH6k_qBhKfBpSODxqKy5g@mail.gmail.com>
@ 2016-10-28  0:23 15%   ` Eric Wong
  2016-11-03 15:46  9%     ` Pirate Praveen
  0 siblings, 1 reply; 89+ results
From: Eric Wong @ 2016-10-28  0:23 UTC (permalink / raw)
  To: Hleb Valoshka; +Cc: debian-ruby, Pirate Praveen, unicorn-public

Hleb Valoshka <375gnu@gmail.com> wrote:
> On 9/19/16, Pirate Praveen <praveen@onenetbeyond.org> wrote:
> > Its pushed to alioth. Can someone check?
> >
> > Error below:
> >
> > $ clean
> > dh clean --buildsystem=ruby --with ruby,systemd
> >    dh_testdir -O--buildsystem=ruby
> >    dh_auto_clean -O--buildsystem=ruby
> > 	dh_ruby --clean
> >    dh_ruby --clean
> > VERSION= must be specified
> > dh_auto_clean: dh_ruby --clean returned exit code 1
> > debian/rules:6: recipe for target 'clean' failed
> > make: *** [clean] Error 1
> 
> This is not the only problem, then you should have olddoc gem, I
> remember that I tried to fix these error, but I don't see my changes,
> maybe I did this on my home pc, I'll look there.

(oops, missed this earlier)

I understand olddoc may not be worth the effort to package in
Debian.  (I already tried to reduce dependencies in olddoc
compared to wrongdoc, but a package is a package...)

Anyways, I suggest you guys grab the generated gemspec from the
Rubygem or tar.gz.  You already seem to be doing that with NEWS
and the manpages to avoid a build-dep on pandoc(*).

Maybe the gemspec in git could have olddoc become optional, too,
while still remaining DRY.  The email address for the public
mailing list is already specified in multiple places, so maybe
over-DRY-ing isn't worth it...

Anyways, feel free to email me + Cc: unicorn-public@bogomips.org
w.r.t. any packaging/integration issues for any Free Software
systems (not just Debian)


(*) - I'll be switching over to perlpod at some point and
      pod2man is standard in Debian.  I hate having to spend
      ~30MB of bandwidth fees to get ghc + pandoc to build
      manpages.

^ permalink raw reply	[relevance 15%]

* [PATCH] relocate website to https://bogomips.org/unicorn/
@ 2016-10-25 22:25  3% Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2016-10-25 22:25 UTC (permalink / raw)
  To: unicorn-public

HTTPS helps some with reader privacy and Let's Encrypt seems to
be working well enough the past few months.

This change will allow us to reduce subjectAltName bloat in our
TLS certificate over time.  It will also promote domain name
agility to support mirrors or migrations to other domains
(including a Tor hidden service mirror).

http://bogomips.org/unicorn/ will remain available for people on
legacy systems without usable TLS.  There is no plan for automatic
redirecting from HTTP to HTTPS at this time.
---

 I'm not sure when I'll remove "unicorn.bogomips.org"
 subjectAltName from the TLS certificate, yet, hopefully
 within a year; but maybe that's optimistic

 I never actually advertised the HTTPS site for this project
 before today, but search engines picked it up.  Oh well :<

 .olddoc.yml                       |  6 +++---
 Documentation/unicorn.1.txt       |  4 ++--
 Documentation/unicorn_rails.1.txt |  4 ++--
 GNUmakefile                       |  4 ++--
 HACKING                           |  2 +-
 ISSUES                            | 12 ++++++------
 Links                             |  4 ++--
 README                            |  4 ++--
 SIGNALS                           |  2 +-
 examples/big_app_gc.rb            |  2 +-
 examples/nginx.conf               |  2 +-
 examples/unicorn.conf.minimal.rb  |  4 ++--
 examples/unicorn.conf.rb          |  4 ++--
 lib/unicorn/configurator.rb       |  6 +++---
 lib/unicorn/http_server.rb        |  2 +-
 15 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/.olddoc.yml b/.olddoc.yml
index c4a9236..ee2d306 100644
--- a/.olddoc.yml
+++ b/.olddoc.yml
@@ -1,8 +1,8 @@
 ---
-cgit_url: http://bogomips.org/unicorn.git
+cgit_url: https://bogomips.org/unicorn.git
 git_url: git://bogomips.org/unicorn.git
-rdoc_url: http://unicorn.bogomips.org/
-ml_url: http://bogomips.org/unicorn-public/
+rdoc_url: https://bogomips.org/unicorn/
+ml_url: https://bogomips.org/unicorn-public/
 merge_html:
   unicorn_1: Documentation/unicorn.1.html
   unicorn_rails_1: Documentation/unicorn_rails.1.html
diff --git a/Documentation/unicorn.1.txt b/Documentation/unicorn.1.txt
index 3f20a9a..e692078 100644
--- a/Documentation/unicorn.1.txt
+++ b/Documentation/unicorn.1.txt
@@ -181,7 +181,7 @@ the unicorn config file.
 * [Rack RDoc][2]
 * [Rackup HowTo][3]
 
-[1]: http://unicorn.bogomips.org/
+[1]: https://bogomips.org/unicorn/
 [2]: http://www.rubydoc.info/github/rack/rack/
 [3]: https://github.com/rack/rack/wiki/tutorial-rackup-howto
-[4]: http://unicorn.bogomips.org/SIGNALS.html
+[4]: https://bogomips.org/unicorn/SIGNALS.html
diff --git a/Documentation/unicorn_rails.1.txt b/Documentation/unicorn_rails.1.txt
index 2ce7501..088e2ff 100644
--- a/Documentation/unicorn_rails.1.txt
+++ b/Documentation/unicorn_rails.1.txt
@@ -169,7 +169,7 @@ used by Unicorn.
 * [Rack RDoc][2]
 * [Rackup HowTo][3]
 
-[1]: http://unicorn.bogomips.org/
+[1]: https://bogomips.org/unicorn/
 [2]: http://www.rubydoc.info/github/rack/rack/
 [3]: https://github.com/rack/rack/wiki/tutorial-rackup-howto
-[4]: http://unicorn.bogomips.org/SIGNALS.html
+[4]: https://bogomips.org/unicorn/SIGNALS.html
diff --git a/GNUmakefile b/GNUmakefile
index 3f9c441..bc9c643 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -183,13 +183,13 @@ doc: .document $(ext)/unicorn_http.c man html .olddoc.yml $(PLACEHOLDERS)
 	install -m644 $(man1_paths) doc/
 	tar cf - $$(git ls-files examples/) | (cd doc && tar xf -)
 
-# publishes docs to http://unicorn.bogomips.org
+# publishes docs to https://bogomips.org/unicorn/
 publish_doc:
 	-git set-file-times
 	$(MAKE) doc
 	$(MAKE) doc_gz
 	chmod 644 $$(find doc -type f)
-	$(RSYNC) -av doc/ unicorn.bogomips.org:/srv/unicorn/
+	$(RSYNC) -av doc/ bogomips.org:/srv/bogomips/unicorn/
 	git ls-files | xargs touch
 
 # Create gzip variants of the same timestamp as the original so nginx
diff --git a/HACKING b/HACKING
index 0fa22cd..d55f1c7 100644
--- a/HACKING
+++ b/HACKING
@@ -57,7 +57,7 @@ Please wrap documentation at 72 characters-per-line or less (long URLs
 are exempt) so it is comfortably readable from terminals.
 
 When referencing mailing list posts, use
-<tt>http://bogomips.org/unicorn-public/$MESSAGE_ID/</tt> if possible
+<tt>https://bogomips.org/unicorn-public/$MESSAGE_ID/</tt> if possible
 since the Message-ID remains searchable even if a particular site
 becomes unavailable.
 
diff --git a/ISSUES b/ISSUES
index 21bd013..291441a 100644
--- a/ISSUES
+++ b/ISSUES
@@ -2,8 +2,8 @@
 
 mailto:unicorn-public@bogomips.org is the best place to report bugs,
 submit patches and/or obtain support after you have searched the
-{email archives}[http://bogomips.org/unicorn-public/] and
-{documentation}[http://unicorn.bogomips.org/].
+{email archives}[https://bogomips.org/unicorn-public/] and
+{documentation}[https://bogomips.org/unicorn/].
 
 * No subscription will ever be required to email us
 * Cc: all participants in a thread or commit, as subscription is optional
@@ -12,7 +12,7 @@ submit patches and/or obtain support after you have searched the
 * Do not send HTML mail or images, it will be flagged as spam
 * Anonymous and pseudonymous messages will always be welcome.
 * The email submission port (587) is enabled on the bogomips.org MX:
-  http://bogomips.org/unicorn-public/20141004232241.GA23908@dcvr.yhbt.net/t/
+  https://bogomips.org/unicorn-public/20141004232241.GA23908@dcvr.yhbt.net/t/
 
 If your issue is of a sensitive nature or you're just shy in public,
 then feel free to email us privately at mailto:unicorn@bogomips.org
@@ -67,7 +67,7 @@ document distributed with git) on guidelines for patch submission.
 * private: mailto:unicorn@bogomips.org
 * nntp://news.gmane.org/gmane.comp.lang.ruby.unicorn.general
 * nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn
-* http://bogomips.org/unicorn-public/
+* https://bogomips.org/unicorn-public/
 
 Mailing list subscription is optional, so Cc: all participants.
 
@@ -78,9 +78,9 @@ You can follow along via NNTP:
 
 Or Atom feeds:
 
-	http://bogomips.org/unicorn-public/new.atom
+	https://bogomips.org/unicorn-public/new.atom
 
-	The HTML archives at http://bogomips.org/unicorn-public/
+	The HTML archives at https://bogomips.org/unicorn-public/
 	also has links to per-thread Atom feeds and downloadable
 	mboxes.
 
diff --git a/Links b/Links
index 6474a9d..7c113c8 100644
--- a/Links
+++ b/Links
@@ -26,7 +26,7 @@ or services behind them.
 * {raindrops}[http://raindrops.bogomips.org/] - real-time stats for
   preforking Rack servers
 
-* {UnXF}[http://bogomips.org/unxf/]  Un-X-Forward* the Rack environment,
+* {UnXF}[https://bogomips.org/unxf/]  Un-X-Forward* the Rack environment,
   useful since unicorn is designed to be deployed behind a reverse proxy.
 
 === unicorn is written to work with
@@ -52,5 +52,5 @@ or services behind them.
 * {Mongrel}[http://rubygems.org/gems/mongrel] - the awesome webserver
   unicorn is based on
 
-* {david}[http://bogomips.org/david.git] - a tool to explain why you need
+* {david}[https://bogomips.org/david.git] - a tool to explain why you need
   nginx in front of unicorn
diff --git a/README b/README
index 8079f37..29e04b4 100644
--- a/README
+++ b/README
@@ -82,7 +82,7 @@ You can get the latest source via git from the following locations
 
 You may browse the code from the web:
 
-* http://bogomips.org/unicorn.git
+* https://bogomips.org/unicorn.git
 * http://repo.or.cz/w/unicorn.git (gitweb)
 
 See the HACKING guide on how to contribute and build prerelease gems
@@ -128,7 +128,7 @@ All feedback (bug reports, user/development dicussion, patches, pull
 requests) go to the mailing list/newsgroup.  See the ISSUES document for
 information on the {mailing list}[mailto:unicorn-public@bogomips.org].
 
-The mailing list is archived at http://bogomips.org/unicorn-public/
+The mailing list is archived at https://bogomips.org/unicorn-public/
 Read-only NNTP access is available at:
 nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn and
 nntp://news.gmane.org/gmane.comp.lang.ruby.unicorn.general
diff --git a/SIGNALS b/SIGNALS
index 4d78065..1af851d 100644
--- a/SIGNALS
+++ b/SIGNALS
@@ -8,7 +8,7 @@ should be possible to easily share process management scripts between
 Unicorn and nginx.
 
 One example init script is distributed with unicorn:
-http://unicorn.bogomips.org/examples/init.sh
+https://bogomips.org/unicorn/examples/init.sh
 
 === Master Process
 
diff --git a/examples/big_app_gc.rb b/examples/big_app_gc.rb
index c4c8b04..9d05719 100644
--- a/examples/big_app_gc.rb
+++ b/examples/big_app_gc.rb
@@ -1,2 +1,2 @@
-# see {Unicorn::OobGC}[http://unicorn.bogomips.org/Unicorn/OobGC.html]
+# see {Unicorn::OobGC}[https://bogomips.org/unicorn/Unicorn/OobGC.html]
 # Unicorn::OobGC was broken in Unicorn v3.3.1 - v3.6.1 and fixed in v3.6.2
diff --git a/examples/nginx.conf b/examples/nginx.conf
index 0583c1f..e25712f 100644
--- a/examples/nginx.conf
+++ b/examples/nginx.conf
@@ -112,7 +112,7 @@ http {
     # try_files directive appeared in in nginx 0.7.27 and has stabilized
     # over time.  Older versions of nginx (e.g. 0.6.x) requires
     # "if (!-f $request_filename)" which was less efficient:
-    # http://bogomips.org/unicorn.git/tree/examples/nginx.conf?id=v3.3.1#n127
+    # https://bogomips.org/unicorn.git/tree/examples/nginx.conf?id=v3.3.1#n127
     try_files $uri/index.html $uri.html $uri @app;
 
     location @app {
diff --git a/examples/unicorn.conf.minimal.rb b/examples/unicorn.conf.minimal.rb
index 2a47910..2d1bf0a 100644
--- a/examples/unicorn.conf.minimal.rb
+++ b/examples/unicorn.conf.minimal.rb
@@ -1,9 +1,9 @@
 # Minimal sample configuration file for Unicorn (not Rack) when used
 # with daemonization (unicorn -D) started in your working directory.
 #
-# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete
+# See https://bogomips.org/unicorn/Unicorn/Configurator.html for complete
 # documentation.
-# See also http://unicorn.bogomips.org/examples/unicorn.conf.rb for
+# See also https://bogomips.org/unicorn/examples/unicorn.conf.rb for
 # a more verbose configuration using more features.
 
 listen 2007 # by default Unicorn listens on port 8080
diff --git a/examples/unicorn.conf.rb b/examples/unicorn.conf.rb
index 1e05cbb..d2897ef 100644
--- a/examples/unicorn.conf.rb
+++ b/examples/unicorn.conf.rb
@@ -2,10 +2,10 @@
 #
 # This configuration file documents many features of Unicorn
 # that may not be needed for some applications. See
-# http://unicorn.bogomips.org/examples/unicorn.conf.minimal.rb
+# https://bogomips.org/unicorn/examples/unicorn.conf.minimal.rb
 # for a much simpler configuration file.
 #
-# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete
+# See https://bogomips.org/unicorn/Unicorn/Configurator.html for complete
 # documentation.
 
 # Use at least one worker per core if you're on a dedicated server,
diff --git a/lib/unicorn/configurator.rb b/lib/unicorn/configurator.rb
index 948c6e3..3329c10 100644
--- a/lib/unicorn/configurator.rb
+++ b/lib/unicorn/configurator.rb
@@ -3,11 +3,11 @@
 
 # Implements a simple DSL for configuring a unicorn server.
 #
-# See http://unicorn.bogomips.org/examples/unicorn.conf.rb and
-# http://unicorn.bogomips.org/examples/unicorn.conf.minimal.rb
+# See https://bogomips.org/unicorn/examples/unicorn.conf.rb and
+# https://bogomips.org/unicorn/examples/unicorn.conf.minimal.rb
 # example configuration files.  An example config file for use with
 # nginx is also available at
-# http://unicorn.bogomips.org/examples/nginx.conf
+# https://bogomips.org/unicorn/examples/nginx.conf
 #
 # See the link:/TUNING.html document for more information on tuning unicorn.
 class Unicorn::Configurator
diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index 741cca5..35bd100 100644
--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
@@ -6,7 +6,7 @@
 # forked worker children.
 #
 # Users do not need to know the internals of this class, but reading the
-# {source}[http://bogomips.org/unicorn.git/tree/lib/unicorn/http_server.rb]
+# {source}[https://bogomips.org/unicorn.git/tree/lib/unicorn/http_server.rb]
 # is education for programmers wishing to learn how unicorn works.
 # See Unicorn::Configurator for information on how to configure unicorn.
 class Unicorn::HttpServer
-- 
EW

^ permalink raw reply related	[relevance 3%]

* Re: [PATCH] limit rack version for ruby compatibility
  2016-01-08 21:50  0%   ` Aaron Patterson
@ 2016-01-08 22:37  5%     ` Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2016-01-08 22:37 UTC (permalink / raw)
  To: Aaron Patterson; +Cc: rack-devel, Adam Duke, unicorn-public

Aaron Patterson <tenderlove@ruby-lang.org> wrote:
> The main reason I bumped it up to Ruby 2.2.x is because that will be the
> minimum version of Ruby I'll be stuck with throughout Rack 2.x's
> lifetime.  IOW, I can't drop Ruby versions in anything but a major
> release so I'm being conservative and only going with the latest (at the
> time that was 2.2).
> 
> I could be convinced to bring down the version number, but I'd like to
> know why first. :)

Because other people are _always_ slow to upgrade :)

However, I suppose it's fine to bring the requirement up with a
major version bump of Rack.  I don't want to burden you with
old cruft, either.

unicorn may also be able to drop the dependency on rack by
lazy loading:

* Rack::Utils::HTTP_STATUS_CODES is the main thing we use from
  Rack at runtime; and unicorn would actually function fine if
  the hash were empty; HTTP status lines would just be short
  and non-descriptive.

* The Rack::Builder dependency can be optional, even.

Fwiw, I plan to support Rack 1.x and Ruby 1.9.3 under unicorn for a few
more years because of LTS distros.  New versions take priority, of
course.

> On Fri, Jan 08, 2016 at 07:18:07PM +0000, Eric Wong wrote:
> > Adam Duke <adamduke@twitter.com> wrote:
> > > +++ b/unicorn.gemspec
> > > @@ -35,7 +35,11 @@
> > >    # up/downgrade to any other version, the Rack dependency may be
> > >    # commented out.  Nevertheless, upgrading to Rails 2.3.4 or later is
> > >    # *strongly* recommended for security reasons.
> > > -  s.add_dependency(%q<rack>)
> > > +  if RUBY_VERSION < '2.2.2'
> > > +    s.add_dependency(%q<rack>, '~> 1.6.4')
> > > +  else
> > > +    s.add_dependency(%q<rack>)
> > > +  end
> > 
> > Interesting, I built a gem with RubyGems 2.5.1 and this conditional
> > was preserved in the gemspec.  I tried this in the past (2009/2010?)
> > and any conditionals written like this got clobbered in the final
> > gemspec.
> 
> I wonder if that's true even after you upload to rubygems.org.  I'd
> guess it's not true as they don't want to support arbitrary ruby code
> for specs.

Ah, you're right.  I was looking at the gemspec which is distributed
with the gem source and not the regenerated gemspec which RubyGems
actually uses.

So yeah, it looks like Adam's patch only affects the gem build process.

^ permalink raw reply	[relevance 5%]

* Re: [PATCH] limit rack version for ruby compatibility
  2016-01-08 19:18  6% ` Eric Wong
@ 2016-01-08 21:50  0%   ` Aaron Patterson
  2016-01-08 22:37  5%     ` Eric Wong
  0 siblings, 1 reply; 89+ results
From: Aaron Patterson @ 2016-01-08 21:50 UTC (permalink / raw)
  To: rack-devel; +Cc: Adam Duke, unicorn-public

[-- Attachment #1: Type: text/plain, Size: 2839 bytes --]

On Fri, Jan 08, 2016 at 07:18:07PM +0000, Eric Wong wrote:
> Adam Duke <adamduke@twitter.com> wrote:
> > From: Adam Duke <adam.v.duke@gmail.com>
> > Date: Fri, 8 Jan 2016 13:06:31 -0500
> > Subject: [PATCH] limit rack version for ruby compatibility
> > 
> > rack introduced a dependency on ruby 2.2.2 or greater in
> > https://github.com/rack/rack/commit/771d94e5dbe53058160a1f8a4cc56384c1d2a048
> 
> Cc-ing rack-devel + Aaron
> 
> Yikes!  ruby-core still supports Ruby 2.1 and possibly even 2.0.0
> 
> And there doesn't seem to be any documentation on why Ruby 2.2.x
> is needed in the first place for rack.git
> commit a2fe30a5e70371c89c1b29fdc2dc5f8027bc5fe6
> 
> 	http://bogomips.org/mirrors/rack.git/patch?id=a2fe30a5e70371c8
> 
> Aaron?

The main reason I bumped it up to Ruby 2.2.x is because that will be the
minimum version of Ruby I'll be stuck with throughout Rack 2.x's
lifetime.  IOW, I can't drop Ruby versions in anything but a major
release so I'm being conservative and only going with the latest (at the
time that was 2.2).

I could be convinced to bring down the version number, but I'd like to
know why first. :)

> > In order to maintain support for ruby versions less than 2.2.2, limit
> > the rack dependency to supported versions for the current ruby.
> > ---
> >  unicorn.gemspec | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/unicorn.gemspec b/unicorn.gemspec
> > index 1099361..ce7080a 100644
> > --- a/unicorn.gemspec
> > +++ b/unicorn.gemspec
> > @@ -35,7 +35,11 @@
> >    # up/downgrade to any other version, the Rack dependency may be
> >    # commented out.  Nevertheless, upgrading to Rails 2.3.4 or later is
> >    # *strongly* recommended for security reasons.
> > -  s.add_dependency(%q<rack>)
> > +  if RUBY_VERSION < '2.2.2'
> > +    s.add_dependency(%q<rack>, '~> 1.6.4')
> > +  else
> > +    s.add_dependency(%q<rack>)
> > +  end
> 
> Interesting, I built a gem with RubyGems 2.5.1 and this conditional
> was preserved in the gemspec.  I tried this in the past (2009/2010?)
> and any conditionals written like this got clobbered in the final
> gemspec.

I wonder if that's true even after you upload to rubygems.org.  I'd
guess it's not true as they don't want to support arbitrary ruby code
for specs.

> In other words, conditionals used to be evaluated at "gem build" time,
> not "gem install" time.  We should check when this improvement was
> introduced into RubyGems should we go this route.
> 
> Also, maybe '~> 1.6.4' is too strict, '~> 1.6' could be better in case
> a rack 1.7 comes out in parallel to rack 2.0

Agree here.  1.7 may be possible, and I want to make the guarantee that
its API is backwards compatible with 1.6.

-- 
Aaron Patterson
http://tenderlovemaking.com/


[-- Attachment #2: Type: application/pgp-signature, Size: 456 bytes --]

^ permalink raw reply	[relevance 0%]

* Re: [PATCH] limit rack version for ruby compatibility
  @ 2016-01-08 19:18  6% ` Eric Wong
  2016-01-08 21:50  0%   ` Aaron Patterson
  0 siblings, 1 reply; 89+ results
From: Eric Wong @ 2016-01-08 19:18 UTC (permalink / raw)
  To: Adam Duke; +Cc: unicorn-public, Aaron Patterson, rack-devel

Adam Duke <adamduke@twitter.com> wrote:
> From: Adam Duke <adam.v.duke@gmail.com>
> Date: Fri, 8 Jan 2016 13:06:31 -0500
> Subject: [PATCH] limit rack version for ruby compatibility
> 
> rack introduced a dependency on ruby 2.2.2 or greater in
> https://github.com/rack/rack/commit/771d94e5dbe53058160a1f8a4cc56384c1d2a048

Cc-ing rack-devel + Aaron

Yikes!  ruby-core still supports Ruby 2.1 and possibly even 2.0.0

And there doesn't seem to be any documentation on why Ruby 2.2.x
is needed in the first place for rack.git
commit a2fe30a5e70371c89c1b29fdc2dc5f8027bc5fe6

	http://bogomips.org/mirrors/rack.git/patch?id=a2fe30a5e70371c8

Aaron?

> In order to maintain support for ruby versions less than 2.2.2, limit
> the rack dependency to supported versions for the current ruby.
> ---
>  unicorn.gemspec | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/unicorn.gemspec b/unicorn.gemspec
> index 1099361..ce7080a 100644
> --- a/unicorn.gemspec
> +++ b/unicorn.gemspec
> @@ -35,7 +35,11 @@
>    # up/downgrade to any other version, the Rack dependency may be
>    # commented out.  Nevertheless, upgrading to Rails 2.3.4 or later is
>    # *strongly* recommended for security reasons.
> -  s.add_dependency(%q<rack>)
> +  if RUBY_VERSION < '2.2.2'
> +    s.add_dependency(%q<rack>, '~> 1.6.4')
> +  else
> +    s.add_dependency(%q<rack>)
> +  end

Interesting, I built a gem with RubyGems 2.5.1 and this conditional
was preserved in the gemspec.  I tried this in the past (2009/2010?)
and any conditionals written like this got clobbered in the final
gemspec.

In other words, conditionals used to be evaluated at "gem build" time,
not "gem install" time.  We should check when this improvement was
introduced into RubyGems should we go this route.

Also, maybe '~> 1.6.4' is too strict, '~> 1.6' could be better in case
a rack 1.7 comes out in parallel to rack 2.0

^ permalink raw reply	[relevance 6%]

* [PUSHED] various documentation updates
@ 2016-01-07  3:41  4% Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2016-01-07  3:41 UTC (permalink / raw)
  To: unicorn-public

* add nntp_url to the olddoc website footer
* update legacy support status for 4.x (not 4.8.x)
* update copyright range to 2016
* note all of our development tools are Free Software, too
* remove cgit mention; it may not always be cgit
  (but URLs should remain compatible).
* discourage downloading snapshot tarballs;
  "git clone" + periodic "git fetch" is more efficient
* remove most mentions of unicorn_rails as that
  was meant for ancient Rails 1.x/2.x users
* update path reference to Ruby 2.3.0
* fix nginx upstream module link to avoid redirect
* shorten Message-ID example to avoid redirects
  and inadvertant linkage
---
  Also pushed to the website http://unicorn.bogomips.org/
  (using olddoc.git @ c98abe82b6b3 from git://80x24.org/olddoc.git)

  Curious, does anybody out there use Rails 2.x or earlier?

 .olddoc.yml                       |  1 +
 Documentation/unicorn.1.txt       |  1 -
 Documentation/unicorn_rails.1.txt |  2 +-
 HACKING                           |  2 +-
 README                            | 17 +++++------------
 lib/unicorn/configurator.rb       |  5 +++--
 lib/unicorn/http_server.rb        |  4 ++--
 7 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/.olddoc.yml b/.olddoc.yml
index 063c1c6..cda8ac3 100644
--- a/.olddoc.yml
+++ b/.olddoc.yml
@@ -13,3 +13,4 @@ noindex:
 - unicorn_rails_1
 public_email: unicorn-public@bogomips.org
 private_email: unicorn@bogomips.org
+nntp_url: nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn
diff --git a/Documentation/unicorn.1.txt b/Documentation/unicorn.1.txt
index efdda4b..3f20a9a 100644
--- a/Documentation/unicorn.1.txt
+++ b/Documentation/unicorn.1.txt
@@ -175,7 +175,6 @@ the unicorn config file.
 
 # SEE ALSO
 
-* unicorn_rails(1)
 * *Rack::Builder* ri/RDoc
 * *Unicorn::Configurator* ri/RDoc
 * [Unicorn RDoc][1]
diff --git a/Documentation/unicorn_rails.1.txt b/Documentation/unicorn_rails.1.txt
index bff703e..2ce7501 100644
--- a/Documentation/unicorn_rails.1.txt
+++ b/Documentation/unicorn_rails.1.txt
@@ -4,7 +4,7 @@
 
 # NAME
 
-unicorn_rails - a script/server-like command to launch the Unicorn HTTP server
+unicorn_rails - unicorn launcher for Rails 1.x and 2.x users
 
 # SYNOPSIS
 
diff --git a/HACKING b/HACKING
index 6c5f897..0fa22cd 100644
--- a/HACKING
+++ b/HACKING
@@ -57,7 +57,7 @@ Please wrap documentation at 72 characters-per-line or less (long URLs
 are exempt) so it is comfortably readable from terminals.
 
 When referencing mailing list posts, use
-"http://bogomips.org/unicorn-public/m/$MESSAGE_ID.html" if possible
+<tt>http://bogomips.org/unicorn-public/$MESSAGE_ID/</tt> if possible
 since the Message-ID remains searchable even if a particular site
 becomes unavailable.
 
diff --git a/README b/README
index db9f0d4..11de938 100644
--- a/README
+++ b/README
@@ -13,7 +13,7 @@ both the the request and response in between unicorn and slow clients.
   {nginx}[http://nginx.org/] or {Rack}[http://rack.github.io/].
 
 * Compatible with Ruby 1.9.3 and later.
-  unicorn 4.8.x will remain supported for Ruby 1.8 users.
+  unicorn 4.x remains 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
@@ -60,7 +60,7 @@ both the the request and response in between unicorn and slow clients.
 
 == License
 
-unicorn is copyright 2009 by all contributors (see logs in git).
+unicorn is copyright 2009-2016 by all contributors (see logs in git).
 It is based on Mongrel 1.1.5.
 Mongrel is copyright 2007 Zed A. Shaw and contributors.
 
@@ -68,7 +68,7 @@ unicorn is licensed under (your choice) of the GPLv2 or later
 (GPLv3+ preferred), or Ruby (1.8)-specific terms.
 See the included LICENSE file for details.
 
-unicorn is 100% Free Software.
+unicorn is 100% Free Software (including all development tools used).
 
 == Install
 
@@ -85,10 +85,9 @@ You can get the latest source via git from the following locations
   git://bogomips.org/unicorn.git
   git://repo.or.cz/unicorn.git (mirror)
 
-You may browse the code from the web and download the latest snapshot
-tarballs here:
+You may browse the code from the web:
 
-* http://bogomips.org/unicorn.git (cgit)
+* http://bogomips.org/unicorn.git
 * http://repo.or.cz/w/unicorn.git (gitweb)
 
 See the HACKING guide on how to contribute and build prerelease gems
@@ -102,12 +101,6 @@ In APP_ROOT, run:
 
   unicorn
 
-=== Ancient Rails 1.2 - 2.x versions
-
-In RAILS_ROOT, run:
-
-  unicorn_rails
-
 unicorn will bind to all interfaces on TCP port 8080 by default.
 You may use the +--listen/-l+ switch to bind to a different
 address:port or a UNIX socket.
diff --git a/lib/unicorn/configurator.rb b/lib/unicorn/configurator.rb
index 4da19bb..948c6e3 100644
--- a/lib/unicorn/configurator.rb
+++ b/lib/unicorn/configurator.rb
@@ -181,8 +181,6 @@ def before_exec(*args, &block)
   # to have nginx always retry backends that may have had workers
   # SIGKILL-ed due to timeouts.
   #
-  #    # See http://wiki.nginx.org/NginxHttpUpstreamModule for more details
-  #    # on nginx upstream configuration:
   #    upstream unicorn_backend {
   #      # for UNIX domain socket setups:
   #      server unix:/path/to/.unicorn.sock fail_timeout=0;
@@ -192,6 +190,9 @@ def before_exec(*args, &block)
   #      server 192.168.0.8:8080 fail_timeout=0;
   #      server 192.168.0.9:8080 fail_timeout=0;
   #    }
+  #
+  # See http://nginx.org/en/docs/http/ngx_http_upstream_module.html
+  # for more details on nginx upstream configuration.
   def timeout(seconds)
     set_int(:timeout, seconds, 3)
     # POSIX says 31 days is the smallest allowed maximum timeout for select()
diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index ca56ed3..741cca5 100644
--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
@@ -36,7 +36,7 @@ class Unicorn::HttpServer
   # or even different installations of the same applications without
   # downtime.  Keys of this constant Hash are described as follows:
   #
-  # * 0 - the path to the unicorn/unicorn_rails executable
+  # * 0 - the path to the unicorn executable
   # * :argv - a deep copy of the ARGV array the executable originally saw
   # * :cwd - the working directory of the application, this is where
   # you originally started Unicorn.
@@ -45,7 +45,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/2.2.0/bin/unicorn"
+  #   Unicorn::HttpServer::START_CTX[0] = "/home/bofh/2.3.0/bin/unicorn"
   START_CTX = {
     :argv => ARGV.map(&:dup),
     0 => $0.dup,
-- 
EW

^ permalink raw reply related	[relevance 4%]

* [ANN] unicorn 5.0.0.pre1 - incompatible changes!
@ 2015-06-15 22:56  5% Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2015-06-15 22:56 UTC (permalink / raw)
  To: unicorn-public

This release finally drops Ruby 1.8 support and requires Ruby 1.9.3
or later.  The horrible "Status:" header in our HTTP response is
finally gone, saving at least 16 precious bytes in every single HTTP
response.

Under Ruby 2.1 and later, the monotonic clock is used for timeout
handling for better accuracy.

Several experimental, unused and undocumented features are removed.

There's also tiny, minor performance and memory improvements from
dropping 1.8 compatibility, but probably nothing noticeable on a
typical real-life (bloated) app.

The biggest performance improvement we made was to our website by
switching to olddoc.  Depending on connection speed, latency, and
renderer performance, it typically loads two to four times faster.

Finally, for the billionth time: unicorn must never be exposed
to slow clients, as it will never ever use new-fangled things
like non-blocking socket I/O, threads, epoll or kqueue.  unicorn
must be used with a fully-buffering reverse proxy such as nginx
for slow clients.

I'll tag 5.0.0 final in a week or so if all goes well

= gem install --pre unicorn
= git clone git://bogomips.org/unicorn.git
= http://unicorn.bogomips.org/

* ISSUES: update with mailing list subscription
* GIT-VERSION-GEN: start 5.0.0 development
* http: remove xftrust options
* FAQ: add entry for Rails autoflush_log
* dev: remove isolate dependency
* unicorn.gemspec: depend on test-unit 3.0
* http_response: remove Status: header
* remove RubyForge and Freecode references
* remove mongrel.rubyforge.org references
* http: remove the keepalive requests limit
* http: reduce parser from 72 to 56 bytes on 64-bit
* examples: add run_once to before_fork hook example
* worker: remove old tmp accessor
* http_server: save 450+ bytes of memory on x86-64
* t/t0002-parser-error.sh: relax test for rack 1.6.0
* remove SSL support
* tmpio: drop the "size" method
* switch docs + website to olddoc
* README: clarify/reduce references to unicorn_rails
* gemspec: fixup olddoc migration
* use the monotonic clock under Ruby 2.1+
* http: -Wshorten-64-to-32 warnings on clang
* remove old inetd+git examples and exec_cgi
* http: standalone require + reduction in binary size
* GNUmakefile: fix clean gem build + reduce build cruft
* socket_helper: reduce constant lookups and caching
* remove 1.8, <= 1.9.1 fallback for missing IO#autoclose=
* favor IO#close_on_exec= over fcntl in 1.9+
* use require_relative to reduce syscalls at startup
* doc: update support status for Ruby versions
* fix uninstalled testing and reduce require paths
* test_socket_helper: do not depend on SO_REUSEPORT
* favor "a.b(&:c)" form over "a.b { |x| x.c }"
* ISSUES: add section for bugs in other projects
* http_server: favor ivars over constants
* explain 11 byte magic number for self-pipe
* const: drop constants used by Rainbows!
* reduce and localize constant string use
* Links: mark Rainbows! as historical, reference yahns
* save about 200 bytes of memory on x86-64
* http: remove deprecated reset method
* http: remove experimental dechunk! method
* socket_helper: update comments
* doc: document UNICORN_FD in manpage
* doc: document Etc.nprocessors for worker_processes
* favor more string literals for cold call sites
* tee_input: support for Rack::TempfileReaper middleware
* support TempfileReaper in deployment and development envs
* favor kgio_wait_readable for single FD over select
* Merge tag 'v4.9.0'
* http_request: support rack.hijack by default
* avoid extra allocation for hijack proc creation
* FAQ: add note about ECONNRESET errors from bodies
* process SIGWINCH unless stdin is a TTY
* ISSUES: discourage HTML mail strongly, welcome nyms
* http: use rb_hash_clear in Ruby 2.0+
* http_response: avoid special-casing for Rack < 1.5
* www: install NEWS.atom.xml properly
* http_server: remove a few more accessors and constants
* http_response: simplify regular expression
* move the socket into Rack env for hijacking
* http: move response_start_sent into the C ext
* FAQ: reorder bit on Rack 1.1.x and Rails 2.3.x
* ensure body is closed during hijack

-- 
EW

^ permalink raw reply	[relevance 5%]

* [ANN] unicorn 4.9.0 - Rack HTTP server for fast clients and *nix
@ 2015-04-24  3:17  8% Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2015-04-24  3:17 UTC (permalink / raw)
  To: ruby-talk; +Cc: unicorn-public, Mike Mulvaney

Unicorn is an HTTP server for Rack applications designed to only serve
fast clients on low-latency, high-bandwidth connections and take
advantage of features in Unix/Unix-like kernels.  Slow clients should
only be served by placing a reverse proxy capable of fully buffering
both the the request and response in between unicorn and slow clients.

* http://unicorn.bogomips.org/
* public list: unicorn-public@bogomips.org
* mail archives: http://bogomips.org/unicorn-public/
* git clone git://bogomips.org/unicorn.git
* http://unicorn.bogomips.org/NEWS.atom.xml

Changes:

  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
-- 
EW

^ permalink raw reply	[relevance 8%]

* unicorn 4.8.x-stable branch pushed to git
@ 2015-04-22 19:02  8% Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2015-04-22 19:02 UTC (permalink / raw)
  To: unicorn-public; +Cc: Mulvaney, Mike

Only backporting documentation + build/test system fixes, but I'll
probably apply and push the TeeInput patch in:
http://bogomips.org/unicorn-public/m/20150422183808.GA5277@dcvr.yhbt.net.txt

The following changes since commit 7087bb7ed5a1b9d9f24069cb92707d086668b6dc:

  unicorn 4.8.3 - the end of an era (2014-05-07 07:49:19 +0000)

are available in the git repository at:

  git://bogomips.org/unicorn 4.8.x-stable

for you to fetch changes up to 548e1e67d314f6ebd17df37ece0ee20632462f6f:

  doc: document UNICORN_FD in manpage (2015-04-22 18:57:39 +0000)

----------------------------------------------------------------
Eric Wong (19):
      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

 .document                             |  1 -
 .gitignore                            |  4 +-
 .wrongdoc.yml => .olddoc.yml          |  6 ++-
 Documentation/unicorn.1.txt           |  7 ++++
 FAQ                                   | 10 ++++-
 GNUmakefile                           | 71 +++++++++++++----------------------
 HACKING                               | 31 ++++-----------
 ISSUES                                | 46 +++++++++++++++++++++--
 KNOWN_ISSUES                          | 20 +++++-----
 Links                                 |  5 ++-
 README                                | 10 ++---
 Rakefile                              | 44 ----------------------
 Sandbox                               |  2 +-
 examples/unicorn.conf.rb              | 11 ++++++
 lib/unicorn/configurator.rb           |  2 -
 lib/unicorn/http_server.rb            |  6 ++-
 local.mk.sample                       | 59 -----------------------------
 script/isolate_for_tests              | 31 ---------------
 t/GNUmakefile                         |  6 +--
 t/README                              |  2 +-
 t/t0002-parser-error.sh               |  6 +--
 test/exec/test_exec.rb                |  2 +-
 test/test_helper.rb                   |  4 +-
 test/unit/test_http_parser.rb         |  6 +--
 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            |  6 +--
 test/unit/test_server.rb              |  6 +--
 test/unit/test_signals.rb             |  2 +-
 test/unit/test_socket_helper.rb       |  8 ++--
 test/unit/test_upload.rb              |  2 +-
 test/unit/test_util.rb                |  2 +-
 unicorn.gemspec                       | 13 +++----
 34 files changed, 167 insertions(+), 270 deletions(-)
 rename .wrongdoc.yml => .olddoc.yml (85%)
 delete mode 100644 local.mk.sample
 delete mode 100755 script/isolate_for_tests

^ permalink raw reply	[relevance 8%]

* [PATCH] fix uninstalled testing and reduce require paths
@ 2015-02-06 22:17  5% Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2015-02-06 22:17 UTC (permalink / raw)
  To: unicorn-public; +Cc: Eric Wong

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
---
 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_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 +-
 11 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/GNUmakefile b/GNUmakefile
index 8bd63ee..2995a6b 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)
@@ -119,14 +123,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 d5c8d2e..0c81072 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_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 bdca9f5..d0f0c79 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 994b990..8b09198 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
-- 
EW


^ permalink raw reply related	[relevance 5%]

* [PATCH] doc: update support status for Ruby versions
@ 2015-02-06 20:15  5% Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2015-02-06 20:15 UTC (permalink / raw)
  To: unicorn-public

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).
---
 HACKING                         | 23 +++-------------
 KNOWN_ISSUES                    | 20 +++++++-------
 README                          |  3 ++-
 Sandbox                         |  2 +-
 lib/unicorn/configurator.rb     |  2 --
 lib/unicorn/http_server.rb      |  4 +--
 local.mk.sample                 | 59 -----------------------------------------
 t/README                        |  2 +-
 test/unit/test_socket_helper.rb |  4 +--
 9 files changed, 22 insertions(+), 97 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 d14e608..69b4644 100644
--- a/lib/unicorn/configurator.rb
+++ b/lib/unicorn/configurator.rb
@@ -306,8 +306,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 95a8ffe..895f56d 100644
--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
@@ -67,7 +67,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,
@@ -453,7 +453,7 @@ class Unicorn::HttpServer
 
       # exec(command, hash) works in at least 1.9.1+, but will only be
       # required in 1.9.4/2.0.0 at earliest.
-      cmd << listener_fds if RUBY_VERSION >= "1.9.1"
+      cmd << listener_fds
       logger.info "executing #{cmd.inspect} (in #{Dir.pwd})"
       before_exec.call(self)
       exec(*cmd)
diff --git a/local.mk.sample b/local.mk.sample
deleted file mode 100644
index 25bca5d..0000000
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 dd6881c..994b990 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
-- 
EW

^ permalink raw reply related	[relevance 5%]

* [PATCH] GNUmakefile: fix clean gem build + reduce build cruft
@ 2015-02-04 20:16 10% Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2015-02-04 20:16 UTC (permalink / raw)
  To: unicorn-public

Ensure we have a NEWS file for building the gem beforehand.
We don't need to polute lib/ with object files, either.
---
 GNUmakefile | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/GNUmakefile b/GNUmakefile
index 4c40dc9..8bd63ee 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)
@@ -85,6 +82,7 @@ test-unit: $(wildcard test/unit/test_*.rb)
 $(slow_tests): $(test_prefix)/.stamp
 	@$(MAKE) $(shell $(awk_slow) $@)
 
+# ensure we can require just the HTTP parser without the rest of unicorn
 test-require: $(ext)/unicorn_http.$(DLEXT)
 	$(RUBY) --disable-gems -I$(ext) -runicorn_http -e Unicorn
 
@@ -134,7 +132,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
@@ -150,7 +147,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
 
@@ -160,7 +157,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 $@+ $@
-- 
EW


^ permalink raw reply related	[relevance 10%]

* Re: permissions on ChangeLog and NEWS
  @ 2013-11-25  6:52  6% ` Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2013-11-25  6:52 UTC (permalink / raw)
  To: unicorn list; +Cc: Ken Dreyer

Ken Dreyer <ktdreyer@ktdreyer.com> wrote:
> Would you mind using the newer version of wrongdoc when you release
> the next version of Unicorn?

Oops, will do.  Just upgraded the build/release machine :x
Thanks for the catch.
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

^ permalink raw reply	[relevance 6%]

* Re: Worker Timeout Debugging
  2013-04-20  0:52  6% Worker Timeout Debugging Bill Vieux
@ 2013-04-20  1:26  0% ` Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2013-04-20  1:26 UTC (permalink / raw)
  To: unicorn list

Bill Vieux <billv@yahoo.com> wrote:
> I am getting occasional worker timeouts for a Rails app hosted on
> Heroku. I have rack-timeout set at the top of the middleware with a
> shorter timeout than unicorn workers, but it is not firing for some
> reason.

Which version of Ruby is this and what C extensions are you using?
This is probably a buggy C extension which blocks the VM.

> Are there any recommended techniques to determine the call stack when
> the worker is reaped?

Not the call stack, but you can get the Rails endpoint regardless of
Ruby version:

  Ensure your Rails logger is configured to log the PID at the start
  of every request.  (I think Rails logs parameters by default for
  every request).

  Match up the killed workers logging from unicorn to the PIDs that
  started a request (but never logged a completion) in the Rails log.

> The solutions that come to mind for me seem to require running a
> customized build of unicorn. For example: start a script (e.g., gdb to
> attach and core dump the worker) before (or in place of) sending the
> SIGKILL.

If you're using Ruby 1.9 or later, maybe sending SIGBUS/SIGSEGV can work
to trigger a Ruby core dump.

Do not attempt to install SIGSEGV/BUS handler(s) via Ruby, Ruby 1.9
already handles those internally.  Ruby 2.0.0 prevents trapping SEGV/BUS
with Ruby-level Signal#trap handlers, even.
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

^ permalink raw reply	[relevance 0%]

* Worker Timeout Debugging
@ 2013-04-20  0:52  6% Bill Vieux
  2013-04-20  1:26  0% ` Eric Wong
  0 siblings, 1 reply; 89+ results
From: Bill Vieux @ 2013-04-20  0:52 UTC (permalink / raw)
  To: mongrel-unicorn

I am getting occasional worker timeouts for a Rails app hosted on
Heroku. I have rack-timeout set at the top of the middleware with a
shorter timeout than unicorn workers, but it is not firing for some
reason.

Are there any recommended techniques to determine the call stack when
the worker is reaped?

The solutions that come to mind for me seem to require running a
customized build of unicorn. For example: start a script (e.g., gdb to
attach and core dump the worker) before (or in place of) sending the
SIGKILL.
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[relevance 6%]

* Re: No middleware without touching RACK_ENV
  @ 2013-01-28 14:43  3%   ` Lin Jen-Shin (godfat)
  0 siblings, 0 replies; 89+ results
From: Lin Jen-Shin (godfat) @ 2013-01-28 14:43 UTC (permalink / raw)
  To: unicorn list

On Sat, Jan 26, 2013 at 2:39 AM, Eric Wong <normalperson@yhbt.net> wrote:
> Doesn't Rails favor RAILS_ENV over RACK_ENV?  unicorn ignores RAILS_ENV
> (unicorn_rails respects RAILS_ENV, but unicorn_rails isn't recommended
> for modern (Rack-enabled) Rails)

Yes, it is. But it would still look into RACK_ENV if RAILS_ENV is not available.
One solution would be setting RAILS_ENV=development while setting
RACK_ENV=none. I don't really want to do this for several reasons:

* It would be better to keep RAILS_ENV == RACK_ENV to avoid confusion.
* It might be tricky to make RAILS_ENV default to development while setting
  RACK_ENV since Rails would be looking into it. So we need to make sure
  that Rails is loaded and default to development and then we can setup
  RACK_ENV to avoid messing up the original Rails default.

> Is there a benefit which RACK_ENV=development gives you for Rails
> that RAILS_ENV=development does not give you?

The main reason is that I want to avoid confusion. The other reason
is that that's also how Heroku tries to use. I think it's also because of
consistency. (so that we don't have to distinguish RACK_ENV and RAILS_ENV)

The other reason would be making them different might cause some
issues as Rails would also be looking at RACK_ENV.

> Fwiw, the times I worked on Rails, I used customized dev environments
> anyways, so I would use RAILS_ENV=dev_local or RAILS_ENV=dev_$NETWORK
> for switching between a localhost-only vs networked setup.

I would also do this I guess, but since I am not the only one working on
the application, I would avoid making such changes. We have a lot of
configurations depending on the word "development" already.

>> I know this is somehow a spec from Rack, but I guess I
>> don't like this behaviour. One workaround would be
>> providing a `after_app_load' hook, and we add this to
>> the bottom of config.ru:
>>
>>   ENV['RACK_ENV_ORIGINAL'] = ENV['RACK_ENV']
>>   ENV['RACK_ENV'] = 'none'
>>
>> and add this to the unicorn configuration file:
>>
>>   after_app_load do |_|
>>     ENV['RACK_ENV'] = ENV['RACK_ENV_ORIGINAL']
>>   end
>>
>> This is probably a stupid hack, but I wonder if after_app_load
>> hook would be useful for other cases?
>
> I don't see how this hook has benefits over putting this in config.ru
> (or somewhere else in your app, since your app is already loaded...)

It's better to me because it's clear on the loading order.
The point where to change RACK_ENV=none would be
after Rails loaded (to avoid messing Rails up), and
_before Unicorn inserting middleware_. And then I would
like to switch RACK_ENV=RAILS_ENV to avoid confusion.
It's hard to tell where I can put this code.

> I'd imagine users wanting the same app-wide settings going between
> different application servers, too.

Speaking to this, I might want to complain about the other severs :P
As far as I know, only if you use `rackup' would you get those middleware.

That is, `unicorn' is compatible with `rackup'. That's a good thing.
But it seems to me that both `thin' and `puma' (and maybe including
others, I didn't check) would not do this if you use their command line
tools. They even have different options to enable Rack::CommonLogger.

Actually this is also the reason why sometimes `thin' and `unicorn'
worked differently when people switching from Thin to Unicorn.
And you know a lot of people are using Thin in the first place,
thus sometimes blaming Unicorn works differently.

I am not sure how many people are using `rackup', but according to
my observation, not too much. If people are using Sinatra directly,
eventually they would launch the server via Rack::Handler.get.run,
which does not try to wrap additional middleware as what `rackup'
would do if I read correctly.

So I am not sure if a lot of people would be expecting this actually.
I used to use `rackup' a lot to get consistent behaviour, but it looks to
me not many people even know the existence of rackup :(

> I'm against adding more command-line or config options, especially
> around loading middleware.  RACK_ENV is already a source of confusion,
> and Rails also has/(or had?) it's own middleware loading scheme
> independent of config.ru.

Yes, I hate that, too. I can't complain about Rails less :P I don't understand
why people are building those middleware scheme on their own way,
even Sinatra does this. I guess they want more control over middleware,
so that they can reorder, delete, insert more/less middleware somehow.
I guess that makes sense in some way... but they should be really in
Rack instead of each web framework IMHO.

> git format-patch + git send-email is the recommended way if your
> mail client cannot be taught to leave formatting alone.  Also this
> is easy for sending multiple patches in the same thread.
>
> git format-patch --stdout with a good mail client which will not wrap
> messages is also great (especially for single patches).
>
> Attachments (generated using git format-patch) for text/x-diff should be
> accepted by Mailman.  Attached patches are a last resort, I prefer
> inline patches since I can quote/reply to them inline.
>
> (same patch submission guidelines as git or Linux kernel)

Last time I tried to setup SMTP for git send-email failed.
I'll try again next time. Thanks!

> Commit messages should explain why a change is made/needed, not just
> what it does.

Yeah, I know, but I can understand if none of them is acceptable,
(that's why I didn't bring this up in the first place) and the reason to
build those features might be arguing. So instead of writing them
carefully, I decided to bring this up sooner and then we can work out
the true reason later on :D

Thanks a lot for your time.
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

^ permalink raw reply	[relevance 3%]

* Re: Unicorn fails to install even though it's already installed and running
  2012-12-06 20:23  0% ` Eric Wong
@ 2012-12-06 21:11  0%   ` Mac Martine
  0 siblings, 0 replies; 89+ results
From: Mac Martine @ 2012-12-06 21:11 UTC (permalink / raw)
  To: unicorn list

Thanks,

I can install other gems just fine in the same way, so it doesn't seem like permissions then, right?

And disk space looks ok:
df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda1             38G   17G   21G  45% /
udev                  490M  4.0K  490M   1% /dev
tmpfs                 199M  240K  199M   1% /run
none                  5.0M     0  5.0M   0% /run/lock
none                  497M     0  497M   0% /run/shm


Here's the end of mkmf.log

have_macro: checking for SIZEOF_SIZE_T in ruby.h... -------------------- no

"gcc -I. -I/usr/lib/ruby/1.8/x86_64-linux -I.    -fno-strict-aliasing -g -g -O2  -fPIC     -c conftest.c"
conftest.c:4:3: error: #error
conftest.c:5:1: error: expected identifier or ‘(’ before ‘>>’ token
checked program was:
/* begin */
1: #include <ruby.h>
2: /*top*/
3: #ifndef SIZEOF_SIZE_T
4: # error
5: >>>>>> SIZEOF_SIZE_T undefined <<<<<<
6: #endif
/* end */

--------------------

check_sizeof: checking size of size_t in sys/types.h... -------------------- 8

"gcc -o conftest -I. -I/usr/lib/ruby/1.8/x86_64-linux -I.    -fno-strict-aliasing -g -g -O2  -fPIC   conftest.c  -L. -L/usr/lib -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic     -lruby1.8-static  -lpthread -lrt -ldl -lcrypt -lm   -lc"
checked program was:
/* begin */
1: #include <sys/types.h>
2:
3: #include <stdio.h>
4: /*top*/
5: int conftest_const = (int)(sizeof(size_t));
6: int main() {printf("%d\n", conftest_const); return 0;}
/* end */

./conftest |
--------------------

have_macro: checking for SIZEOF_LONG in ruby.h... -------------------- yes

"gcc -I. -I/usr/lib/ruby/1.8/x86_64-linux -I.    -fno-strict-aliasing -g -g -O2  -fPIC     -c conftest.c"
checked program was:
/* begin */
1: #include <ruby.h>
2: /*top*/
3: #ifndef SIZEOF_LONG
4: # error
5: >>>>>> SIZEOF_LONG undefined <<<<<<
6: #endif
/* end */

--------------------

have_func: checking for rb_str_set_len() in ruby.h... -------------------- yes

"gcc -o conftest -I. -I/usr/lib/ruby/1.8/x86_64-linux -I.    -fno-strict-aliasing -g -g -O2  -fPIC   conftest.c  -L. -L/usr/lib -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic     -lruby1.8-static  -lpthread -lrt -ldl -lcrypt -lm   -lc"
checked program was:
/* begin */
1: #include <ruby.h>
2:
3: /*top*/
4: int main() { return 0; }
5: int t() { void ((*volatile p)()); p = (void ((*)()))rb_str_set_len; return 0; }
/* end */

--------------------

have_func: checking for gmtime_r() in time.h... -------------------- yes

"gcc -o conftest -I. -I/usr/lib/ruby/1.8/x86_64-linux -I.    -fno-strict-aliasing -g -g -O2  -fPIC   conftest.c  -L. -L/usr/lib -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic     -lruby1.8-static  -lpthread -lrt -ldl -lcrypt -lm   -lc"
checked program was:
/* begin */
1: #include <time.h>
2:
3: /*top*/
4: int main() { return 0; }
5: int t() { void ((*volatile p)()); p = (void ((*)()))gmtime_r; return 0; }
/* end */

--------------------




On Dec 6, 2012, at 12:23 PM, Eric Wong <normalperson@yhbt.net> wrote:

> Mac Martine <99miles@gmail.com> wrote:
>> I'm deploying a Rails 3.2.8 app to Ubuntu. The server already runs the app with Unicorn and Nginx. 
>> unicorn -v returns unicorn v4.4.0
>> 
>> Adn rvm gem list shows:
>> unicorn (4.4.0)
>> 
>> Yet when I manually run 'gem install unicorn '4.4.0' it fails with the following. Any ideas why?
> 
> Not sure, yet, (see below)
> 
> Then there's also errors which may not be logged correctly: permissions
> and out-of-disk-space errors
> 
>>    Installing unicorn (4.4.0)
>>     ** [out :: mydomain.net] with native extensions
>>     ** [out :: mydomain.net] 
>>     ** [out :: mydomain.net] Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
>>     ** [out :: mydomain.net] 
>>     ** [out :: mydomain.net] /home/eg/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
>>     ** [out :: mydomain.net] checking for SIZEOF_OFF_T in ruby.h... *** extconf.rb failed ***
>>     ** [out :: mydomain.net] Could not create Makefile due to some reason, probably lack of
>>     ** [out :: mydomain.net] necessary libraries and/or headers.  Check the mkmf.log file for more
>>     ** [out :: mydomain.net] details.  You may need configuration options.
> 
>>     ** [out :: mydomain.net] Gem files will remain installed in /rails_apps/eg/production/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0 for inspection.
>>     ** [out :: mydomain.net] Results logged to /rails_apps/eg/production/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/ext/unicorn_http/gem_make.out
> 
> Maybe gem_make.out will have more info than mkmf.log
> 
>> Here's the content from what I _think_ is the relevant mkmf.log
>> 
>>    have_macro: checking for SIZEOF_SIZE_T in ruby.h... -------------------- yes
>> 
>>    "gcc -I/home/evergreen/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/x86_64-linux -I/home/eg/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/backward -I/home/eg/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1 -I. -I/home/eg/.rvm/usr/include     -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC   -c conftest.c"
>>    checked program was:
>>    /* begin */
>>    1: #include "ruby.h"
>>    2:
>>    3: #include <ruby.h>
>>    4: /*top*/
>>    5: #ifndef SIZEOF_SIZE_T
>>    6: # error
>>    7: >>>>>> SIZEOF_SIZE_T undefined <<<<<<
>>    8: #endif
>>    /* end */
>> 
>>    --------------------
>> 
>>    have_macro: checking for SIZEOF_LONG in ruby.h... -------------------- yes
> 
> That looks fine, actually.  I think any error will be near the end of
> mkmf.log.
> _______________________________________________
> Unicorn mailing list - mongrel-unicorn@rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-unicorn
> Do not quote signatures (like this one) or top post when replying

_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

^ permalink raw reply	[relevance 0%]

* Re: Unicorn fails to install even though it's already installed and running
  2012-12-06 19:48  3% Unicorn fails to install even though it's already installed and running Mac Martine
@ 2012-12-06 20:23  0% ` Eric Wong
  2012-12-06 21:11  0%   ` Mac Martine
  0 siblings, 1 reply; 89+ results
From: Eric Wong @ 2012-12-06 20:23 UTC (permalink / raw)
  To: unicorn list

Mac Martine <99miles@gmail.com> wrote:
> I'm deploying a Rails 3.2.8 app to Ubuntu. The server already runs the app with Unicorn and Nginx. 
> unicorn -v returns unicorn v4.4.0
> 
> Adn rvm gem list shows:
> unicorn (4.4.0)
> 
> Yet when I manually run 'gem install unicorn '4.4.0' it fails with the following. Any ideas why?

Not sure, yet, (see below)

Then there's also errors which may not be logged correctly: permissions
and out-of-disk-space errors

>     Installing unicorn (4.4.0)
>      ** [out :: mydomain.net] with native extensions
>      ** [out :: mydomain.net] 
>      ** [out :: mydomain.net] Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
>      ** [out :: mydomain.net] 
>      ** [out :: mydomain.net] /home/eg/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
>      ** [out :: mydomain.net] checking for SIZEOF_OFF_T in ruby.h... *** extconf.rb failed ***
>      ** [out :: mydomain.net] Could not create Makefile due to some reason, probably lack of
>      ** [out :: mydomain.net] necessary libraries and/or headers.  Check the mkmf.log file for more
>      ** [out :: mydomain.net] details.  You may need configuration options.

>      ** [out :: mydomain.net] Gem files will remain installed in /rails_apps/eg/production/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0 for inspection.
>      ** [out :: mydomain.net] Results logged to /rails_apps/eg/production/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/ext/unicorn_http/gem_make.out

Maybe gem_make.out will have more info than mkmf.log

> Here's the content from what I _think_ is the relevant mkmf.log
> 
>     have_macro: checking for SIZEOF_SIZE_T in ruby.h... -------------------- yes
>     
>     "gcc -I/home/evergreen/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/x86_64-linux -I/home/eg/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/backward -I/home/eg/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1 -I. -I/home/eg/.rvm/usr/include     -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC   -c conftest.c"
>     checked program was:
>     /* begin */
>     1: #include "ruby.h"
>     2:
>     3: #include <ruby.h>
>     4: /*top*/
>     5: #ifndef SIZEOF_SIZE_T
>     6: # error
>     7: >>>>>> SIZEOF_SIZE_T undefined <<<<<<
>     8: #endif
>     /* end */
>     
>     --------------------
>     
>     have_macro: checking for SIZEOF_LONG in ruby.h... -------------------- yes

That looks fine, actually.  I think any error will be near the end of
mkmf.log.
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

^ permalink raw reply	[relevance 0%]

* Unicorn fails to install even though it's already installed and running
@ 2012-12-06 19:48  3% Mac Martine
  2012-12-06 20:23  0% ` Eric Wong
  0 siblings, 1 reply; 89+ results
From: Mac Martine @ 2012-12-06 19:48 UTC (permalink / raw)
  To: mongrel-unicorn

I'm deploying a Rails 3.2.8 app to Ubuntu. The server already runs the app with Unicorn and Nginx. 
unicorn -v returns unicorn v4.4.0

Adn rvm gem list shows:
unicorn (4.4.0)

Yet when I manually run 'gem install unicorn '4.4.0' it fails with the following. Any ideas why?

    Installing unicorn (4.4.0)
     ** [out :: mydomain.net] with native extensions
     ** [out :: mydomain.net] 
     ** [out :: mydomain.net] Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
     ** [out :: mydomain.net] 
     ** [out :: mydomain.net] /home/eg/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
     ** [out :: mydomain.net] checking for SIZEOF_OFF_T in ruby.h... *** extconf.rb failed ***
     ** [out :: mydomain.net] Could not create Makefile due to some reason, probably lack of
     ** [out :: mydomain.net] necessary libraries and/or headers.  Check the mkmf.log file for more
     ** [out :: mydomain.net] details.  You may need configuration options.
     ** [out :: mydomain.net] 
     ** [out :: mydomain.net] Provided configuration options:
     ** [out :: mydomain.net] --with-opt-dir
     ** [out :: mydomain.net] --with-opt-include
     ** [out :: mydomain.net] --without-opt-include=${opt-dir}/include
     ** [out :: mydomain.net] --with-opt-lib
     ** [out :: mydomain.net] --without-opt-lib=${opt-dir}/lib
     ** [out :: mydomain.net] --with-make-prog
     ** [out :: mydomain.net] --without-make-prog
     ** [out :: mydomain.net] --srcdir=.
     ** [out :: mydomain.net] --curdir
     ** [out :: mydomain.net] --ruby=/home/eg/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
     ** [out :: mydomain.net] /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
     ** [out :: mydomain.net] You have to install development tools first.
     ** [out :: mydomain.net] from /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:491:in `block in try_compile'
     ** [out :: mydomain.net] from /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:443:in `with_werror'
     ** [out :: mydomain.net] from /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:491:in `try_compile'
     ** [out :: mydomain.net] from /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:686:in `macro_defined?'
     ** [out :: mydomain.net] from /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:822:in `block in have_macro'
     ** [out :: mydomain.net] from /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
     ** [out :: mydomain.net] from /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
     ** [out :: mydomain.net] from /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
     ** [out :: mydomain.net] from /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
     ** [out :: mydomain.net] from /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
     ** [out :: mydomain.net] from /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
     ** [out :: mydomain.net] from /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
     ** [out :: mydomain.net] 
     ** [out :: mydomain.net] from /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:821:in `have_macro'
     ** [out :: mydomain.net] from extconf.rb:4:in `<main>'
     ** [out :: mydomain.net] 
     ** [out :: mydomain.net] 
     ** [out :: mydomain.net] Gem files will remain installed in /rails_apps/eg/production/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0 for inspection.
     ** [out :: mydomain.net] Results logged to /rails_apps/eg/production/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/ext/unicorn_http/gem_make.out
     ** [out :: mydomain.net] 
     ** [out :: mydomain.net] An error occurred while installing unicorn (4.4.0), and Bundler cannot continue.
     ** [out :: mydomain.net] Make sure that `gem install unicorn -v '4.4.0'` succeeds before bundling.



Here's the content from what I _think_ is the relevant mkmf.log

    have_macro: checking for SIZEOF_SIZE_T in ruby.h... -------------------- yes
    
    "gcc -I/home/evergreen/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/x86_64-linux -I/home/eg/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/backward -I/home/eg/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1 -I. -I/home/eg/.rvm/usr/include     -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC   -c conftest.c"
    checked program was:
    /* begin */
    1: #include "ruby.h"
    2:
    3: #include <ruby.h>
    4: /*top*/
    5: #ifndef SIZEOF_SIZE_T
    6: # error
    7: >>>>>> SIZEOF_SIZE_T undefined <<<<<<
    8: #endif
    /* end */
    
    --------------------
    
    have_macro: checking for SIZEOF_LONG in ruby.h... -------------------- yes
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

^ permalink raw reply	[relevance 3%]

* Re: Testing Unicorn on Rubinius
  @ 2012-11-13  0:18  6% ` Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2012-11-13  0:18 UTC (permalink / raw)
  To: unicorn list

mike <michael.p.thompson@gmail.com> wrote:
> (or at least trying very valiantly). At them moment I am having
> trouble getting my environment set up in such a way, as to run the:
> 
> make -j4 test
> 
> command. I am having issues resolving my environment and load paths
> against what the unicorn project is looking for. I was curious if
> there were any examples of environments or setups for testing Unicorn.
> I have read the README files located in the project, and attempted
> setting my "RUBYLIB" variable in the  local.mk . If someone could get
> me started/pointed in the right direction, I would really like to help
> out with Rubinius, and maybe even Unicorn in the future.  Here is a
> gist of my output:

Everything should work if the "isolate" RubyGem is installed.

I admit I haven't tested under Rubinius in a while, but I have
made efforts in the past to ensure Rubinius worked.
(nobody seemed interested and it took too much space/time to
build on my machine)

> https://gist.github.com/4062317

> mike@sm-mike-thinkpad:~/workspace/rubinius_testing/unicorn-4.4.0$ RUBYLIB=/home/mike/.rvm/gems/rbx-2.0.testing/ make -j4 test
> * test/unit/test_configurator.rb
> * test/unit/test_droplet.rb
> * test/unit/test_http_parser_ng.rb
> * test/unit/test_http_parser.rb
> : An exception occurred running test/unit/test_droplet.rb
> :     no such file to load -- rack (LoadError)

That should've picked up and run Isolate for you.  Can you ensure
isolate is installed, first?
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

^ permalink raw reply	[relevance 6%]

* Re: [PATCH] explicitly use escaped minus in man pages
  2012-10-15 18:50  6% ` Eric Wong
@ 2012-10-17 15:33  0%   ` Hleb Valoshka
  0 siblings, 0 replies; 89+ results
From: Hleb Valoshka @ 2012-10-17 15:33 UTC (permalink / raw)
  To: unicorn list

On 10/15/12, Eric Wong <normalperson@yhbt.net> wrote:
> All the manpages are generated with pandoc.  Can you send a patch
> for the Markdown files in Documentation/*.1.txt instead?  Thanks
> in advance.

I'll try but I'm not sure that it's possible, it seems to be only
groff-specific issue to treat minus as hyphen.

May be it's better to try to patch pandoc.

> I generate manpages using pandoc 1.5.1.1-5+b1 from Debian stable
> using: make -C Documentation

I'll try it with pandoc 1.9.4.2-2 from sid, maybe it knows groff
better than 1.5 :)

> However, I think distributing your patch as-is with the Debian source
> package is fine to avoid an extra Build-Depends on pandoc+haskell until
> the next unicorn release.

I should agree with you.
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

^ permalink raw reply	[relevance 0%]

* Re: [PATCH] explicitly use escaped minus in man pages
  @ 2012-10-15 18:50  6% ` Eric Wong
  2012-10-17 15:33  0%   ` Hleb Valoshka
  0 siblings, 1 reply; 89+ results
From: Eric Wong @ 2012-10-15 18:50 UTC (permalink / raw)
  To: unicorn list; +Cc: Hleb Valoshka

Hleb Valoshka <375gnu@gmail.com> wrote:

Hi, the commit message body needs to include the reasoning behind
this change.

Something along the lines of your second email would be good.
ref: mid.gmane.org/CAAB-Kckmf0AKGscbCr0y7w7RxWiPJw5_V700BEc3DTUqNfemYA@mail.gmail.com

> ---
>  man/man1/unicorn.1       |   32 ++++++++++++++++----------------
>  man/man1/unicorn_rails.1 |   34 +++++++++++++++++-----------------

All the manpages are generated with pandoc.  Can you send a patch
for the Markdown files in Documentation/*.1.txt instead?  Thanks
in advance.

I generate manpages using pandoc 1.5.1.1-5+b1 from Debian stable
using: make -C Documentation

However, I think distributing your patch as-is with the Debian source
package is fine to avoid an extra Build-Depends on pandoc+haskell until
the next unicorn release.
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

^ permalink raw reply	[relevance 6%]

* Re: [raindrops] testers on 32-bit FreeBSD wanted
  @ 2012-05-12  6:05  5% ` Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2012-05-12  6:05 UTC (permalink / raw)
  To: mongrel-unicorn

Eric Wong <normalperson@yhbt.net> wrote:
> Since unicorn users are raindrops users, I'd appreciate it if
> 32-bit FreeBSD users can give this a try.  Thanks!

I've tested on a i386 FreeBSD 9.0 install I made and seems fine.
Not sure about FreeBSD 7.0, though, but that's pretty ancient...

Anyways, raindrops 0.8.1 is out.

Changes:

This release fixes a build problem found under a current SmartOS.  This
release also runs successfully on FreeBSD 9.0 under both x86-64 and
i386.

There are also documentation updates from Aman Gupta and a test suite
fix from Jeremy Evans for OpenBSD.

raindrops fully supports unicorn on recent versions of FreeBSD, OpenBSD,
SmartOS, and possibly other Free Software systems.  Portability reports
and fixes for Free Software systems is greatly appreciated at
raindrops@librelist.org

Non-Free systems will never be supported.

raindrops requires the Linux 2.6.18 or later for full functionality
(which unicorn does not require).  Future releases will take advantage
of the unix_diag functionality found in the Linux 3.3 (and later)
kernels.

* http://raindrops.bogomips.org/
* raindrops@librelist.org
* git://bogomips.org/raindrops.git
* http://raindrops.bogomips.org/NEWS.atom.xml
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

^ permalink raw reply	[relevance 5%]

* Re: unicorn 4 does not compile on Joyent (SmartOS/Solaris) due to raindrops dependency
  2012-05-09  7:02  5% ` Eric Wong
@ 2012-05-09  7:11  0%   ` Konstantin Gredeskoul
  0 siblings, 0 replies; 89+ results
From: Konstantin Gredeskoul @ 2012-05-09  7:11 UTC (permalink / raw)
  To: unicorn list

Eric, awesome and thanks for replying!

I'll email you privately to chase this down.

K

On Wed, May 9, 2012 at 12:02 AM, Eric Wong <normalperson@yhbt.net> wrote:
> Konstantin Gredeskoul <kig@wanelo.com> wrote:
>> However, the raindrops dependency introduced in 4.0 breaks raindrops
>> (and therefore unicorn 4) on SmartOS.
>>
>> The fact that the compilation breaks in the file named
>> "linux_inet_diag.c" makes me believe that perhaps the authors may not
>> have anticipated usage beyond Linux, or there may be some other
>
> That file is Linux-specific, but the rest of raindrops (and unicorn)
> works on FreeBSD, OpenBSD and probably others.  I have every expectation
> it'd work on SmartOS[1]
>
>> > uname -a
>> SunOS demo001.dev 5.11 joyent_XXXX i86pc i386 i86pc Solaris
>                                           ^^^^
>
>> > file .rvm/rubies/ruby-1.9.3-p194/bin/ruby
>> .rvm/rubies/ruby-1.9.3-p194/bin/ruby:   ELF 64-bit LSB executable
>> AMD64 Version 1, dynamically linked, not stripped
>  ^^^^^
>
> Are you running a mixed 32-bit/64-bit installation?
> Can you check the build system isn't picking the wrong compiler
> or compiler flags?
>
>> make
>> compiling linux_inet_diag.c
>> linux_inet_diag.c:1:0: error: CPU you selected does not support x86-64
>> instruction set
>
> That's odd, the first line is just #include <ruby.h>
>
> You can try emptying/removing that file completely?  (maybe
> linux_tcp_diag.c, too).
>
> Your env shouldn't define the __linux__ macro.  The linux_* files is
> wrapped with an #ifdef __linux__, so those files shouldn't even
> be compiled on other OSes.
>
> The portable part of raindrops does use CPU-specific atomics
> (which GCC or libatomic_ops provides).  Ruby 1.9.3 itself uses
> these instructions, too.
>
>
> [1] - SmartOS seems to be Free Software, so I can actually support it :)
> _______________________________________________
> Unicorn mailing list - mongrel-unicorn@rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-unicorn
> Do not quote signatures (like this one) or top post when replying



-- 

Konstantin Gredeskoul
CTO :: Wanelo Inc
cell: (415) 265 1054
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

^ permalink raw reply	[relevance 0%]

* Re: unicorn 4 does not compile on Joyent (SmartOS/Solaris) due to raindrops dependency
  2012-05-09  6:18  6% unicorn 4 does not compile on Joyent (SmartOS/Solaris) due to raindrops dependency Konstantin Gredeskoul
@ 2012-05-09  7:02  5% ` Eric Wong
  2012-05-09  7:11  0%   ` Konstantin Gredeskoul
  0 siblings, 1 reply; 89+ results
From: Eric Wong @ 2012-05-09  7:02 UTC (permalink / raw)
  To: unicorn list

Konstantin Gredeskoul <kig@wanelo.com> wrote:
> However, the raindrops dependency introduced in 4.0 breaks raindrops
> (and therefore unicorn 4) on SmartOS.
> 
> The fact that the compilation breaks in the file named
> "linux_inet_diag.c" makes me believe that perhaps the authors may not
> have anticipated usage beyond Linux, or there may be some other

That file is Linux-specific, but the rest of raindrops (and unicorn)
works on FreeBSD, OpenBSD and probably others.  I have every expectation
it'd work on SmartOS[1]

> > uname -a
> SunOS demo001.dev 5.11 joyent_XXXX i86pc i386 i86pc Solaris
                                           ^^^^

> > file .rvm/rubies/ruby-1.9.3-p194/bin/ruby
> .rvm/rubies/ruby-1.9.3-p194/bin/ruby:   ELF 64-bit LSB executable
> AMD64 Version 1, dynamically linked, not stripped
  ^^^^^

Are you running a mixed 32-bit/64-bit installation?
Can you check the build system isn't picking the wrong compiler
or compiler flags?

> make
> compiling linux_inet_diag.c
> linux_inet_diag.c:1:0: error: CPU you selected does not support x86-64
> instruction set

That's odd, the first line is just #include <ruby.h>

You can try emptying/removing that file completely?  (maybe
linux_tcp_diag.c, too).

Your env shouldn't define the __linux__ macro.  The linux_* files is
wrapped with an #ifdef __linux__, so those files shouldn't even
be compiled on other OSes.

The portable part of raindrops does use CPU-specific atomics
(which GCC or libatomic_ops provides).  Ruby 1.9.3 itself uses
these instructions, too.


[1] - SmartOS seems to be Free Software, so I can actually support it :)
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

^ permalink raw reply	[relevance 5%]

* unicorn 4 does not compile on Joyent (SmartOS/Solaris) due to raindrops dependency
@ 2012-05-09  6:18  6% Konstantin Gredeskoul
  2012-05-09  7:02  5% ` Eric Wong
  0 siblings, 1 reply; 89+ results
From: Konstantin Gredeskoul @ 2012-05-09  6:18 UTC (permalink / raw)
  To: mongrel-unicorn

Dear unicorn developer list,

I did a quick search online and couldn't find many reports, but I
thought I'd find out anyway.

Joyent cloud is a pretty awesomely fast cloud running on Solaris
derivative (SmartOS). Pretty much the entire ruby stack, including
imagemagick (the perennial nightmare) build without problems with ruby
1.9.3, as does unicorn up until version 3.7.0.

However, the raindrops dependency introduced in 4.0 breaks raindrops
(and therefore unicorn 4) on SmartOS.

The fact that the compilation breaks in the file named
"linux_inet_diag.c" makes me believe that perhaps the authors may not
have anticipated usage beyond Linux, or there may be some other
reason. In any case, it would be great to be able to run latest
unicorn on SmartOS, so if anyone has any suggestion please let me know
how. In the meantime we are running on 3.7.0.

Best regards,
Konstantin

> uname -a
SunOS demo001.dev 5.11 joyent_XXXX i86pc i386 i86pc Solaris

> file .rvm/rubies/ruby-1.9.3-p194/bin/ruby
.rvm/rubies/ruby-1.9.3-p194/bin/ruby:   ELF 64-bit LSB executable
AMD64 Version 1, dynamically linked, not stripped

> gem install raindrops
Fetching: raindrops-0.8.0.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing raindrops:
        ERROR: Failed to build gem native extension.

        /home/wanelo/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for mmap() in sys/mman.h... yes
checking for munmap() in sys/mman.h... yes
checking for mremap() in sys/mman.h... no
checking for getpagesize() in unistd.h... yes
checking for rb_thread_blocking_region()... yes
checking for rb_thread_io_blocking_region()... yes
checking for GCC 4+ atomic builtins... yes
creating Makefile

make
compiling linux_inet_diag.c
linux_inet_diag.c:1:0: error: CPU you selected does not support x86-64
instruction set
linux_inet_diag.c:1:0: error: CPU you selected does not support x86-64
instruction set
make: *** [linux_inet_diag.o] Error 1


Gem files will remain installed in
/home/kig/.rvm/gems/ruby-1.9.3-p194/gems/raindrops-0.8.0 for
inspection.
Results logged to
/home/kig/.rvm/gems/ruby-1.9.3-p194/gems/raindrops-0.8.0/ext/raindrops/gem_make.out
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

^ permalink raw reply	[relevance 6%]

* Re: [PATCH] replace fchmod()-based heartbeat with raindrops
  2011-06-25  0:15  0%         ` Eric Wong
@ 2011-06-26  5:36  0%           ` Aleksandar Simic
  0 siblings, 0 replies; 89+ results
From: Aleksandar Simic @ 2011-06-26  5:36 UTC (permalink / raw)
  To: unicorn list

On Sat, Jun 25, 2011 at 1:15 AM, Eric Wong <normalperson@yhbt.net> wrote:
> Aleksandar Simic <asimic@gmail.com> wrote:
>> Hello,
>>
>> the same OS & ruby version as the original poster who reported the
>> issue. I see the same symptoms.
>>
>> Cowboy fix: adding "-D__BSD_VISIBLE" to CPPFLAGS gets raindrops gem to build.
>>
>> Easily accessible and viewable sys/mmap.h:
>>
>> http://www.gitorious.net/freebsd/freebsd/blobs/HEAD/sys/sys/mman.h
>
> Aha!  So defining _XOPEN_SOURCE appears to cause __BSD_VISIBLE to
> not be defined in sys/cdefs.h.  I've pushed out the below patch to
> git://bogomips.org/raindrops.git
>
>> If required, I can give you access to my FreeBSD machine, just let me know.
>
> If the below patch doesn't fix it, yes, it'd be greatly appreciated,
> thanks!
>
> >From 1e7dc89cc38c5dec0b63ac452b23141297701f88 Mon Sep 17 00:00:00 2001
> From: Eric Wong <normalperson@yhbt.net>
> Date: Fri, 24 Jun 2011 17:06:56 -0700
> Subject: [PATCH] remove _XOPEN_SOURCE #define for FreeBSD
>
> This appears to cause __BSD_VISIBLE to not be defined,
> which is required for MAP_ANON to be visible in
> sys/mman.h
>
> Thanks for Aleksandar Simic for the hint and Troex Nevelin
> for the bug report!
> ---
>  ext/raindrops/extconf.rb |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/ext/raindrops/extconf.rb b/ext/raindrops/extconf.rb
> index 825625d..9f5de95 100644
> --- a/ext/raindrops/extconf.rb
> +++ b/ext/raindrops/extconf.rb
> @@ -7,7 +7,7 @@ have_func('munmap', 'sys/mman.h') or abort 'munmap() not found'
>  $CPPFLAGS += " -D_GNU_SOURCE "
>  have_func('mremap', 'sys/mman.h')
>
> -$CPPFLAGS += " -D_BSD_SOURCE -D_XOPEN_SOURCE=600 "
> +$CPPFLAGS += " -D_BSD_SOURCE "
>  have_func("getpagesize", "unistd.h")
>  have_func('rb_thread_blocking_region')
>  have_func('rb_thread_io_blocking_region')

Hello,

just to report back that this does fix the issue.

Thanks,
Aleksandar
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[relevance 0%]

* Re: [PATCH] replace fchmod()-based heartbeat with raindrops
  2011-06-24 22:50  6%       ` Aleksandar Simic
@ 2011-06-25  0:15  0%         ` Eric Wong
  2011-06-26  5:36  0%           ` Aleksandar Simic
  0 siblings, 1 reply; 89+ results
From: Eric Wong @ 2011-06-25  0:15 UTC (permalink / raw)
  To: unicorn list

Aleksandar Simic <asimic@gmail.com> wrote:
> Hello,
> 
> the same OS & ruby version as the original poster who reported the
> issue. I see the same symptoms.
> 
> Cowboy fix: adding "-D__BSD_VISIBLE" to CPPFLAGS gets raindrops gem to build.
> 
> Easily accessible and viewable sys/mmap.h:
> 
> http://www.gitorious.net/freebsd/freebsd/blobs/HEAD/sys/sys/mman.h

Aha!  So defining _XOPEN_SOURCE appears to cause __BSD_VISIBLE to
not be defined in sys/cdefs.h.  I've pushed out the below patch to
git://bogomips.org/raindrops.git

> If required, I can give you access to my FreeBSD machine, just let me know.

If the below patch doesn't fix it, yes, it'd be greatly appreciated,
thanks!

>From 1e7dc89cc38c5dec0b63ac452b23141297701f88 Mon Sep 17 00:00:00 2001
From: Eric Wong <normalperson@yhbt.net>
Date: Fri, 24 Jun 2011 17:06:56 -0700
Subject: [PATCH] remove _XOPEN_SOURCE #define for FreeBSD

This appears to cause __BSD_VISIBLE to not be defined,
which is required for MAP_ANON to be visible in
sys/mman.h

Thanks for Aleksandar Simic for the hint and Troex Nevelin
for the bug report!
---
 ext/raindrops/extconf.rb |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ext/raindrops/extconf.rb b/ext/raindrops/extconf.rb
index 825625d..9f5de95 100644
--- a/ext/raindrops/extconf.rb
+++ b/ext/raindrops/extconf.rb
@@ -7,7 +7,7 @@ have_func('munmap', 'sys/mman.h') or abort 'munmap() not found'
 $CPPFLAGS += " -D_GNU_SOURCE "
 have_func('mremap', 'sys/mman.h')
 
-$CPPFLAGS += " -D_BSD_SOURCE -D_XOPEN_SOURCE=600 "
+$CPPFLAGS += " -D_BSD_SOURCE "
 have_func("getpagesize", "unistd.h")
 have_func('rb_thread_blocking_region')
 have_func('rb_thread_io_blocking_region')
-- 
Eric Wong
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply related	[relevance 0%]

* Re: [PATCH] replace fchmod()-based heartbeat with raindrops
  @ 2011-06-24 22:50  6%       ` Aleksandar Simic
  2011-06-25  0:15  0%         ` Eric Wong
  0 siblings, 1 reply; 89+ results
From: Aleksandar Simic @ 2011-06-24 22:50 UTC (permalink / raw)
  To: unicorn list

On Fri, Jun 24, 2011 at 9:51 PM, Eric Wong <normalperson@yhbt.net> wrote:
> Jeremy Evans <jeremyevans0@gmail.com> wrote:
>> On Fri, Jun 24, 2011 at 10:30 AM, Eric Wong <normalperson@yhbt.net> wrote:
>> > Eric Wong <normalperson@yhbt.net> wrote:
>> >>  The subset of raindrops used by Unicorn should work on all machines
>> >>  with mmap(2) + MAP_ANON/MAP_ANONYMOUS support, so *BSDs shouldn't be
>> >>  left out.
>>
>> FWIW, raindrops builds fine on OpenBSD 4.9 amd64.
>
> Thanks for the confirmation!  I'm at a loss as to what's causing
> issues under FreeBSD 8 for him...


Hello,

the same OS & ruby version as the original poster who reported the
issue. I see the same symptoms.

Cowboy fix: adding "-D__BSD_VISIBLE" to CPPFLAGS gets raindrops gem to build.

Easily accessible and viewable sys/mmap.h:

http://www.gitorious.net/freebsd/freebsd/blobs/HEAD/sys/sys/mman.h

If required, I can give you access to my FreeBSD machine, just let me know.

Thanks,
Aleksandar
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[relevance 6%]

* Re: [PATCH] replace fchmod()-based heartbeat with raindrops
  2011-06-16 23:25  2% [PATCH] replace fchmod()-based heartbeat with raindrops Eric Wong
@ 2011-06-24 17:30  6% ` Eric Wong
    0 siblings, 1 reply; 89+ results
From: Eric Wong @ 2011-06-24 17:30 UTC (permalink / raw)
  To: mongrel-unicorn

Eric Wong <normalperson@yhbt.net> wrote:
>  The subset of raindrops used by Unicorn should work on all machines
>  with mmap(2) + MAP_ANON/MAP_ANONYMOUS support, so *BSDs shouldn't be
>  left out.

I've had one report from a FreeBSD 8 user who couldn't get raindrops
to build.  I remember getting it to work under FreeBSD (7.2) in the
past (when I had access to a FreeBSD machine)

http://thread.gmane.org/gmane.comp.lang.ruby.raindrops.general/32

If anybody can help, that'd be great!

-- 
Eric Wong
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[relevance 6%]

* [PATCH] replace fchmod()-based heartbeat with raindrops
@ 2011-06-16 23:25  2% Eric Wong
  2011-06-24 17:30  6% ` Eric Wong
  0 siblings, 1 reply; 89+ results
From: Eric Wong @ 2011-06-16 23:25 UTC (permalink / raw)
  To: mongrel-unicorn

This means we no longer waste an extra file descriptor per
worker process in the master.  Now there's no need to set a
higher file descriptor limit for systems running >= 1024
workers.
---

 I just pushed this out to git://bogomips.org/unicorn.git and it'll
 be in Unicorn 4.x.

 The subset of raindrops used by Unicorn should work on all machines
 with mmap(2) + MAP_ANON/MAP_ANONYMOUS support, so *BSDs shouldn't be
 left out.

 Obviously the Linux-only INET_DIAG/TCP_INFO statistics support in
 raindrops won't ever be a requirement in Unicorn.

 If you're not using gcc 4+, you might need to install libatomic_ops
 http://www.hpl.hp.com/research/linux/atomic_ops/ to build
 raindrops.

 For more information on raindrops, see the raindrops website
 http://raindrops.bogomips.org/ and/or email the mailing list
 if you have questions, comments, patches, etc: raindrops@librelist.org
 (I'll also respond to email about raindrops here)

 DESIGN                     |    8 -------
 lib/unicorn/http_server.rb |   48 +++++++++++++-----------------------------
 lib/unicorn/worker.rb      |   49 ++++++++++++++++++++++++++++++++++++++++---
 script/isolate_for_tests   |    1 +
 test/unit/test_droplet.rb  |   28 +++++++++++++++++++++++++
 unicorn.gemspec            |    1 +
 6 files changed, 90 insertions(+), 45 deletions(-)
 create mode 100644 test/unit/test_droplet.rb

diff --git a/DESIGN b/DESIGN
index eb9fbea..2c98c2f 100644
--- a/DESIGN
+++ b/DESIGN
@@ -76,14 +76,6 @@
   Applications that use threads continue to work if Unicorn
   is only serving LAN or localhost clients.
 
-* Timeout implementation is done via fchmod(2) in each worker
-  on a shared file descriptor to update st_ctime on the inode.
-  Master process wakeups for checking on timeouts is throttled
-  one a second to minimize the performance impact and simplify
-  the code path within the worker.  Neither futimes(2) nor
-  pwrite(2)/pread(2) are supported by base MRI, nor are they as
-  portable on UNIX systems as fchmod(2).
-
 * SIGKILL is used to terminate the timed-out workers from misbehaving apps
   as reliably as possible on a UNIX system.  The default timeout is a
   generous 60 seconds (same default as in Mongrel).
diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index 059f040..0a9af86 100644
--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
@@ -373,7 +373,7 @@ class Unicorn::HttpServer
         self.pid = pid.chomp('.oldbin') if pid
         proc_name 'master'
       else
-        worker = WORKERS.delete(wpid) and worker.tmp.close rescue nil
+        worker = WORKERS.delete(wpid) and worker.close rescue nil
         m = "reaped #{status.inspect} worker=#{worker.nr rescue 'unknown'}"
         status.success? ? logger.info(m) : logger.error(m)
       end
@@ -430,22 +430,17 @@ class Unicorn::HttpServer
     proc_name 'master (old)'
   end
 
-  # forcibly terminate all workers that haven't checked in in timeout
-  # seconds.  The timeout is implemented using an unlinked File
-  # shared between the parent process and each worker.  The worker
-  # runs File#chmod to modify the ctime of the File.  If the ctime
-  # is stale for >timeout seconds, then we'll kill the corresponding
-  # worker.
+  # forcibly terminate all workers that haven't checked in in timeout seconds.  The timeout is implemented using an unlinked File
   def murder_lazy_workers
     t = @timeout
     next_sleep = 1
+    now = Time.now.to_i
     WORKERS.dup.each_pair do |wpid, worker|
-      stat = worker.tmp.stat
-      # skip workers that disable fchmod or have never fchmod-ed
-      stat.mode == 0100600 and next
-      diff = Time.now - stat.ctime
-      if diff <= t
-        tmp = t - diff
+      tick = worker.tick
+      0 == tick and next # skip workers that are sleeping
+      diff = now - tick
+      tmp = t - diff
+      if tmp >= 0
         next_sleep < tmp and next_sleep = tmp
         next
       end
@@ -472,7 +467,7 @@ class Unicorn::HttpServer
     worker_nr = -1
     until (worker_nr += 1) == @worker_processes
       WORKERS.values.include?(worker_nr) and next
-      worker = Worker.new(worker_nr, Unicorn::TmpIO.new)
+      worker = Worker.new(worker_nr)
       before_fork.call(self, worker)
       if pid = fork
         WORKERS[pid] = worker
@@ -549,10 +544,8 @@ class Unicorn::HttpServer
     proc_name "worker[#{worker.nr}]"
     START_CTX.clear
     init_self_pipe!
-    WORKERS.values.each { |other| other.tmp.close rescue nil }
     WORKERS.clear
     LISTENERS.each { |sock| sock.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) }
-    worker.tmp.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
     after_fork.call(self, worker) # can drop perms
     worker.user(*user) if user.kind_of?(Array) && ! worker.switched
     self.timeout /= 2.0 # halve it for select()
@@ -576,12 +569,11 @@ class Unicorn::HttpServer
     ppid = master_pid
     init_worker_process(worker)
     nr = 0 # this becomes negative if we need to reopen logs
-    alive = worker.tmp # tmp is our lifeline to the master process
     ready = LISTENERS.dup
 
     # closing anything we IO.select on will raise EBADF
     trap(:USR1) { nr = -65536; SELF_PIPE[0].close rescue nil }
-    trap(:QUIT) { alive = nil; LISTENERS.each { |s| s.close rescue nil }.clear }
+    trap(:QUIT) { worker = nil; LISTENERS.each { |s| s.close rescue nil }.clear }
     [:TERM, :INT].each { |sig| trap(sig) { exit!(0) } } # instant shutdown
     logger.info "worker=#{worker.nr} ready"
     m = 0
@@ -590,21 +582,12 @@ class Unicorn::HttpServer
       nr < 0 and reopen_worker_logs(worker.nr)
       nr = 0
 
-      # we're a goner in timeout seconds anyways if alive.chmod
-      # breaks, so don't trap the exception.  Using fchmod() since
-      # futimes() is not available in base Ruby and I very strongly
-      # prefer temporary files to be unlinked for security,
-      # performance and reliability reasons, so utime is out.  No-op
-      # changes with chmod doesn't update ctime on all filesystems; so
-      # we change our counter each and every time (after process_client
-      # and before IO.select).
-      alive.chmod(m = 0 == m ? 1 : 0)
-
       while sock = ready.shift
         if client = sock.kgio_tryaccept
+          worker.tick = Time.now.to_i
           process_client(client)
+          worker.tick = 0
           nr += 1
-          alive.chmod(m = 0 == m ? 1 : 0)
         end
         break if nr < 0
       end
@@ -619,18 +602,17 @@ class Unicorn::HttpServer
       end
 
       ppid == Process.ppid or return
-      alive.chmod(m = 0 == m ? 1 : 0)
 
       # timeout used so we can detect parent death:
       ret = IO.select(LISTENERS, nil, SELF_PIPE, timeout) and ready = ret[0]
     rescue Errno::EBADF
       nr < 0 or return
     rescue => e
-      if alive
+      if worker
         logger.error "Unhandled listen loop exception #{e.inspect}."
         logger.error e.backtrace.join("\n")
       end
-    end while alive
+    end while worker
   end
 
   # delivers a signal to a worker and fails gracefully if the worker
@@ -638,7 +620,7 @@ class Unicorn::HttpServer
   def kill_worker(signal, wpid)
     Process.kill(signal, wpid)
     rescue Errno::ESRCH
-      worker = WORKERS.delete(wpid) and worker.tmp.close rescue nil
+      worker = WORKERS.delete(wpid) and worker.close rescue nil
   end
 
   # delivers a signal to each worker
diff --git a/lib/unicorn/worker.rb b/lib/unicorn/worker.rb
index 39e9e32..cd41e22 100644
--- a/lib/unicorn/worker.rb
+++ b/lib/unicorn/worker.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+require "raindrops"
 
 # This class and its members can be considered a stable interface
 # and will not change in a backwards-incompatible fashion between
@@ -7,13 +8,53 @@
 #
 # Some users may want to access it in the before_fork/after_fork hooks.
 # See the Unicorn::Configurator RDoc for examples.
-class Unicorn::Worker < Struct.new(:nr, :tmp, :switched)
+class Unicorn::Worker
+  # :stopdoc:
+  attr_accessor :nr, :switched
+  attr_writer :tmp
+
+  PER_DROP = Raindrops::PAGE_SIZE / Raindrops::SIZE
+  DROPS = []
+
+  def initialize(nr)
+    drop_index = nr / PER_DROP
+    @raindrop = DROPS[drop_index] ||= Raindrops.new(PER_DROP)
+    @offset = nr % PER_DROP
+    @raindrop[@offset] = 0
+    @nr = nr
+    @tmp = @switched = false
+  end
 
   # worker objects may be compared to just plain Integers
   def ==(other_nr) # :nodoc:
-    nr == other_nr
+    @nr == other_nr
+  end
+
+  # called in the worker process
+  def tick=(value) # :nodoc:
+    @raindrop[@offset] = value
+  end
+
+  # called in the master process
+  def tick # :nodoc:
+    @raindrop[@offset]
   end
 
+  # only exists for compatibility
+  def tmp # :nodoc:
+    @tmp ||= begin
+      tmp = Unicorn::TmpIO.new
+      tmp.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
+      tmp
+    end
+  end
+
+  def close # :nodoc:
+    @tmp.close if @tmp
+  end
+
+  # :startdoc:
+
   # In most cases, you should be using the Unicorn::Configurator#user
   # directive instead.  This method should only be used if you need
   # fine-grained control of exactly when you want to change permissions
@@ -36,12 +77,12 @@ class Unicorn::Worker < Struct.new(:nr, :tmp, :switched)
     uid = Etc.getpwnam(user).uid
     gid = Etc.getgrnam(group).gid if group
     Unicorn::Util.chown_logs(uid, gid)
-    tmp.chown(uid, gid)
+    @tmp.chown(uid, gid) if @tmp
     if gid && Process.egid != gid
       Process.initgroups(user, gid)
       Process::GID.change_privilege(gid)
     end
     Process.euid != uid and Process::UID.change_privilege(uid)
-    self.switched = true
+    @switched = true
   end
 end
diff --git a/script/isolate_for_tests b/script/isolate_for_tests
index 1c9d9b1..96848c1 100755
--- a/script/isolate_for_tests
+++ b/script/isolate_for_tests
@@ -17,6 +17,7 @@ opts = {
 pid = fork do
   Isolate.now!(opts) do
     gem 'sqlite3-ruby', '1.2.5'
+    gem 'raindrops', '0.6.1'
     gem 'kgio', '2.3.3'
     gem 'rack', '1.2.2'
   end
diff --git a/test/unit/test_droplet.rb b/test/unit/test_droplet.rb
new file mode 100644
index 0000000..73cf38c
--- /dev/null
+++ b/test/unit/test_droplet.rb
@@ -0,0 +1,28 @@
+require 'test/unit'
+require 'unicorn'
+
+class TestDroplet < Test::Unit::TestCase
+  def test_create_many_droplets
+    now = Time.now.to_i
+    tmp = (0..1024).map do |i|
+      droplet = Unicorn::Worker.new(i)
+      assert droplet.respond_to?(:tick)
+      assert_equal 0, droplet.tick
+      assert_equal(now, droplet.tick = now)
+      assert_equal now, droplet.tick
+      assert_equal(0, droplet.tick = 0)
+      assert_equal 0, droplet.tick
+    end
+  end
+
+  def test_shared_process
+    droplet = Unicorn::Worker.new(0)
+    _, status = Process.waitpid2(fork { droplet.tick += 1; exit!(0) })
+    assert status.success?, status.inspect
+    assert_equal 1, droplet.tick
+
+    _, status = Process.waitpid2(fork { droplet.tick += 1; exit!(0) })
+    assert status.success?, status.inspect
+    assert_equal 2, droplet.tick
+  end
+end
diff --git a/unicorn.gemspec b/unicorn.gemspec
index 2ce6c59..851424f 100644
--- a/unicorn.gemspec
+++ b/unicorn.gemspec
@@ -35,6 +35,7 @@ Gem::Specification.new do |s|
   # *strongly* recommended for security reasons.
   s.add_dependency(%q<rack>)
   s.add_dependency(%q<kgio>, '~> 2.4')
+  s.add_dependency(%w<raindrops>, '~> 0.6')
 
   s.add_development_dependency('isolate', '~> 3.1')
   s.add_development_dependency('wrongdoc', '~> 1.5')
-- 
Eric Wong
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply related	[relevance 2%]

* Re: [PATCH] Ensure that 'make gem' builds the documentation too.
  @ 2011-06-07 17:06  8%     ` Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2011-06-07 17:06 UTC (permalink / raw)
  To: unicorn list

Hongli Lai <hongli@phusion.nl> wrote:
> On Mon, Jun 6, 2011 at 7:51 PM, Eric Wong <normalperson@yhbt.net> wrote:
> > Oops, this was a regression introduced when I switched to wrongdoc
> > in f62ef19a4aa3d3e4ce1aa37a499907ff776a8964
> >
> > Perhaps this is better?  It'll also affect the tgz target and not
> > just the gem target.
> 
> I'm fine with it if it works. :)

Pushed out with the following commit message:

From 0dc56fd03ea478ae054e3d0398703f43e017723b Mon Sep 17 00:00:00 2001
From: Eric Wong <normalperson@yhbt.net>
Date: Tue, 7 Jun 2011 09:56:30 -0700
Subject: [PATCH] build: ensure gem and tgz targets build manpages

Original patch by Hongli Lai <hongli@phusion.nl>:

> >From bfefc2cf0efb0913a42862886363b3140dcdbb2a Mon Sep 17 00:00:00 2001
> From: Hongli Lai (Phusion) <hongli@phusion.nl>
> Date: Mon, 6 Jun 2011 13:39:00 +0200
> Subject: [PATCH] Ensure that 'make gem' builds the documentation too.
>
> If autogenerated documentation files, like man pages, don't exist then
> 'make gem' will fail, complaining that some files are not found. By
> depending the 'gem' target on the 'doc' target we ensure that 'make gem'
> always works.
>
> Signed-off-by: Hongli Lai (Phusion) <hongli@phusion.nl>

ref: http://mid.gmane.org/4DED0EE2.7040400@phusion.nl
-- 
Eric Wong
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

^ permalink raw reply	[relevance 8%]

* [PATCH] Ensure that 'make gem' builds the documentation too.
@ 2011-06-06 17:31  8% Hongli Lai
    0 siblings, 1 reply; 89+ results
From: Hongli Lai @ 2011-06-06 17:31 UTC (permalink / raw)
  To: unicorn list

>From bfefc2cf0efb0913a42862886363b3140dcdbb2a Mon Sep 17 00:00:00 2001
From: Hongli Lai (Phusion) <hongli@phusion.nl>
Date: Mon, 6 Jun 2011 13:39:00 +0200
Subject: [PATCH] Ensure that 'make gem' builds the documentation too.

If autogenerated documentation files, like man pages, don't exist then
'make gem' will fail, complaining that some files are not found. By
depending the 'gem' target on the 'doc' target we ensure that 'make gem'
always works.

Signed-off-by: Hongli Lai (Phusion) <hongli@phusion.nl>
---
 GNUmakefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/GNUmakefile b/GNUmakefile
index 4072826..90cc451 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -257,7 +257,7 @@ gem: $(pkggem)
 install-gem: $(pkggem)
 	gem install $(CURDIR)/$<

-$(pkggem): .manifest fix-perms
+$(pkggem): .manifest fix-perms doc
 	gem build $(rfpackage).gemspec
 	mkdir -p pkg
 	mv $(@F) $@
-- 
1.7.5

_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply related	[relevance 8%]

* [PATCH] Document the method for building the Unicorn gem
@ 2011-06-06 11:44  7% Hongli Lai
  0 siblings, 0 replies; 89+ results
From: Hongli Lai @ 2011-06-06 11:44 UTC (permalink / raw)
  To: unicorn list

>From dcd47a609f4489bb37ce33ea1ce975bb2b3ab160 Mon Sep 17 00:00:00 2001
From: Hongli Lai (Phusion) <hongli@phusion.nl>
Date: Mon, 6 Jun 2011 13:36:57 +0200
Subject: [PATCH] Document the method for building the Unicorn gem.

Signed-off-by: Hongli Lai (Phusion) <hongli@phusion.nl>
---
 HACKING |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/HACKING b/HACKING
index 781c4ca..38f2f2a 100644
--- a/HACKING
+++ b/HACKING
@@ -107,6 +107,17 @@ git itself.  See the
Documentation/SubmittingPatches document
 distributed with git on on patch submission guidelines to follow.  Just
 don't email the git mailing list or maintainer with Unicorn patches :)

+== Building a Gem
+
+In order to build the gem, you must install the following components:
+
+ * wrongdoc
+ * pandoc
+
+You can build the Unicorn gem with the following command:
+
+  gmake gem
+
 == Running Development Versions

 It is easy to install the contents of your git working directory:
-- 
1.7.5

-- 
Phusion | Ruby & Rails deployment, scaling and tuning solutions

Web: http://www.phusion.nl/
E-mail: info@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply related	[relevance 7%]

* Re: [ANN] raindrops updates (mainly for Linux users)
  @ 2011-03-23 18:12  6% ` Troex Nevelin
  0 siblings, 0 replies; 89+ results
From: Troex Nevelin @ 2011-03-23 18:12 UTC (permalink / raw)
  To: unicorn list

On 03/18/2011 09:09 PM, Eric Wong wrote:
> I figured I should cross post here.  raindrops (listen queue stats
> package for Unicorn/Rainbows!) has gotten some largish updates over the
> past few weeks:
>
> raindrops 0.5.0 release announcement:
>    http://mid.gmane.org/20110317033547.GA30653@dcvr.yhbt.net
>
> demo site changes (will probably be in 0.6.0 soon):
>    http://mid.gmane.org/20110318094637.GA3526@dcvr.yhbt.net
>
> Feedback would be greatly appreciated (either here or
> raindrops@librelist.com).  There are no backwards-incompatible changes
> for existing users as far as I'm aware of.

This update is really great! Now we can see 'Mean' users awaiting for 
their requests to be served - this information is very useful, because 
we now can calculate avarage wait time for each request.

For example we know that an average request time is 0.15 sec, than if 
our mean queue is 32 requests, each request will be served in 
(32+1)*0.15=4.95 seconds. This information is very useful and even 
NewRelics cannot provide it.

I'm going to build graphs for this data. You can see live stats for 700k 
request per day project running on 2x Xeon E5410 2.33 Ghz (4 cores each):

http://kinokopilka.tv:9292/queued/%2Fvar%2Fwww%2Fkk%2Fcurrent%2Ftmp%2Fsockets%2Funicorn.sock.html
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[relevance 6%]

* [PATCH] git.bogomips.org => bogomips.org
@ 2011-01-21 20:37  7% Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2011-01-21 20:37 UTC (permalink / raw)
  To: mongrel-unicorn

If people are watching the cgit page, do not be alarmed,
I'm just trimming the URL length to save precious bytes :D

>From d770d09dfd9e5d7148379c58cdf9a020cbdc63b6 Mon Sep 17 00:00:00 2001
From: Eric Wong <normalperson@yhbt.net>
Date: Fri, 21 Jan 2011 12:28:39 -0800
Subject: [PATCH] git.bogomips.org => bogomips.org

bogomips.org is slimming down and losing URL weight :)
---
 .wrongdoc.yml |    4 ++--
 README        |    4 ++--
 Rakefile      |    5 +++--
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/.wrongdoc.yml b/.wrongdoc.yml
index 9121575..10f10b5 100644
--- a/.wrongdoc.yml
+++ b/.wrongdoc.yml
@@ -1,6 +1,6 @@
 ---
-cgit_url: http://git.bogomips.org/cgit/unicorn.git
-git_url: git://git.bogomips.org/unicorn.git
+cgit_url: http://bogomips.org/unicorn.git
+git_url: git://bogomips.org/unicorn.git
 rdoc_url: http://unicorn.bogomips.org/
 changelog_start: v1.1.5
 merge_html:
diff --git a/README b/README
index b4bbae2..9dda04e 100644
--- a/README
+++ b/README
@@ -85,13 +85,13 @@ You may also install it via RubyGems on Gemcutter:
 You can get the latest source via git from the following locations
 (these versions may not be stable):
 
-  git://git.bogomips.org/unicorn.git
+  git://bogomips.org/unicorn.git
   git://repo.or.cz/unicorn.git (mirror)
 
 You may browse the code from the web and download the latest snapshot
 tarballs here:
 
-* http://git.bogomips.org/cgit/unicorn.git (cgit)
+* http://bogomips.org/unicorn.git (cgit)
 * http://repo.or.cz/w/unicorn.git (gitweb)
 
 See the HACKING guide on how to contribute and build prerelease gems
diff --git a/Rakefile b/Rakefile
index 598cf07..ffdf982 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,8 +1,9 @@
 # -*- encoding: binary -*-
 autoload :Gem, 'rubygems'
+require 'wrongdoc'
 
-cgit_url = "http://git.bogomips.org/cgit/unicorn.git"
-git_url = ENV['GIT_URL'] || 'git://git.bogomips.org/unicorn.git'
+cgit_url = Wrongdoc.config[:cgit_url]
+git_url = Wrongdoc.config[:git_url]
 
 desc "post to RAA"
 task :raa_update do
-- 
Eric Wong
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply related	[relevance 7%]

* [ANN] unicorn 3.0.0pre1 - disable rewindable input!
@ 2010-11-17  0:26  5% Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2010-11-17  0:26 UTC (permalink / raw)
  To: mongrel-unicorn

Rewindable "rack.input" may be disabled via the
"rewindable_input false" directive in the configuration file.
This will violate Rack::Lint for Rack 1.x applications, but
can reduce I/O for applications that do not need it.

There are also internal cleanups and enhancements for future
versions of Rainbows!

Eric Wong (11):
      t0012: fix race condition in reload
      enable HTTP keepalive support for all methods
      http_parser: add HttpParser#next? method
      tee_input: switch to simpler API for parsing trailers
      switch versions to 3.0.0pre
      add stream_input class and build tee_input on it
      configurator: enable "rewindable_input" directive
      http_parser: ensure keepalive is disabled when reset
      *_input: make life easier for subclasses/modules
      tee_input: restore read position after #size
      preread_input: no-op for non-rewindable "rack.input"

See "git log" output for all the gory details.

* http://unicorn.bogomips.org/
* mongrel-unicorn@rubyforge.org
* git://git.bogomips.org/unicorn.git

-- 
Eric Wong
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[relevance 5%]

* [ANN] 1.9 users: socket_dontwait - MSG_DONTWAIT socket methods
@ 2010-08-09 22:54  3% Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2010-08-09 22:54 UTC (permalink / raw)
  To: mongrel-unicorn

Hi all,

I initially announced[1] this on the Rainbows! mailing list since
Rainbows! is more experimental in nature, but I've been running this for
a few days with real traffic (with Rainbows!) and it seems safe enough
for less crazy people to use :)

If you're using Ruby 1.9.1, then this library includes a fix for
errno getting zeroed and hitting rb_bug() during rb_sys_fail()
This is fixed in Ruby trunk r27401, but 1.9.1 doesn't have this.

This library is a drop-in replacement that reimplements several IO
methods with replacements using MSG_DONTWAIT for BasicSocket.  This
allows us to avoid unnecessary system calls and GVL bouncing.

[1] - http://mid.gmane.org/20100803091847.GC3255@dcvr.yhbt.net

The rest of the README below:

We've reimplemented the +readpartial+, +read_nonblock+,
+write_nonblock+, +read+ and +write+ instance methods normally inherited
from the IO class directly into BasicSocket with socket-specific system
calls and flags.

This library is only intended for Ruby 1.9 and will not build with other
versions of Ruby.  This only supports operating systems with the
non-POSIX MSG_DONTWAIT flag for send(2) and recv(2) syscalls.

This library is considered EXPERIMENTAL.  If successful, we'll see about
getting them integrated into the standard Ruby socket library.

== Features

* Avoid use of fcntl(2) to set O_NONBLOCK in favor of MSG_DONTWAIT when
  using non-blocking I/O.  We _unset_ O_NONBLOCK if we need to block
  and release the GVL instead of relying on select(2).

* Avoids select(2) entirely in favor of blocking I/O when the
  GVL is released.  This allows using file descriptor numbers higher
  than 1023 without overflowing select(2) buffers.

* BasicSocket#read uses recv(2) with MSG_WAITALL to avoid extra system
  calls for larger reads.

* Thread and signal-safe, releases the GVL for all blocking operations
  and retries if system calls are interrupted.

* Includes a 1.9.1-specific workaround to preserve errno after reacquiring
  the GVL.  This is
  {fixed}[http://redmine.ruby-lang.org/repositories/diff/ruby-19?rev=27401]
  in newer versions of Ruby.

* Falls back to line-buffered IO if needed (not recommended).

== Bugs/Caveats

* We ignore taint/$SAFE checks, we'll support it if there's demand,
  but we doubt there is...

* Does not support 1.9 encoding filters.  1.9 defaults all sockets to
  Encoding::BINARY anyways, so this should not be noticeable to code
  that leaves socket encodings untouched.

* Does not support write buffering in userspace.  Ruby defaults all
  sockets to "IO#sync = true", anyways so this does not affect code
  that leaves the default setting untouched.

* Avoid using line-buffered IO on sockets (IO#gets, IO#each_line),
  nearly all of the features of this library are cancelled out when
  the line-buffering fallback is used.

== Install

If you're using a packaged Ruby distribution, make sure you have a C
compiler and the matching Ruby development libraries and headers.
You need Ruby 1.9 to install socket_dontwait.  Previous versions of
Ruby will NOT be supported.

If you use RubyGems:

    gem install socket_dontwait

Otherwise grab the latest tarball from:

http://bogomips.org/socket_dontwait/files/

Unpack it, and run "ruby setup.rb"

== Development

You can get the latest source via git from the following locations:

  git://git.bogomips.org/socket_dontwait.git
  git://repo.or.cz/socket_dontwait.git (mirror)

You may browse the code from the web and download the latest snapshot
tarballs here:

* http://git.bogomips.org/cgit/socket_dontwait.git (cgit)
* http://repo.or.cz/w/socket_dontwait.git (gitweb)

Inline patches (from "git format-patch") to the mailing list are
preferred because they allow code review and comments in the reply to
the patch.

We will adhere to mostly the same conventions for patch submissions as
git itself.  See the Documentation/SubmittingPatches document
distributed with git on on patch submission guidelines to follow.  Just
don't email the git mailing list or maintainer with socket_dontwait
patches.

== Contact/Bug Reports/Feedback/Patches/Pull-Requests

This was originally created for the Rainbows! project (but may be used by
others), so we'll reuse their mailing list at
{rainbows-talk@rubyforge.org}[mailto:rainbows-talk@rubyforge.org].

-- 
Eric Wong
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[relevance 3%]

* test failure on Mac OSX
@ 2010-06-25 15:06  4% Andrew Milkowski
  0 siblings, 0 replies; 89+ results
From: Andrew Milkowski @ 2010-06-25 15:06 UTC (permalink / raw)
  To: mongrel-unicorn

Hi there,

ran to a snag building unicorn from sources (git master at
git://git.bogomips.org/unicorn.git)

  1) Failure:
: test_working_directory_rel_path_config_file(ExecTest)
[test/exec/test_exec.rb:106]:
: <"/var/folders/gy/gyjECZCGGxKv3I3mRTmhB++++TI/-Tmp-/unicorn_exec_test20100625-1679-1x3ks9d-0">
expected but was
: <"/private/var/folders/gy/gyjECZCGGxKv3I3mRTmhB++++TI/-Tmp-/unicorn_exec_test20100625-1679-1x3ks9d-0">.
:
: 1 tests, 2 assertions, 1 failures, 0 errors
make: *** [test/exec/test_exec.rb--test_working_directory_rel_path_config_file.n]
Error 1

running following configuration (session console dump below)

bash-3.2$ uname -v
Darwin Kernel Version 10.4.0: Fri Apr 23 18:27:12 PDT 2010;
root:xnu-1504.7.4~1/RELEASE_X86_64
bash-3.2$ ruby -v
ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-darwin10.2.0], MBARI
0x6770, Ruby Enterprise Edition 2010.01
bash-3.2$


thanks in advance!


bash-3.2$ make
* test/unit/test_configurator.rb
* test/unit/test_http_parser.rb
* test/unit/test_http_parser_ng.rb
* test/unit/test_request.rb
* test/unit/test_response.rb
* test/unit/test_socket_helper.rb
* test/unit/test_tee_input.rb
* test/unit/test_util.rb
* test/unit/test_server.rb -n test_preload_app_config
* test/unit/test_server.rb -n test_broken_app
* test/unit/test_server.rb -n test_simple_server
* test/unit/test_server.rb -n test_client_shutdown_writes
* test/unit/test_server.rb -n test_client_shutdown_write_truncates
* test/unit/test_server.rb -n test_client_malformed_body
* test/unit/test_server.rb -n test_trickle_attack
* test/unit/test_server.rb -n test_close_client
* test/unit/test_server.rb -n test_bad_client
* test/unit/test_server.rb -n test_logger_set
* test/unit/test_server.rb -n test_logger_changed
* test/unit/test_server.rb -n test_bad_client_400
* test/unit/test_server.rb -n test_http_0_9
* test/unit/test_server.rb -n test_header_is_too_long
* test/unit/test_server.rb -n test_file_streamed_request
* test/unit/test_server.rb -n test_file_streamed_request_bad_body
* test/unit/test_server.rb -n test_listener_names
* test/exec/test_exec.rb -n test_working_directory_rel_path_config_file
: /opt/local/src/ruby-enterprise-server/ruby-enterprise-1.8.7-2010.01/build/lib/ruby/1.8/pathname.rb:263:
warning: `*' interpreted as argument prefix
: Loaded suite test/exec/test_exec
: Started
: test_working_directory_rel_path_config_file(ExecTest): F
:
: Finished in 0.629278 seconds.
:
:   1) Failure:
: test_working_directory_rel_path_config_file(ExecTest)
[test/exec/test_exec.rb:106]:
: <"/var/folders/gy/gyjECZCGGxKv3I3mRTmhB++++TI/-Tmp-/unicorn_exec_test20100625-1679-1x3ks9d-0">
expected but was
: <"/private/var/folders/gy/gyjECZCGGxKv3I3mRTmhB++++TI/-Tmp-/unicorn_exec_test20100625-1679-1x3ks9d-0">.
:
: 1 tests, 2 assertions, 1 failures, 0 errors
make: *** [test/exec/test_exec.rb--test_working_directory_rel_path_config_file.n]
Error 1
bash-3.2$
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[relevance 4%]

* Re: Working directory and config.ru
  @ 2010-06-10  9:58  3%   ` Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2010-06-10  9:58 UTC (permalink / raw)
  To: unicorn list

Eric Wong <normalperson@yhbt.net> wrote:
> Pierre Baillet <oct@fotonauts.com> wrote:
> > Hi,
> > 
> > I naively expected unicorn to honor the working_directory
> > configuration directive before attempting to locate the config.ru but
> > this does not seem to be the case. Is this behavior wanted ? From the
> > code, I can guess that the configuration file parsing is done much
> > later  than the current config.ru location attempt.
> 
> Hi Pierre,
> 
> Oops, definitely not wanted behavior.  Unicorn should honor
> working_directory with regard to config.ru.  I'll start working
> on a fix shortly, thanks for the report!

I just pushed the following out with a few other cleanups.

Maintaining Rainbows!/Zbatery compatibility was a bit costly in terms of
prettiness.

Overall, my initial hesitation to support "working_directory" last year
was validated by the complexity of maintaining relative path
compatibility across the board.

I'm very glad for the integration test suite (stolen from Rainbows!)
which allows me to write tests in my "native" language :>

There'll be more tests coming when I'm more awake (and I'm actually
developing a real Rack application which will be public Real Soon
Now(TM), but more targeted at Rainbows!/Zbatery :)

>From 4accf4449390c649bce0b1c9d84314d65fd41f8e Mon Sep 17 00:00:00 2001
From: Eric Wong <normalperson@yhbt.net>
Date: Thu, 10 Jun 2010 08:47:10 +0000
Subject: [PATCH] respect "working_directory" wrt config.ru

Since we added support for the "working_directory" parameter, it
often became unclear where/when certain paths would be bound.

There are some extremely nasty dependencies and ordering issues
when doing this.  It's all pretty fragile, but works for now
and we even have a full integration test to keep it working.

I plan on cleaning this up 2.x.x to be less offensive to look
at (Rainbows! and Zbatery are a bit tied to this at the moment).

Thanks to Pierre Baillet for reporting this.

ref: http://mid.gmane.org/AANLkTimKb7JARr_69nfVrJLvMZH3Gvs1o_KwZFLKfuxy@mail.gmail.com
---
 bin/unicorn                  |    5 +---
 bin/unicorn_rails            |   17 +++++++++---
 lib/unicorn.rb               |    7 ++---
 lib/unicorn/configurator.rb  |   56 ++++++++++++++++++++++++++++++++++++++++++
 lib/unicorn/launcher.rb      |    5 ++-
 t/t0003-working_directory.sh |   53 +++++++++++++++++++++++++++++++++++++++
 6 files changed, 129 insertions(+), 14 deletions(-)
 create mode 100755 t/t0003-working_directory.sh

diff --git a/bin/unicorn b/bin/unicorn
index beece97..2cc10b1 100755
--- a/bin/unicorn
+++ b/bin/unicorn
@@ -107,10 +107,7 @@ opts = OptionParser.new("", 24, '  ') do |opts|
   opts.parse! ARGV
 end
 
-ru = ARGV[0] || "config.ru"
-abort "configuration file #{ru} not found" unless File.exist?(ru)
-
-app = Unicorn.builder(ru, opts)
+app = Unicorn.builder(ARGV[0] || 'config.ru', opts)
 options[:listeners] << "#{host}:#{port}" if set_listener
 
 if $DEBUG
diff --git a/bin/unicorn_rails b/bin/unicorn_rails
index 2f88bc1..e9cac00 100755
--- a/bin/unicorn_rails
+++ b/bin/unicorn_rails
@@ -107,8 +107,6 @@ opts = OptionParser.new("", 24, '  ') do |opts|
   opts.parse! ARGV
 end
 
-ru = ARGV[0] || (File.exist?('config.ru') ? 'config.ru' : nil)
-
 def rails_dispatcher
   if ::Rails::VERSION::MAJOR >= 3 && ::File.exist?('config/application.rb')
     if ::File.read('config/application.rb') =~ /^module\s+([\w:]+)\s*$/
@@ -127,9 +125,20 @@ def rails_dispatcher
   result || abort("Unable to locate the application dispatcher class")
 end
 
-def rails_builder(daemonize)
+def rails_builder(ru, opts, daemonize)
+  return Unicorn.builder(ru, opts) if ru
+
+  # allow Configurator to parse cli switches embedded in the ru file
+  Unicorn::Configurator::RACKUP.update(:file => :rails, :optparse => opts)
+
   # this lambda won't run until after forking if preload_app is false
+  # this runs after config file reloading
   lambda do ||
+    # Rails 3 includes a config.ru, use it if we find it after
+    # working_directory is bound.
+    ::File.exist?('config.ru') and
+      return Unicorn.builder('config.ru', opts).call
+
     # Load Rails and (possibly) the private version of Rack it bundles.
     begin
       require ::File.expand_path('config/boot')
@@ -179,7 +188,7 @@ def rails_builder(daemonize)
   end
 end
 
-app = ru ? Unicorn.builder(ru, opts) : rails_builder(daemonize)
+app = rails_builder(ARGV[0], opts, daemonize)
 options[:listeners] << "#{host}:#{port}" if set_listener
 
 if $DEBUG
diff --git a/lib/unicorn.rb b/lib/unicorn.rb
index c026236..a7b0646 100644
--- a/lib/unicorn.rb
+++ b/lib/unicorn.rb
@@ -33,11 +33,10 @@ module Unicorn
     # Unicorn config).  The returned lambda will be called when it is
     # time to build the app.
     def builder(ru, opts)
-      if ru =~ /\.ru\z/
-        # parse embedded command-line options in config.ru comments
-        /^#\\(.*)/ =~ File.read(ru) and opts.parse!($1.split(/\s+/))
-      end
+      # allow Configurator to parse cli switches embedded in the ru file
+      Unicorn::Configurator::RACKUP.update(:file => ru, :optparse => opts)
 
+      # always called after config file parsing, may be called after forking
       lambda do ||
         inner_app = case ru
         when /\.ru$/
diff --git a/lib/unicorn/configurator.rb b/lib/unicorn/configurator.rb
index e4305c2..0716e64 100644
--- a/lib/unicorn/configurator.rb
+++ b/lib/unicorn/configurator.rb
@@ -13,6 +13,12 @@ module Unicorn
   # nginx is also available at
   # http://unicorn.bogomips.org/examples/nginx.conf
   class Configurator < Struct.new(:set, :config_file, :after_reload)
+    # :stopdoc:
+    # used to stash stuff for deferred processing of cli options in
+    # config.ru after "working_directory" is bound.  Do not rely on
+    # this being around later on...
+    RACKUP = {}
+    # :startdoc:
 
     # Default settings for Unicorn
     DEFAULTS = {
@@ -51,6 +57,8 @@ module Unicorn
     def reload #:nodoc:
       instance_eval(File.read(config_file), config_file) if config_file
 
+      parse_rackup_file
+
       # working_directory binds immediately (easier error checking that way),
       # now ensure any paths we changed are correctly set.
       [ :pid, :stderr_path, :stdout_path ].each do |var|
@@ -66,6 +74,9 @@ module Unicorn
 
     def commit!(server, options = {}) #:nodoc:
       skip = options[:skip] || []
+      if ready_pipe = RACKUP.delete(:ready_pipe)
+        server.ready_pipe = ready_pipe
+      end
       set.each do |key, value|
         value == :unset and next
         skip.include?(key) and next
@@ -411,5 +422,50 @@ module Unicorn
       set[var] = my_proc
     end
 
+    # this is called _after_ working_directory is bound.  This only
+    # parses the embedded switches in .ru files
+    # (for "rackup" compatibility)
+    def parse_rackup_file # :nodoc:
+      ru = RACKUP[:file] or return # we only return here in unit tests
+
+      # :rails means use (old) Rails autodetect
+      if ru == :rails
+        File.readable?('config.ru') or return
+        ru = 'config.ru'
+      end
+
+      File.readable?(ru) or
+        raise ArgumentError, "rackup file (#{ru}) not readable"
+
+      # it could be a .rb file, too, we don't parse those manually
+      ru =~ /\.ru\z/ or return
+
+      /^#\\(.*)/ =~ File.read(ru) or return
+      warn "ru cli opts: #{$1}"
+      RACKUP[:optparse].parse!($1.split(/\s+/))
+
+      # XXX ugly as hell, WILL FIX in 2.x (along with Rainbows!/Zbatery)
+      host, port, set_listener, options, daemonize =
+                      eval("[ host, port, set_listener, options, daemonize ]",
+                           TOPLEVEL_BINDING)
+
+      warn [ :host, :port, :set_listener, :options, :daemonize ].inspect
+      warn [ ru, host, port, set_listener, options, daemonize ].inspect
+      # XXX duplicate code from bin/unicorn{,_rails}
+      set[:listeners] << "#{host}:#{port}" if set_listener
+
+      if daemonize
+        # unicorn_rails wants a default pid path, (not plain 'unicorn')
+        if ru == :rails
+          spid = set[:pid]
+          pid('tmp/pids/unicorn.pid') if spid.nil? || spid == :unset
+        end
+        unless RACKUP[:daemonized]
+          Unicorn::Launcher.daemonize!(options)
+          RACKUP[:ready_pipe] = options.delete(:ready_pipe)
+        end
+      end
+    end
+
   end
 end
diff --git a/lib/unicorn/launcher.rb b/lib/unicorn/launcher.rb
index 5ab04c7..7f3ffa6 100644
--- a/lib/unicorn/launcher.rb
+++ b/lib/unicorn/launcher.rb
@@ -56,8 +56,9 @@ class Unicorn::Launcher
       end
     end
     # $stderr/$stderr can/will be redirected separately in the Unicorn config
-    Unicorn::Configurator::DEFAULTS[:stderr_path] = "/dev/null"
-    Unicorn::Configurator::DEFAULTS[:stdout_path] = "/dev/null"
+    Unicorn::Configurator::DEFAULTS[:stderr_path] ||= "/dev/null"
+    Unicorn::Configurator::DEFAULTS[:stdout_path] ||= "/dev/null"
+    Unicorn::Configurator::RACKUP[:daemonized] = true
   end
 
 end
diff --git a/t/t0003-working_directory.sh b/t/t0003-working_directory.sh
new file mode 100755
index 0000000..3faa6c0
--- /dev/null
+++ b/t/t0003-working_directory.sh
@@ -0,0 +1,53 @@
+#!/bin/sh
+. ./test-lib.sh
+t_plan 4 "config.ru inside alt working_directory"
+
+t_begin "setup and start" && {
+	unicorn_setup
+	rtmpfiles unicorn_config_tmp
+	rm -rf $t_pfx.app
+	mkdir $t_pfx.app
+
+	port=$(expr $listen : '[^:]*:\([0-9]\+\)')
+	host=$(expr $listen : '\([^:]*\):[0-9]\+')
+
+	cat > $t_pfx.app/config.ru <<EOF
+#\--daemonize --host $host --port $port
+use Rack::ContentLength
+use Rack::ContentType, "text/plain"
+run lambda { |env| [ 200, {}, [ "#{\$master_ppid}\\n" ] ] }
+EOF
+	# we have --host/--port in config.ru instead
+	grep -v ^listen $unicorn_config > $unicorn_config_tmp
+
+	# the whole point of this exercise
+	echo "working_directory '$t_pfx.app'" >> $unicorn_config_tmp
+
+	# allows ppid to be 1 in before_fork
+	echo "preload_app true" >> $unicorn_config_tmp
+	cat >> $unicorn_config_tmp <<\EOF
+before_fork do |server,worker|
+  $master_ppid = Process.ppid # should be zero to detect daemonization
+end
+EOF
+
+	mv $unicorn_config_tmp $unicorn_config
+
+	# rely on --daemonize switch, no & or -D
+	unicorn -c $unicorn_config
+	unicorn_wait_start
+}
+
+t_begin "hit with curl" && {
+	body=$(curl -sSf http://$listen/)
+}
+
+t_begin "killing succeeds" && {
+	kill $unicorn_pid
+}
+
+t_begin "response body ppid == 1 (daemonized)" && {
+	test "$body" -eq 1
+}
+
+t_done
-- 

Eric Wong (7):
      launcher: get rid of backwards compatibility code
      isolate: don't run isolate in parallel
      Rakefile: only try rake-compiler if VERSION is defined
      Rakefile: isolate to rbx directory
      tests: set NO_PROXY when running tests
      unicorn_rails: use Kernel#warn instead of $stderr.puts
      respect "working_directory" wrt config.ru

-- 
Eric Wong
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply related	[relevance 3%]

* Re: Shared memory between workers
  2010-04-26  8:18  5% Shared memory between workers Iñaki Baz Castillo
@ 2010-04-26 19:03  0% ` Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2010-04-26 19:03 UTC (permalink / raw)
  To: unicorn list

Iñaki Baz Castillo <ibc@aliax.net> wrote:
> Hi, I plan to build a SIP TCP server (no UDP) based on
> Unicorn/Rainbows! HTTP server. The main different between a SIP server
> and HTTP server are:
> 
> - SIP uses persistent TCP connections, so I should use Rainbows!.
> - For a SIP server it's not valid a simple request-response model.
> Different workers could handle SIP messages (requests and responses)
> belonging to the same SIP session so I need a shared memory between
> all the workers.
> 
> Another option is using EventMachine, perhaps more suitable for this
> purpose by design as it uses a single Ruby process so sharing memory
> is not a problem. In the other side using a single process in a
> multicore server is a pain.
> I would like to use Unicorn/Rainbows as I love its design: by far it's
> the more reliable and efficient Ruby HTTP server and it takes
> advantages of Unix's features.
> 
> I don't want to use a DB server neither MemCache as "shared memory" as
> it would be too slow. Is there any way to share RAM memory between
> different Unicorn/Rainbows! workers in a *safe* way? I could create a
> Hash or Array of SIP sessions into the master process so all the
> workers reuse it, but I don't think it would be safe to access/write
> into it from different Ruby processes. For that I would also need a
> semaphore system (perhaps again a shared variable between all workers
> in order to lock the shared Array/Hash when a worker writes into it).
> 
> Any tip about it? suggstions?

Hi Iñaki,

First off I wouldn't call Memcached slow...  How many requests do you
need out of it and what kind of access patterns are you doing?

If you're on a modern Linux 2.6 box, then anything on the local
filesystem is basically shared memory if you have enough RAM to store
your working set (and it sounds like you do).

If you're willing to be confined to a single box, I've had great
experiences with TokyoCabinet the past few years.  One system I built
shares 10G of read-mostly data (on 16G boxes) across 8 Unicorn
(previously Mongrel) workers.  TokyoCabinet uses mmap and pread/pwrite,
so you can safely share DB handles across any number of native
threads/processes.

Writes in TC need filesystem locking and you can only have one active
writer, but that was still plenty fast enough in my experience.

If fsync() becomes a bottleneck, then for non-critical data either:

  1) disable it (TC lets you)
  2) or use libeatmydata if you choose something that doesn't let
     you disable fsync()

<soapbox>
  My personal opinion is that fsync()/O_SYNC are completely overrated.
  All important machines these days have redundant storage, redundant
  power supplies, ECC memory, hardware health monitoring/alerting and
  backup power.  Any remaining hardware/kernel failure possibilities
  are far less likely than application bugs that corrupt data :)

  But, if you really have critical data, /then/ get an SSD or
  a battery-backed write cache.
</soapbox>

-- 
Eric Wong
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[relevance 0%]

* Shared memory between workers
@ 2010-04-26  8:18  5% Iñaki Baz Castillo
  2010-04-26 19:03  0% ` Eric Wong
  0 siblings, 1 reply; 89+ results
From: Iñaki Baz Castillo @ 2010-04-26  8:18 UTC (permalink / raw)
  To: unicorn list

Hi, I plan to build a SIP TCP server (no UDP) based on
Unicorn/Rainbows! HTTP server. The main different between a SIP server
and HTTP server are:

- SIP uses persistent TCP connections, so I should use Rainbows!.
- For a SIP server it's not valid a simple request-response model.
Different workers could handle SIP messages (requests and responses)
belonging to the same SIP session so I need a shared memory between
all the workers.

Another option is using EventMachine, perhaps more suitable for this
purpose by design as it uses a single Ruby process so sharing memory
is not a problem. In the other side using a single process in a
multicore server is a pain.
I would like to use Unicorn/Rainbows as I love its design: by far it's
the more reliable and efficient Ruby HTTP server and it takes
advantages of Unix's features.

I don't want to use a DB server neither MemCache as "shared memory" as
it would be too slow. Is there any way to share RAM memory between
different Unicorn/Rainbows! workers in a *safe* way? I could create a
Hash or Array of SIP sessions into the master process so all the
workers reuse it, but I don't think it would be safe to access/write
into it from different Ruby processes. For that I would also need a
semaphore system (perhaps again a shared variable between all workers
in order to lock the shared Array/Hash when a worker writes into it).

Any tip about it? suggstions?
Thanks a lot.

-- 
Iñaki Baz Castillo
<ibc@aliax.net>
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

^ permalink raw reply	[relevance 5%]

* Re: "upstream timed out" after upgrades
  2010-02-04 14:22  8%         ` John-Paul Bader
@ 2010-02-04 15:11  0%           ` John-Paul Bader
  0 siblings, 0 replies; 89+ results
From: John-Paul Bader @ 2010-02-04 15:11 UTC (permalink / raw)
  To: unicorn list

To counter check I just built the latest ruby from source as well and the issue reappeared - so it happened between 26253 and tag/248

Kind regards, John

On 04.02.2010, at 15:22, John-Paul Bader wrote:

> Hey,
> 
> i checked out the revision 26253 built it and ran it and it seems to work again but: I didn't build it via FreeBSD ports so there might be a difference in configure / build options and I checked out the revision which included the change you suspect for causing the issue so I'm not sure if thats really helping us. Curling directly unicorn works without truncation and issues though.
> 
> Kind regards, John
> 
> On 04.02.2010, at 13:26, John-Paul Bader wrote:
> 
>> Hey again,
>> 
>> I will try to compile build the svn revision and let you know. I have to do some other work before that so I will report back in the evening (CEST / BERLIN) 
>> 
>> Thank you for helping out, kind regards,
>> 
>> John
>> 
>> On 04.02.2010, at 11:11, Eric Wong wrote:
>> 
>>> John-Paul Bader <hukl@h3q.com> wrote:
>>>> One more,
>>> 
>>> Hi,
>>> 
>>> About the exceptions, looks like you had '-d' (debug) instead of '-D'
>>> (daemonize) so it spewed every exception (even if trapped) to stderr.
>>> EAGAIN is common when dealing with non-blocking sockets.  Most of that
>>> is noise...
>>> 
>>> However the EINVAL in unicorn/http_response.rb is suspect.
>>> 
>>>> I reproduced the upgrading on my staging server which was still at the
>>>> old state in terms of software. I started by upgrading ruby from
>>>> 
>>>> ruby+nopthreads-1.8.7.160_5,1       -> ruby+nopthreads-1.8.7.248,1
>>>> ruby18-iconv-1.8.7.160,1                   -> ruby18-iconv-1.8.7.248,1
>>>> 
>>>> And voilá - the very same problems. So now I'm like what?
>>>> 
>>>> Is this rather a ruby than a unicorn issue ? Couldn't find any clues
>>>> in the changelog so far:
>>>> http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/tags/v1_8_7_248/ChangeLog
>>> 
>>> That should narrow it down, so I start reading diffs from
>>> v1_8_7_160..v1_8_7_248 ...
>>> 
>>> Does backporting the following change in ruby_1_8
>>> (but not yet in the ruby_1_8_7 branch) fix things for you?
>>> 
>>> commit 841a57341ed43f5fa86489c12aceb25a232be820
>>> Author: nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
>>> Date:   Fri Jan 8 09:51:23 2010 +0000
>>> 
>>>  * io.c (io_fwrite): preserve errno.  [ruby-core:27425]
>>> 
>>> 
>>>  git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@26253
>>> 
>>> (snipped)
>>> 
>>> diff --git a/io.c b/io.c
>>> index 375cbc8..d4d28e5 100644
>>> --- a/io.c
>>> +++ b/io.c
>>> @@ -122,6 +122,9 @@ extern void Init_File _((void));
>>> # endif
>>> #endif
>>> 
>>> +#define preserving_errno(stmts) \
>>> +	do {int saved_errno = errno; stmts; errno = saved_errno;} while (0)
>>> +
>>> VALUE rb_cIO;
>>> VALUE rb_eEOFError;
>>> VALUE rb_eIOError;
>>> @@ -490,7 +493,7 @@ io_fwrite(str, fptr)
>>> 	r = write(fileno(f), RSTRING(str)->ptr+offset, l);
>>>       TRAP_END;
>>> #if BSD_STDIO
>>> -	fseeko(f, lseek(fileno(f), (off_t)0, SEEK_CUR), SEEK_SET);
>>> +	preserving_errno(fseeko(f, lseek(fileno(f), (off_t)0, SEEK_CUR), SEEK_SET));
>>> #endif
>>>       if (r == n) return len;
>>>       if (0 <= r) {
>>> ---
>>> Of course, the original reason for this fseeko() was to fix another
>>> problem Unicorn exposed when mixing stdio + unistd calls...
>>> 
>>> http://redmine.ruby-lang.org/issues/show/2267
>>> 
>>> -- 
>>> Eric Wong
>>> _______________________________________________
>>> Unicorn mailing list - mongrel-unicorn@rubyforge.org
>>> http://rubyforge.org/mailman/listinfo/mongrel-unicorn
>>> Do not quote signatures (like this one) or top post when replying
>>> 
>> 
>> _______________________________________________
>> Unicorn mailing list - mongrel-unicorn@rubyforge.org
>> http://rubyforge.org/mailman/listinfo/mongrel-unicorn
>> Do not quote signatures (like this one) or top post when replying
>> 
> 
> _______________________________________________
> Unicorn mailing list - mongrel-unicorn@rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-unicorn
> Do not quote signatures (like this one) or top post when replying
> 

_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[relevance 0%]

* Re: "upstream timed out" after upgrades
  2010-02-04 12:26  6%       ` John-Paul Bader
@ 2010-02-04 14:22  8%         ` John-Paul Bader
  2010-02-04 15:11  0%           ` John-Paul Bader
  0 siblings, 1 reply; 89+ results
From: John-Paul Bader @ 2010-02-04 14:22 UTC (permalink / raw)
  To: unicorn list

Hey,

i checked out the revision 26253 built it and ran it and it seems to work again but: I didn't build it via FreeBSD ports so there might be a difference in configure / build options and I checked out the revision which included the change you suspect for causing the issue so I'm not sure if thats really helping us. Curling directly unicorn works without truncation and issues though.

Kind regards, John

On 04.02.2010, at 13:26, John-Paul Bader wrote:

> Hey again,
> 
> I will try to compile build the svn revision and let you know. I have to do some other work before that so I will report back in the evening (CEST / BERLIN) 
> 
> Thank you for helping out, kind regards,
> 
> John
> 
> On 04.02.2010, at 11:11, Eric Wong wrote:
> 
>> John-Paul Bader <hukl@h3q.com> wrote:
>>> One more,
>> 
>> Hi,
>> 
>> About the exceptions, looks like you had '-d' (debug) instead of '-D'
>> (daemonize) so it spewed every exception (even if trapped) to stderr.
>> EAGAIN is common when dealing with non-blocking sockets.  Most of that
>> is noise...
>> 
>> However the EINVAL in unicorn/http_response.rb is suspect.
>> 
>>> I reproduced the upgrading on my staging server which was still at the
>>> old state in terms of software. I started by upgrading ruby from
>>> 
>>> ruby+nopthreads-1.8.7.160_5,1       -> ruby+nopthreads-1.8.7.248,1
>>> ruby18-iconv-1.8.7.160,1                   -> ruby18-iconv-1.8.7.248,1
>>> 
>>> And voilá - the very same problems. So now I'm like what?
>>> 
>>> Is this rather a ruby than a unicorn issue ? Couldn't find any clues
>>> in the changelog so far:
>>> http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/tags/v1_8_7_248/ChangeLog
>> 
>> That should narrow it down, so I start reading diffs from
>> v1_8_7_160..v1_8_7_248 ...
>> 
>> Does backporting the following change in ruby_1_8
>> (but not yet in the ruby_1_8_7 branch) fix things for you?
>> 
>> commit 841a57341ed43f5fa86489c12aceb25a232be820
>> Author: nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
>> Date:   Fri Jan 8 09:51:23 2010 +0000
>> 
>>   * io.c (io_fwrite): preserve errno.  [ruby-core:27425]
>> 
>> 
>>   git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@26253
>> 
>> (snipped)
>> 
>> diff --git a/io.c b/io.c
>> index 375cbc8..d4d28e5 100644
>> --- a/io.c
>> +++ b/io.c
>> @@ -122,6 +122,9 @@ extern void Init_File _((void));
>> # endif
>> #endif
>> 
>> +#define preserving_errno(stmts) \
>> +	do {int saved_errno = errno; stmts; errno = saved_errno;} while (0)
>> +
>> VALUE rb_cIO;
>> VALUE rb_eEOFError;
>> VALUE rb_eIOError;
>> @@ -490,7 +493,7 @@ io_fwrite(str, fptr)
>> 	r = write(fileno(f), RSTRING(str)->ptr+offset, l);
>>        TRAP_END;
>> #if BSD_STDIO
>> -	fseeko(f, lseek(fileno(f), (off_t)0, SEEK_CUR), SEEK_SET);
>> +	preserving_errno(fseeko(f, lseek(fileno(f), (off_t)0, SEEK_CUR), SEEK_SET));
>> #endif
>>        if (r == n) return len;
>>        if (0 <= r) {
>> ---
>> Of course, the original reason for this fseeko() was to fix another
>> problem Unicorn exposed when mixing stdio + unistd calls...
>> 
>>  http://redmine.ruby-lang.org/issues/show/2267
>> 
>> -- 
>> Eric Wong
>> _______________________________________________
>> Unicorn mailing list - mongrel-unicorn@rubyforge.org
>> http://rubyforge.org/mailman/listinfo/mongrel-unicorn
>> Do not quote signatures (like this one) or top post when replying
>> 
> 
> _______________________________________________
> Unicorn mailing list - mongrel-unicorn@rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-unicorn
> Do not quote signatures (like this one) or top post when replying
> 

_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[relevance 8%]

* Re: "upstream timed out" after upgrades
  @ 2010-02-04 12:26  6%       ` John-Paul Bader
  2010-02-04 14:22  8%         ` John-Paul Bader
  0 siblings, 1 reply; 89+ results
From: John-Paul Bader @ 2010-02-04 12:26 UTC (permalink / raw)
  To: unicorn list

Hey again,

I will try to compile build the svn revision and let you know. I have to do some other work before that so I will report back in the evening (CEST / BERLIN) 

Thank you for helping out, kind regards,

John

On 04.02.2010, at 11:11, Eric Wong wrote:

> John-Paul Bader <hukl@h3q.com> wrote:
>> One more,
> 
> Hi,
> 
> About the exceptions, looks like you had '-d' (debug) instead of '-D'
> (daemonize) so it spewed every exception (even if trapped) to stderr.
> EAGAIN is common when dealing with non-blocking sockets.  Most of that
> is noise...
> 
> However the EINVAL in unicorn/http_response.rb is suspect.
> 
>> I reproduced the upgrading on my staging server which was still at the
>> old state in terms of software. I started by upgrading ruby from
>> 
>> ruby+nopthreads-1.8.7.160_5,1       -> ruby+nopthreads-1.8.7.248,1
>> ruby18-iconv-1.8.7.160,1                   -> ruby18-iconv-1.8.7.248,1
>> 
>> And voilá - the very same problems. So now I'm like what?
>> 
>> Is this rather a ruby than a unicorn issue ? Couldn't find any clues
>> in the changelog so far:
>> http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/tags/v1_8_7_248/ChangeLog
> 
> That should narrow it down, so I start reading diffs from
> v1_8_7_160..v1_8_7_248 ...
> 
> Does backporting the following change in ruby_1_8
> (but not yet in the ruby_1_8_7 branch) fix things for you?
> 
> commit 841a57341ed43f5fa86489c12aceb25a232be820
> Author: nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
> Date:   Fri Jan 8 09:51:23 2010 +0000
> 
>    * io.c (io_fwrite): preserve errno.  [ruby-core:27425]
> 
> 
>    git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@26253
> 
>  (snipped)
> 
> diff --git a/io.c b/io.c
> index 375cbc8..d4d28e5 100644
> --- a/io.c
> +++ b/io.c
> @@ -122,6 +122,9 @@ extern void Init_File _((void));
> # endif
> #endif
> 
> +#define preserving_errno(stmts) \
> +	do {int saved_errno = errno; stmts; errno = saved_errno;} while (0)
> +
> VALUE rb_cIO;
> VALUE rb_eEOFError;
> VALUE rb_eIOError;
> @@ -490,7 +493,7 @@ io_fwrite(str, fptr)
> 	r = write(fileno(f), RSTRING(str)->ptr+offset, l);
>         TRAP_END;
> #if BSD_STDIO
> -	fseeko(f, lseek(fileno(f), (off_t)0, SEEK_CUR), SEEK_SET);
> +	preserving_errno(fseeko(f, lseek(fileno(f), (off_t)0, SEEK_CUR), SEEK_SET));
> #endif
>         if (r == n) return len;
>         if (0 <= r) {
> ---
> Of course, the original reason for this fseeko() was to fix another
> problem Unicorn exposed when mixing stdio + unistd calls...
> 
>   http://redmine.ruby-lang.org/issues/show/2267
> 
> -- 
> Eric Wong
> _______________________________________________
> Unicorn mailing list - mongrel-unicorn@rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-unicorn
> Do not quote signatures (like this one) or top post when replying
> 

_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[relevance 6%]

* Re: Why "--pid" is deprecated?
  2009-12-24 13:36  6% Why "--pid" is deprecated? Iñaki Baz Castillo
@ 2009-12-24 19:17  0% ` Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2009-12-24 19:17 UTC (permalink / raw)
  To: unicorn list

Iñaki Baz Castillo <ibc@aliax.net> wrote:
> By inspecting bin/unicorn I've realized that "--pid" file exists but it's 
> deprecated:
> 
>   opts.on("-P", "--pid FILE", "DEPRECATED") do |f|
>     warn %q{Use of --pid/-P is strongly discouraged}
>     warn %q{Use the 'pid' directive in the Unicorn config file instead}
>     options[:pid] = f
>   end
> 
> Could I know why? In order to build a service init script is really common the 
> init script to handle the PID file so it can start, restart or stop the 
> process runnining under that PID value.

Hi Iñaki,

It conflicts/confuses the -P/--path setting in bin/unicorn_rails.  An
oversight on my part since I based unicorn_rails on script/server
in Rails.  So I suppose we're stuck with it for a while.

> Which is the real advantage of using "pid" directive in config file rather 
> than "--pid"?

Not much, pid files suck either way.  Sadly there aren't many other
options that's universally used/accepted.

Using ENV["UNICORN_PID"] could be an option in the config file if you
want to share it between the config and init script.

-- 
Eric Wong
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[relevance 0%]

* Why "--pid" is deprecated?
@ 2009-12-24 13:36  6% Iñaki Baz Castillo
  2009-12-24 19:17  0% ` Eric Wong
  0 siblings, 1 reply; 89+ results
From: Iñaki Baz Castillo @ 2009-12-24 13:36 UTC (permalink / raw)
  To: mongrel-unicorn

By inspecting bin/unicorn I've realized that "--pid" file exists but it's 
deprecated:

  opts.on("-P", "--pid FILE", "DEPRECATED") do |f|
    warn %q{Use of --pid/-P is strongly discouraged}
    warn %q{Use the 'pid' directive in the Unicorn config file instead}
    options[:pid] = f
  end

Could I know why? In order to build a service init script is really common the 
init script to handle the PID file so it can start, restart or stop the 
process runnining under that PID value.

Which is the real advantage of using "pid" directive in config file rather 
than "--pid"?

Thanks.

-- 
Iñaki Baz Castillo <ibc@aliax.net>
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

^ permalink raw reply	[relevance 6%]

* Snow Leopard 32bit kernel gotcha
@ 2009-11-30 11:41  4% David Palm
  0 siblings, 0 replies; 89+ results
From: David Palm @ 2009-11-30 11:41 UTC (permalink / raw)
  To: mongrel-unicorn

Hi,
just thought I'd signal an issue I had this morning installing unicorn under Ruby 1.9.1.

I'm using the exellent rvm to handle my rubies and made a mistake when I first installed it after passing to Snow Leopard. In order to build libraries with 64bit support you have to stick the following in your ~/.rvmrc:
	rvm_archflags="-arch x86_64"

So my mistake was I built my ruby 1.9 before passing to a 64bit kernel.

I got a pretty weird error from unicorn:

	In file included from unicorn_http.rl:7:
	ext_help.h: In function ‘rb_18_str_set_len’:
	ext_help.h:20: error: ‘struct RString’ has no member named ‘len’
	ext_help.h:21: error: ‘struct RString’ has no member named ‘ptr’
	make: *** [unicorn_http.o] Error 1

That threw me off in the wrong direction, thinking it was yet another extension that didn't get the RSTRING struct changes right. Not so.

Looking more carefully at mkmf.log it all became obvious:

	In file included from /Users/david/.rvm/ruby-1.9.1-p243/include/ruby-1.9.1/ruby.h:32,
                 from conftest.c:1:
	/Users/david/.rvm/ruby-1.9.1-p243/include/ruby-1.9.1/ruby/ruby.h: In function ‘INT2NUM’:
	/Users/david/.rvm/ruby-1.9.1-p243/include/ruby-1.9.1/ruby/ruby.h:464: warning: comparison is always true due to limited 	range of data type
	/Users/david/.rvm/ruby-1.9.1-p243/include/ruby-1.9.1/ruby/ruby.h:464: warning: comparison is always true due to limited 	range of data type
	/Users/david/.rvm/ruby-1.9.1-p243/include/ruby-1.9.1/ruby/ruby.h: In function ‘UINT2NUM’:
	/Users/david/.rvm/ruby-1.9.1-p243/include/ruby-1.9.1/ruby/ruby.h:472: warning: comparison is always true due to limited 	range of data type
	ld: warning: in /Users/david/.rvm/ruby-1.9.1-p243/lib/libruby-static.a, file is not of required architecture

Lipo to the rescue:
	lipo -info ~/.rvm/ruby-1.9.1-p243/lib/libruby-static.a
	input file /Users/david/.rvm/ruby-1.9.1-p243/lib/libruby-static.a is not a fat file
	Non-fat file: /Users/david/.rvm/ruby-1.9.1-p243/lib/libruby-static.a is architecture: i386

Solution? Remove old 1.9 install and reinstall everything (at least all C extensions).

:)
_______________________________________________
mongrel-unicorn mailing list
mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn

^ permalink raw reply	[relevance 4%]

* draft release notes (so far) for upcoming 0.93.0
@ 2009-10-01  8:13  7% Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2009-10-01  8:13 UTC (permalink / raw)
  To: mongrel-unicorn

The one minor bugfix is only for users who set RAILS_RELATIVE_URL_ROOT
in a config file.  Users of the "--path" switch or those who set the
environment variable in the shell were unaffected by this bug.  Note
that we still don't have relative URL root support for Rails < 2.3, and
are unlikely to bother with it unless there is visible demand for it.  I
didn't even know people used/cared for relative URL roots before today
(it was a Rails 2.3.4 user).

New features (so far) includes support for :tries and :delay when
specifying a "listen" in an after_fork hook.  This was inspired by Chris
Wanstrath's example of binding per-worker listen sockets in a loop while
migrating (or upgrading) Unicorn.  Setting a negative value for :tries
means we'll retry the listen indefinitely until the socket becomes
available.

So you can do something like this in an after_fork hook:

    after_fork do |server,worker|
      addr = "127.0.0.1:#{9293 + worker.nr}"
      server.listen(addr, :tries => -1, :delay => 5)
    end

There's also the usual round of added documentation, packaging fixes,
code cleanups and minor performance improvements that are viewable
in the git log....

Shortlog since v0.92.0 (so far) below:

Eric Wong (45):
      build: hardcode the canonical git URL
      build: manifest dropped manpages
      build: smaller ChangeLog
      doc/LATEST: remove trailing newline
      http: don't force -fPIC if it can't be used
      .gitignore on *.rbc files Rubinius generates
      README/gemspec: a better description, hopefully
      GNUmakefile: add missing .manifest dep on test installs
      Add HACKING document
      configurator: fix user switch example in RDoc
      local.mk.sample: time and perms enforcement
      unicorn_rails: show "RAILS_ENV" in help message
      gemspec: compatibility with older Rubygems
      Split out KNOWN_ISSUES document
      KNOWN_ISSUES: add notes about the "isolate" gem
      gemspec: fix test_files regexp match
      gemspec: remove tests that fork from test_files
      test_signals: ensure we can parse pids in response
      GNUmakefile: cleanup test/manifest generation
      util: remove APPEND_FLAGS constant
      http_request: simplify and remove handle_body method
      http_response: simplify and remove const dependencies
      local.mk.sample: fix .js times
      TUNING: notes about benchmarking a high :backlog
      HttpServer#listen accepts :tries and :delay parameters
      "make install" avoids installing multiple .so objects
      Use Configurator#expand_addr in HttpServer#listen
      configurator: move initialization stuff to #initialize
      Remove "Z" constant for binary strings
      cgi_wrapper: don't warn about stdoutput usage
      cgi_wrapper: simplify status handling in response
      cgi_wrapper: use Array#concat instead of +=
      server: correctly unset reexec_pid on child death
      configurator: update and modernize examples
      configurator: add colons in front of listen() options
      configurator: remove DEFAULT_LOGGER constant
      gemspec: clarify commented-out licenses section
      Add makefile targets for non-release installs
      cleanup: use question mark op for 1-byte comparisons
      RDoc for Unicorn::HttpServer::Worker
      small cleanup to pid file handling + documentation
      rails: RAILS_RELATIVE_URL_ROOT may be set in Unicorn config
      unicorn_rails: undeprecate --path switch
      manpages: document environment variables
      README: remove reference to different versions

-- 
Eric Wong

^ permalink raw reply	[relevance 7%]

* rolling your own Unicorn gem prerelease
@ 2009-09-30 23:44  7% Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2009-09-30 23:44 UTC (permalink / raw)
  To: mongrel-unicorn

Instead of relying entirely on the ridiculous test suite, it's now more
easily possible to roll your own properly-versioned prerelease gems.

You'll need RubyGems >= 1.3.5 to handle pre-release version numbers.

Of course setup.rb users (like myself) have always had this capability,
I just lack real applications to test against...

>From 9cc4f87353b84f5229d4a8bae78260c24cd02154 Mon Sep 17 00:00:00 2001
From: Eric Wong <normalperson@yhbt.net>
Date: Wed, 30 Sep 2009 13:41:26 -0700
Subject: [PATCH] Add makefile targets for non-release installs

This should make it easier to test and run unreleased
versions.
---
 GNUmakefile |    8 ++++++++
 HACKING     |   15 +++++++++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/GNUmakefile b/GNUmakefile
index 8becc89..3087082 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -227,6 +227,11 @@ verify:
 	test `git rev-parse --verify HEAD^0` = \
 	     `git rev-parse --verify refs/tags/v$(VERSION)^{}`
 
+gem: $(pkggem)
+
+install-gem: $(pkggem)
+	gem install $(CURDIR)/$<
+
 $(pkggem): manifest
 	gem build $(rfpackage).gemspec
 	mkdir -p pkg
@@ -249,6 +254,9 @@ release: verify package $(release_notes) $(release_changes)
 	  $(rfproject) $(rfpackage) $(VERSION) $(pkggem)
 	rubyforge add_file \
 	  $(rfproject) $(rfpackage) $(VERSION) $(pkgtgz)
+else
+gem install-gem: GIT-VERSION-FILE
+	$(MAKE) $@ VERSION=$(GIT_VERSION)
 endif
 
 .PHONY: .FORCE-GIT-VERSION-FILE doc $(T) $(slow_tests) manifest man
diff --git a/HACKING b/HACKING
index 5085545..08aa76d 100644
--- a/HACKING
+++ b/HACKING
@@ -96,3 +96,18 @@ We will adhere to mostly the same conventions for patch submissions as
 git itself.  See the Documentation/SubmittingPatches document
 distributed with git on on patch submission guidelines to follow.  Just
 don't email the git mailing list or maintainer with Unicorn patches :)
+
+== Running Development Versions
+
+It is easy to install the contents of your git working directory:
+
+Via RubyGems (RubyGems 1.3.5+ recommended for prerelease versions):
+
+  make install-gem
+
+Without RubyGems (via setup.rb):
+
+  make install
+
+It is not at all recommended to mix a RubyGems installation with an
+installation done without RubyGems, however.
-- 
Eric Wong

^ permalink raw reply related	[relevance 7%]

* [ANN] unicorn 0.92.0
@ 2009-09-18 22:16  3% Eric Wong
  0 siblings, 0 replies; 89+ results
From: Eric Wong @ 2009-09-18 22:16 UTC (permalink / raw)
  To: mongrel-unicorn

Unicorn is a Rack HTTP server for Unix and fast clients

Small fixes and documentation are the focus of this release.

James Golick reported and helped me track down a bug that caused
SIGHUP to drop the default listener (0.0.0.0:8080) if and only
if listeners were completely unspecified in both the
command-line and Unicorn config file.  The Unicorn config file
remains the recommended option for specifying listeners as it
allows fine-tuning of the :backlog, :rcvbuf, :sndbuf,
:tcp_nopush, and :tcp_nodelay options.

There are some documentation (and resulting website)
improvements.  setup.rb users will notice the new section 1
manpages for `unicorn` and `unicorn_rails`, Rubygems users
will have to install manpages manually or use the website.

  Edit: That's not entirely true, I screwed up the package but
  you can get them from http://unicorn.bogomips.org/unicorn.1
  and http://unicorn.bogomips.org/unicorn_rails.1

The HTTP parser got a 3rd-party code review which resulted in
some cleanups and one insignificant bugfix as a result.

Additionally, the HTTP parser compiles, runs and passes unit
tests under Rubinius.  The pure-Ruby parts still do not work yet
and we currently lack the resources/interest to pursue this
further but help will be gladly accepted.

The website now has an Atom feed for new release announcements.
Those unfamiliar with Atom or HTTP may finger unicorn@bogomips.org
for the latest announcements.

Eric Wong (53):
      README: update with current version
      http: cleanup and avoid potential signedness warning
      http: clarify the setting of the actual header in the hash
      http: switch to macros for bitflag handling
      http: refactor keepalive tracking to functions
      http: use explicit elses for readability
      http: remove needless goto
      http: extra assertion when advancing p manually
      http: verbose assertions
      http: NIL_P(var) instead of var == Qnil
      http: rb_gc_mark already ignores immediates
      http: ignore Host: continuation lines with absolute URIs
      doc/SIGNALS: fix the no-longer-true bit about socket options
      "encoding: binary" comments for all sources (1.9)
      http_response: don't "rescue nil" for body.close
      CONTRIBUTORS: fix capitalization for why
      http: support Rubies without the OBJ_FROZEN macro
      http: define OFFT2NUM macro on Rubies without it
      http: no-op rb_str_modify() for Rubies without it
      http: compile with -fPIC
      http: use rb_str_{update,flush} if available
      http: create a new string buffer on empty values
      Update documentation for Rubinius support status
      http: cleanup assertion for memoized header strings
      http: add #endif comment labels where appropriate
      Add .mailmap file for "git shortlog" and other tools
      Update Manifest with mailmap
      Fix comment about speculative accept()
      SIGNALS: use "Unicorn" when referring to the web server
      Add new Documentation section for manpages
      test_exec: add extra tests for HUP and preload_app
      socket_helper: (FreeBSD) don't freeze the accept filter constant
      Avoid freezing objects that don't benefit from it
      SIGHUP no longer drops lone, default listener
      doc: generate ChangeLog and NEWS file for RDoc
      Remove Echoe and roll our own packaging/release...
      unicorn_rails: close parentheses in help message
      launchers: deprecate ambiguous -P/--p* switches
      man1/unicorn: avoid unnecessary emphasis
      Add unicorn_rails(1) manpage
      Documentation: don't force --rsyncable flag with gzip(1)
      Simplify and standardize manpages build/install
      GNUmakefile: package .tgz includes all generated files
      doc: begin integration of HTML manpages into RDoc
      Update TODO
      html: add Atom feeds
      doc: latest news is available through finger
      NEWS.atom: file timestamp matches latest entry
      pandoc needs the standalone switch for manpages
      man1/unicorn: split out RACK ENVIRONMENT section
      man1/unicorn_rails: fix unescaped underscore
      NEWS.atom.xml only lists the first 10 entries
      unicorn 0.92.0

* site: http://unicorn.bogomips.org/
* git: git://git.bogomips.org/unicorn.git
* cgit: http://git.bogomips.org/cgit/unicorn.git/
* list: mongrel-unicorn@rubyforge.org
* nntp: nntp://news.gmane.org/gmane.comp.lang.ruby.unicorn.general
* finger: unicorn@bogomips.org

-- 
Eric Wong

^ permalink raw reply	[relevance 3%]

Results 1-89 of 89 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2009-09-18 22:16  3% [ANN] unicorn 0.92.0 Eric Wong
2009-09-30 23:44  7% rolling your own Unicorn gem prerelease Eric Wong
2009-10-01  8:13  7% draft release notes (so far) for upcoming 0.93.0 Eric Wong
2009-11-30 11:41  4% Snow Leopard 32bit kernel gotcha David Palm
2009-12-24 13:36  6% Why "--pid" is deprecated? Iñaki Baz Castillo
2009-12-24 19:17  0% ` Eric Wong
2010-02-04  8:16     "upstream timed out" after upgrades John-Paul Bader
2010-02-04  8:48     ` John-Paul Bader
2010-02-04  9:28       ` John-Paul Bader
2010-02-04 10:11         ` Eric Wong
2010-02-04 12:26  6%       ` John-Paul Bader
2010-02-04 14:22  8%         ` John-Paul Bader
2010-02-04 15:11  0%           ` John-Paul Bader
2010-04-26  8:18  5% Shared memory between workers Iñaki Baz Castillo
2010-04-26 19:03  0% ` Eric Wong
2010-06-09 12:58     Working directory and config.ru Pierre Baillet
2010-06-09 18:04     ` Eric Wong
2010-06-10  9:58  3%   ` Eric Wong
2010-06-25 15:06  4% test failure on Mac OSX Andrew Milkowski
2010-08-09 22:54  3% [ANN] 1.9 users: socket_dontwait - MSG_DONTWAIT socket methods Eric Wong
2010-11-17  0:26  5% [ANN] unicorn 3.0.0pre1 - disable rewindable input! Eric Wong
2011-01-21 20:37  7% [PATCH] git.bogomips.org => bogomips.org Eric Wong
2011-03-18 18:09     [ANN] raindrops updates (mainly for Linux users) Eric Wong
2011-03-23 18:12  6% ` Troex Nevelin
2011-06-06 11:44  7% [PATCH] Document the method for building the Unicorn gem Hongli Lai
2011-06-06 17:31  8% [PATCH] Ensure that 'make gem' builds the documentation too Hongli Lai
2011-06-06 17:51     ` Eric Wong
2011-06-07 15:11       ` Hongli Lai
2011-06-07 17:06  8%     ` Eric Wong
2011-06-16 23:25  2% [PATCH] replace fchmod()-based heartbeat with raindrops Eric Wong
2011-06-24 17:30  6% ` Eric Wong
2011-06-24 18:17       ` Jeremy Evans
2011-06-24 20:51         ` Eric Wong
2011-06-24 22:50  6%       ` Aleksandar Simic
2011-06-25  0:15  0%         ` Eric Wong
2011-06-26  5:36  0%           ` Aleksandar Simic
2012-05-09  6:18  6% unicorn 4 does not compile on Joyent (SmartOS/Solaris) due to raindrops dependency Konstantin Gredeskoul
2012-05-09  7:02  5% ` Eric Wong
2012-05-09  7:11  0%   ` Konstantin Gredeskoul
2012-05-11  1:12     [raindrops] testers on 32-bit FreeBSD wanted Eric Wong
2012-05-12  6:05  5% ` Eric Wong
2012-10-12 17:55     [PATCH] explicitly use escaped minus in man pages Hleb Valoshka
2012-10-15 18:50  6% ` Eric Wong
2012-10-17 15:33  0%   ` Hleb Valoshka
2012-11-12 23:37     Testing Unicorn on Rubinius mike
2012-11-13  0:18  6% ` Eric Wong
2012-12-06 19:48  3% Unicorn fails to install even though it's already installed and running Mac Martine
2012-12-06 20:23  0% ` Eric Wong
2012-12-06 21:11  0%   ` Mac Martine
2013-01-25 10:52     No middleware without touching RACK_ENV Lin Jen-Shin (godfat)
2013-01-25 18:39     ` Eric Wong
2013-01-28 14:43  3%   ` Lin Jen-Shin (godfat)
2013-04-20  0:52  6% Worker Timeout Debugging Bill Vieux
2013-04-20  1:26  0% ` Eric Wong
2013-11-25  6:01     permissions on ChangeLog and NEWS Ken Dreyer
2013-11-25  6:52  6% ` Eric Wong
2015-02-04 20:16 10% [PATCH] GNUmakefile: fix clean gem build + reduce build cruft Eric Wong
2015-02-06 20:15  5% [PATCH] doc: update support status for Ruby versions Eric Wong
2015-02-06 22:17  5% [PATCH] fix uninstalled testing and reduce require paths Eric Wong
2015-04-22 19:02  8% unicorn 4.8.x-stable branch pushed to git Eric Wong
2015-04-24  3:17  8% [ANN] unicorn 4.9.0 - Rack HTTP server for fast clients and *nix Eric Wong
2015-06-15 22:56  5% [ANN] unicorn 5.0.0.pre1 - incompatible changes! Eric Wong
2016-01-07  3:41  4% [PUSHED] various documentation updates Eric Wong
2016-01-08 18:34     [PATCH] limit rack version for ruby compatibility Adam Duke
2016-01-08 19:18  6% ` Eric Wong
2016-01-08 21:50  0%   ` Aaron Patterson
2016-01-08 22:37  5%     ` Eric Wong
2016-10-25 22:25  3% [PATCH] relocate website to https://bogomips.org/unicorn/ Eric Wong
     [not found]     <f1d5eacb-b6a2-be96-34aa-fe061a194a62@onenetbeyond.org>
     [not found]     ` <CAAB-Kcnwzc8Tcszv3FCPkyJRKRCsHRH6k_qBhKfBpSODxqKy5g@mail.gmail.com>
2016-10-28  0:23 15%   ` trying to update unicorn to 5.1, build failure: VERSION= must be specified Eric Wong
2016-11-03 15:46  9%     ` Pirate Praveen
2017-03-23 23:34 21%       ` [PATCH] gemspec: remove olddoc from build dependency Eric Wong
     [not found]     <20161031-unicorn-5.2.0-released@bogomips.org>
2016-10-31 20:04  5% ` [ANN] unicorn 5.2.0 - Rack HTTP server for fast clients and *nix Eric Wong
2016-11-07 17:13 13% Build error of 5.1.0 due to RString Olivier FAURAX
2016-11-07 20:39  8% ` Eric Wong
2016-11-08  8:56  2%   ` Olivier FAURAX
2016-11-08  9:43 17%     ` Build error of 5.1.0 due to RString Eric Wong
2016-12-12  2:10  3% WTF is up with memory usage nowadays? Eric Wong
2016-12-12  4:05  0% ` Sam Saffron
2016-12-12  9:49  5% ` hukl
2017-02-08 20:00  0% ` Eric Wong
2017-03-23  2:48  4% [ANN] raindrops 0.18.0 - real-time stats for preforking Rack servers Eric Wong
2017-03-24  0:28  4% [ANN] unicorn 5.3.0.pre1 - Rack HTTP server for fast clients and Unix Eric Wong
2017-04-01  8:08  3% [ANN] unicorn 5.3.0 " Eric Wong
2017-07-13 18:48     Random crash when sending USR2 + QUIT signals to Unicorn process Pere Joan Martorell
2017-07-13 19:34  7% ` Eric Wong
2017-07-14 10:21  0%   ` Pere Joan Martorell
2017-07-14 21:16         ` Eric Wong
2017-07-14 22:50           ` Jeremy Evans
2017-07-15  0:15             ` Eric Wong
2017-07-15  1:34               ` Jeremy Evans
2017-07-15  4:45                 ` Eric Wong
2017-07-15  7:56                   ` Jeremy Evans
2017-07-17 14:32                     ` Jeremy Evans
2017-07-24  1:25                       ` Eric Wong
2017-08-07  6:16  5%                     ` Jeremy Evans
2017-08-07 20:18  0%                       ` Eric Wong
2018-11-07 23:38  3% [PATCH] doc: update more URLs to use HTTPS and avoid redirects Eric Wong
     [not found]     <E5E85D7F-061C-422C-B02E-8FC248F87986@southofheaven.org>
     [not found]     ` <20190110200102.GA14520@portux.naturalnet.de>
2019-01-10 20:28  6%   ` Bug#918916: Unicorn not reporting proper version for gemfile? Eric Wong
2019-01-12  9:42  0%     ` Hleb Valoshka
2019-03-06  1:47     Issues after 5.5.0 upgrade Stan Pitucha
2019-03-06  2:48     ` Eric Wong
2019-03-06  4:07       ` Stan Pitucha
2019-03-06  4:44         ` Eric Wong
2019-03-06  5:57           ` Jeremy Evans
2019-03-06  7:27             ` Stan Pitucha
2019-03-07  2:28 13%           ` [PATCH] unicorn_rails: fix regression with Rails >= 3.x in app build Eric Wong
2019-05-06  6:50  5% [ANN] unicorn 5.5.1 - Rack HTTP server for fast clients and Eric Wong
2020-01-14  7:46     [PATCH] doc: s/bogomips.org/yhbt.net/g Eric Wong
2020-01-14  7:46  1% ` Eric Wong
2020-07-26  1:57  6% [PATCH 0/2] minor test improvements Eric Wong
2020-07-26  1:57 12% ` [PATCH 2/2] build: revamp and avoid unnecessary rebuilds Eric Wong
2020-09-01 12:17     [PATCH] Update ruby_version requirement to allow ruby 3.0 Jean Boussier
2020-09-01 14:48     ` Eric Wong
2020-09-01 15:04       ` Jean Boussier
2020-09-01 15:41         ` Eric Wong
2020-09-03  7:52           ` Jean Boussier
2020-09-03  8:25             ` Eric Wong
2020-09-03  8:29  6%           ` Jean Boussier
2020-09-03  9:31  6%             ` Eric Wong
2020-09-03 11:23                   ` Jean Boussier
2020-09-04 12:34                     ` Jean Boussier
2020-09-06  9:30                       ` Eric Wong
2020-09-07  7:13                         ` Jean Boussier
2020-09-08  2:24                           ` Eric Wong
2020-09-08  8:00  8%                         ` Jean Boussier
2020-09-08  8:50  8%                           ` Eric Wong
2020-09-08  8:56  6%                             ` Jean Boussier
2020-12-24 20:40  8% [PATCH] build: publish_doc: remove created.rid and index.html from site Eric Wong
2021-10-01  3:09     [PATCH 0/6] reduce thundering herds on Linux 4.5+ Eric Wong
2021-10-01  3:09 21% ` [PATCH 3/6] HACKING: drop outdated information about pandoc Eric Wong
2021-12-25 17:41     [PATCH 0/3] Ruby 3.1 + doc/URL updates Eric Wong
2021-12-25 17:41  6% ` [PATCH 2/3] drop Ruby version warning, fix speling errer Eric Wong
2021-12-25 18:06  4% [ANN] unicorn 6.1.0 - Rack HTTP server for fast clients and *nix Eric Wong
2023-06-05  9:15     [PATCH] httpdate: favor gettimeofday(2) over time(2) for correctness Eric Wong
2023-06-05  9:28  9% ` [PATCH 2/1] httpdate: fix build with Ruby 2.7 (at least) Eric Wong
2024-03-23 19:45  1% [PATCH 0/4] a small pile of patches Eric Wong
2024-05-06 20:10  6% [PATCH 0/5..5/5] more tests to Perl 5 for stability Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).