District Court | 27 Aug 07:25 2015

Notice to Appear

Notice to Appear,

You have to appear in the Court on the September 01.
You are kindly asked to prepare and bring the documents relating to the case to Court on the specified date.
Note: The case will be heard by the judge in your absence if you do not come.

The Court Notice is attached to this email.

Jaime Bernard,
Court Secretary.

Eric Wong | 22 Aug 06:42 2015

[PATCH] gemspec: limit to 1.9.3 and 2.x

It does not look like we'll be compatible with Ruby 3.0 with
the plan for immutable string literals.

However, keep in mind 3.0 is still many years away and
decisions can change, so it would be premature to stop
assuming frozen string literals this year.

ref: https://bugs.ruby-lang.org/issues/11473
 unicorn.gemspec | 1 +
 1 file changed, 1 insertion(+)

diff --git a/unicorn.gemspec b/unicorn.gemspec
index 47d5670..23450f5 100644
--- a/unicorn.gemspec
+++ b/unicorn.gemspec
 <at>  <at>  -25,6 +25,7  <at>  <at>  Gem::Specification.new do |s|
   s.files = manifest
   s.homepage = Olddoc.config['rdoc_url']
   s.test_files = test_files
+  s.required_ruby_version = [ '>= 1.9.3', '< 3.0' ]

   # for people that are absolutely stuck on Rails 2.3.2 and can't
   # up/downgrade to any other version, the Rack dependency may be


Eric Wong | 22 Aug 06:42 2015

[PATCH] stream_input: favor String#clear over String#replace

We no longer need Ruby 1.8 compatibility, so use String#clear
to reduce argument passing and code size.
 lib/unicorn/stream_input.rb | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/unicorn/stream_input.rb b/lib/unicorn/stream_input.rb
index 9278f47..de5aeea 100644
--- a/lib/unicorn/stream_input.rb
+++ b/lib/unicorn/stream_input.rb
 <at>  <at>  -53,7 +53,7  <at>  <at>  class Unicorn::StreamInput
           rv <<  <at> rbuf
           to_read -=  <at> rbuf.size
-         <at> rbuf.replace('')
+         <at> rbuf.clear
       rv = nil if rv.empty? && length != 0
 <at>  <at>  -130,8 +130,8  <at>  <at>  private
       filter_body( <at> rbuf,  <at> buf)
       dst <<  <at> rbuf
-    ensure
-       <at> rbuf.replace('')
+  ensure
+     <at> rbuf.clear

   def eof!
(Continue reading)

Dowd, Stephen | 24 Jul 15:54 2015

Question: How to limit size of log & error files

I'd like to control the size and on disk layout of the unicorn error and output logs.   Basically I want ruby
Logger like functionality where I can specify a fixed # of rolling logs each of which is limited to # mb in
size.   Not sure how to do this in unicorn.rb.  

My unicorn.conf file has basically the defaults, with the exception of:

Stderr_path "/log/unicorn/stderr.log"
Stdout_path "/log/unicorn/stdout.log"

These files will grow to the point where the disk becomes full at which point we begin to see failures.   

Thanks in advance...


Eric Wong | 16 Jul 00:05 2015

[PATCH] doc: remove references to old servers

They'll continue to be maintained, but we're no longer advertising
them.  Also, favor lowercase "unicorn" while we're at it since that
matches the executable and gem name to avoid unnecessary escaping
for RDoc.
 Application_Timeouts             |  6 +++---
 KNOWN_ISSUES                     | 14 +++++++-------
 Links                            | 30 ++++++++++++++----------------
 PHILOSOPHY                       |  6 ------
 README                           | 32 ++++++++++++++++----------------
 Sandbox                          |  2 +-
 TUNING                           | 10 +++++-----
 examples/nginx.conf              | 21 ++++++++++-----------
 ext/unicorn_http/unicorn_http.rl |  2 +-
 lib/unicorn.rb                   |  6 +++---
 lib/unicorn/configurator.rb      | 24 ++++++++++--------------
 lib/unicorn/http_server.rb       |  4 ++--
 lib/unicorn/socket_helper.rb     |  8 +++-----
 lib/unicorn/util.rb              |  2 +-
 lib/unicorn/worker.rb            |  4 ++--
 15 files changed, 78 insertions(+), 93 deletions(-)

