Eric Wong | 21 May 01:21 2015

[PATCH] ISSUES: discourage HTML mail strongly, welcome nyms

HTML email is too likely to be lost, so more strongly discourage it.
While we're at it, make it clear we allow anonymous and pseudonymous
contributions, unlike many projects nowadays.
 ISSUES | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ISSUES b/ISSUES
index 8910180..b172f8a 100644
--- a/ISSUES
+++ b/ISSUES
 <at>  <at>  -9,7 +9,8  <at>  <at>  submit patches and/or obtain support after you have searched the
 * Cc: all participants in a thread or commit, as subscription is optional
 * Do not {top post}[] in replies
 * Quote as little as possible of the message you're replying to
-* Do not send HTML mail, it will likely be flagged as spam
+* Do not send HTML mail, it will be flagged as spam
+* Anonymous and pseudonymous messages will always be welcome.

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

John Smith :>

Dan Moore | 20 May 03:02 2015

Re: SIGWINCH ignored...

Thank you, that's perfect. +1 for unicorn 5 patch.

Eric Wong | 20 May 01:28 2015

Re: SIGWINCH ignored...

Don't send HTML parts, it is flagged as spam and nearly lost.

Onto your question...

Dan Moore <dan <at>> wrote:
> I’m interested in the SIGWINCH signal and specifically the message
> that is posted to the console at an INFO level instead of DEBUG level:
> “INFO – : SIGWINCH ignored because we’re not daemonized”

I wrote this patch a while ago to a private bug reporter (via
unicorn <at> back in July 2013, but apparently it
was forgotten:

--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
 <at>  <at>  -294,13 +294,13  <at>  <at>  class Unicorn::HttpServer
       when :USR2 # exec binary, stay alive in case something went wrong
       when :WINCH
-        if Unicorn::Configurator::RACKUP[:daemonized]
+        if $stdin.tty?
+ "SIGWINCH ignored because we're not daemonized"
+        else
           respawn = false
  "gracefully stopping all workers"
           self.worker_processes = 0
-        else
- "SIGWINCH ignored because we're not daemonized"
(Continue reading)

Eric Wong | 18 May 23:34 2015

[PATCH] FAQ: add note about ECONNRESET errors from bodies

Thanks to Michael Fischer and Gabe Martin-Dempesy for bringing this
to light on the mailing list.

Ref: <CABHxtY7Sn5yaiR5a3gDk1G4XySE+UtfuqUTcOSdmwneXLD5rcg <at>>
Ref: <FC91211E-FD32-432C-92FC-0318714C2170 <at>>

Cc: Michael Fischer <mfischer <at>>
Cc: Gabe Martin-Dempesy <gabe <at>>
 FAQ | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/FAQ b/FAQ
index 66f1a09..fdf1400 100644
--- a/FAQ
+++ b/FAQ
 <at>  <at>  -1,5 +1,14  <at>  <at> 
 = Frequently Asked Questions about Unicorn

+=== Why is nginx getting ECONNRESET as a reverse proxy?
+Request body data (commonly from POST and PUT requests) may not be
+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: <at>
 === Why aren't my Rails log files rotated when I use SIGUSR1?

(Continue reading)

Eric Wong | 16 May 23:30 2015

[PATCH 0/2] no avoiding rack.hijack anymore

I'm not sure if it makes sense to use rack.hijack with a prefork server
like unicorn which only works behind nginx, but maybe somebody does...

Eric Wong (2):
      http_request: support rack.hijack by default
      avoid extra allocation for hijack proc creation

 lib/unicorn/http_request.rb | 40 ++++++++++++++++------------------------
 1 file changed, 16 insertions(+), 24 deletions(-)

Eric Wong | 8 May 00:16 2015

[PATCH] favor kgio_wait_readable for single FD over select

kgio_wait_readable is superior for single FDs in that it may use the
ppoll syscall on Linux via Ruby, making it immune to the slowdown
high FDs with select() and the array allocations enforced by the
Ruby wrapper interface.

Note: IO#wait in the io/wait stdlib has the same effect, but as of
2.2 still needlessly checks the FIONREAD ioctl.  So avoid needing to
force a new require on users which also incur shared object loading
costs.  The longer term plan is to rely entirely on Ruby IO
primitives entirely and drop kgio, but that won't happen until we
can depend on Ruby 2.3 for exception-free accept_nonblock
(which will be released December 2015).
 lib/unicorn/http_server.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index a726c91..82747b8 100644
--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
 <at>  <at>  -369,7 +369,7  <at>  <at>  class Unicorn::HttpServer

   # wait for a signal hander to wake us up and then consume the pipe
   def master_sleep(sec)
-[  <at> self_pipe[0] ], nil, nil, sec) or return
+     <at> self_pipe[0].kgio_wait_readable(sec) or return
     # 11 bytes is the maximum string length which can be embedded within
     # the Ruby itself and not require a separate malloc (on 32-bit MRI 1.9+).
     # Most reads are only one byte here and uncommon, so it's not worth a