diff --git a/Application_Timeouts b/Application_Timeouts
index 5f0370d..561a1cc 100644
--- a/Application_Timeouts
+++ b/Application_Timeouts
 <at>  <at>  -4,10 +4,10  <at>  <at>  This article focuses on _application_ setup for Rack applications, but
 can be expanded to all applications that connect to external resources
 and expect short response times.

(Continue reading)

Eric Wong | 15 Jul 23:38 2015

[PATCH] configurator: document net.core.somaxconn sysctl dependency

Linux users are effectively capped to 128 on stock installations
and may wonder why connections get rejected with overloaded apps
sooner rather than later.
 lib/unicorn/configurator.rb | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/unicorn/configurator.rb b/lib/unicorn/configurator.rb
index 32e49c1..02f6b6b 100644
--- a/lib/unicorn/configurator.rb
+++ b/lib/unicorn/configurator.rb
 <at>  <at>  -254,6 +254,11  <at>  <at>  class Unicorn::Configurator
   #   Default: 1024
+  #   Note: with the Linux kernel, the net.core.somaxconn sysctl defaults
+  #   to 128, capping this value to 128.  Raising the sysctl allows a
+  #   larger backlog (which may not be desirable with multiple,
+  #   load-balanced machines).
+  #
   # [:rcvbuf => bytes, :sndbuf => bytes]
   #   Maximum receive and send buffer sizes (in bytes) of sockets.


Eric Wong | 8 Jul 05:03 2015

[PATCH] test_exec: disable systemd inheritance test

Turns out ruby does have trouble emulating systemd, for now:

[ruby-core:69895] https://bugs.ruby-lang.org/issues/11336

When we re-enable this test, we'll only enable it for fixed Rubies.
The actual socket inheritance functionality works in any version of
Ruby, of course, it's just that emulating systemd won't work until
ruby-core fixes mainline Ruby.
 test/exec/test_exec.rb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/test/exec/test_exec.rb b/test/exec/test_exec.rb
index af8de26..33d768a 100644
--- a/test/exec/test_exec.rb
+++ b/test/exec/test_exec.rb
 <at>  <at>  -96,7 +96,9  <at>  <at>  def teardown

-  def test_sd_listen_fds_emulation
+  # FIXME https://bugs.ruby-lang.org/issues/11336
+  # [ruby-core:69895] [Bug #11336]
+  def disabled_test_sd_listen_fds_emulation
     File.open("config.ru", "wb") { |fp| fp.write(HI) }
     sock = TCPServer.new( <at> addr,  <at> port)
     sock.setsockopt(:SOL_SOCKET, :SO_KEEPALIVE, 0)


(Continue reading)

Eric Wong | 5 Jul 02:31 2015

[PATCH] test/unit/test_response.rb: compatibility with older test-unit

assert_predicate really isn't that useful even if it seems
preferred in another project I work on.  Avoid having folks
download the latest test-unit if they're on an old version of
Ruby (e.g. 1.9.3) which bundled it.
 test/unit/test_response.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/unit/test_response.rb b/test/unit/test_response.rb
index 1e9d74a..0b14d59 100644
--- a/test/unit/test_response.rb
+++ b/test/unit/test_response.rb
 <at>  <at>  -94,7 +94,7  <at>  <at>  class ResponseTest < Test::Unit::TestCase
     assert_equal "HTTP/1.1 200 HI\r\n", r.gets
     r.read # just drain the pipe
     pid, status = Process.waitpid2(pid)
-    assert_predicate status, :success?
+    assert status.success?, status.inspect
     w.close unless w.closed?