(Continue reading)

Tommaso Pavese | 3 May 11:19 2015

Unicorn homepage design


Unicorn’s homepage ( seems to have lost CSS and JS.

Is it because of the shutdown of Rubyforge?
E.g. the content was moved elsewhere, but the darkfish rdoc template was provided by Rubyforge?
I can’t remember if it was hosted there or not.

Is anyone already working on the issue?
If not, do you need any help?


Eric Wong | 24 Apr 05:02 2015

[PATCH 0/2] Rack::TempfileReaper support

These will be in the upcoming 4.9 release, as well as the 5.x
release which drops old cruft and 1.8 support.  I've decided
to use 4.9 instead of 4.8.4 since this does change the feature
set slightly.

Eric Wong (2):
      tee_input: support for Rack::TempfileReaper middleware
      support TempfileReaper in deployment and development envs

 lib/unicorn.rb              |  2 ++
 lib/unicorn/tee_input.rb    |  9 ++++++++-
 lib/unicorn/tmpio.rb        |  3 +++
 test/unit/test_tee_input.rb | 10 ++++++++++
 4 files changed, 23 insertions(+), 1 deletion(-)

Jason Hines | 24 Apr 02:04 2015

Will restarting a Unicorn process (via HUP signal) wait for worker threads?

In my application, I have some background jobs which are executed in
separate threads.  (using SuckerPunch/Celluloid framework)

If I send a HUP signal to the Unicorn master, the application is reloaded
and gracefully restarts the workers.    But, if those workers have child
threads, does Unicorn wait for those threads to finish before the restart
or are they terminated immediately?

Thanks in advance for any light shed here.

Jérémy Lecour | 23 Apr 11:05 2015

Unicorn, environment variables, start and reload


For some time I've been using Unicorn to serve Rails applications.

I've been increasingly relying on environment variables to set various
password and configuration bits outside of the application's code.

For that I've been using the "dotenv" gem that load a `.env` file into
the ENV hash. It's great and really useful in development mode, but
it's not a best practice to use it in production. Here is what Brandon
Keepers (maintainer of Dotenv) says about this :

> One of the reasons I don't advocate for using dotenv in production is because it loads the environment
variables within the ruby process, which makes it very difficult to track which variables were
previously set and which were loaded by dotenv. If you set these variables in the environment of your
server (/etc/environment, /etc/profile, etc) then unicorn reloading will just work.

So I was wondering what would be the correct way to have environment
variables available in the Ruby process, up-to-date when the Unicorn
process is started and reloaded too (with USR2).

And there is also the case of various shell initializations
(login/non-login, interactive/non-interactive) and supervisors like
Monit that strip the environment to a minumum before executing the
start/stop commands.

I understand that I can do something like this on start :

    $ source ~/my/app/.env && unicorn [...]

(Continue reading)

Eric Wong | 22 Apr 21:02 2015

unicorn 4.8.x-stable branch pushed to git

Only backporting documentation + build/test system fixes, but I'll
probably apply and push the TeeInput patch in: <at>

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:// 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 references
      examples: add run_once to before_fork hook example
      t/ 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
(Continue reading)