Farjad Adamjee | 1 Jul 18:08 2015

Unicorn returns blank page after no use


I am not sure if this is the correct place for this, I have googled 
around to see if anyone else has encountered such an issue, but I did 
not find anything.

I am having this issue where after a period of time of no use (on beta 
[production] environment), maybe 12 hours or so, the unicorn process 
sleeps. When I go and re-request the page, it returns blank.

I am using Apache proxy to Unicorn.

My unicorn.stderr.log states:
I, [2015-07-01T03:07:05.168511 #13258]  INFO -- : master done reopening logs
I, [2015-07-01T03:07:05.232546 #16222]  INFO -- : worker=2 done 
reopening logs
I, [2015-07-01T03:07:05.239934 #13308]  INFO -- : worker=0 done 
reopening logs
I, [2015-07-01T03:07:05.307616 #13311]  INFO -- : worker=1 done 
reopening logs

When I request the page again, it loads fine. It is only during the 
process of "reopening logs" when it returns a blank page.

My unicorn.rb file:

worker_processes 3

# Load app into the master before forking workers
# for super-fast worker spawn times
(Continue reading)

Eric Wong | 1 Jul 00:51 2015

[PATCH 0/3] reflect changes to Rack::Utils::HTTP_STATUS_CODES

A user privately reported (to unicorn <at> bogomips.org) that they wanted
status text reflected in their responses for an HTTP status code not
included with Rack::Utils::HTTP_STATUS_CODES.

They tried to modify Rack::Utils::HTTP_STATUS_CODES hash directly in
their app, but unicorn loads before their app and already memoized the
status codes internally in the CODES hash to reduce GC pressure, thus
their change was never reflected.

With the first change, users can change Rack::Utils::HTTP_STATUS_CODES
as many times as they want (perhaps even based on time-of-day, weather,
server load, whatever) and the changes will be reflected
instantaneously in responses.

Of course, this slows unicorn down slightly due to increased GC
pressure, but I doubt anybody would notice in Real World usage.
In case they do, patch 2/3 will recover the lost performance
if they're using Ruby 2.2+

I figure anybody who cares about micro-benchmark performance with
unicorn would be using the latest Rubies anyways...

That user is Bcc:-ed for these patches, and can follow any public
discussion at: http://bogomips.org/unicorn-public/
(including the Atom feed at http://bogomips.org/unicorn-public/atom.xml )

* [PATCH 1/3] reflect changes in Rack::Utils::HTTP_STATUS_CODES
  introduces a performance regression

* [PATCH 2/3] reduce constants and optimize for Ruby 2.2
(Continue reading)

Eric Wong | 27 Jun 04:57 2015

[PATCH] apply TCP socket options on inherited sockets

TCP socket options are now set when inheriting existing sockets from
a parent process.  I'm fairly certain all the TCP setsockopt knobs
we use are idempotent and harmless to change.

If anything, the only directive I'd be uncomfortable changing is
shortening the listen(2) (aka :backlog) size, but we've always
changed that anyways since it also applies to UNIX sockets.

Note: removing a configuration knob in a unicorn config file can not
reset the value to the OS-provided default setting.  Inherited
sockets must use a new setting to override existing ones.
(or the socket needs to be closed and re-created in the process
 launcher before unicorn inherits it).

Noticed-by: Christos Trochalakis <yatiohi <at> ideopolis.gr>
  <20150626114129.GA25883 <at> luke.ws.skroutz.gr>
 lib/unicorn/http_server.rb | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index 3282ec7..297b9f9 100644
--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
 <at>  <at>  -768,10 +768,11  <at>  <at>  def inherit_listeners!
     # before they become Kgio::UNIXServer or Kgio::TCPServer
     inherited = ENV['UNICORN_FD'].to_s.split(',').map do |fd|
       io = Socket.for_fd(fd.to_i)
-      set_server_sockopt(io, listener_opts[sock_name(io)])
       io.autoclose = false
(Continue reading)