Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Jan 1, 2014
  1. httpdate: support running multi-threaded code without a GVL (Rubinius)

    Eric Wong authored
    Using thread-local storage via the Ruby API allows us to not worry
    about memory management.
Commits on Dec 9, 2013
  1. unicorn 4.8.0pre1

    Eric Wong authored
    Eric Wong (6):
          tests: fix SO_REUSEPORT tests for old Linux and non-Linux
          stream_input: avoid IO#close on client disconnect
          t0300: kill off stray processes in test
          always write PID file early for compatibility
          doc: clarify SIGNALS and reference init example
          rework master-to-worker signaling to use a pipe
  2. rework master-to-worker signaling to use a pipe

    Eric Wong authored Eric Wong committed
    Signaling using normal kill(2) is preserved, but the master now
    prefers to signal workers using a pipe rather than kill(2).
    Non-graceful signals (:TERM/:KILL) are still sent using kill(2),
    as they ask for immediate shutdown.
    
    This change is necessary to avoid triggering the ubf (unblocking
    function) for rb_thread_call_without_gvl (and similar) functions
    extensions.  Most notably, this fixes compatibility with newer
    versions of the 'pg' gem which will cancel a running DB query if
    signaled[1].
    
    This also has the nice side-effect of allowing a premature
    master death (assuming preload_app didn't cause the master to
    spawn off rogue child daemons).
    
    Note: users should also refrain from using "killall" if using the
    'pg' gem or something like it.
    
    Unfortunately, this increases FD usage in the master as the writable
    end of the pipe is preserved in the master.  This limit the number
    of worker processes the master may run to the open file limit of the
    master process.  Increasing the open file limit of the master
    process may be needed.  However, the FD use on the workers is
    reduced by one as the internal self-pipe is no longer used.  Thus,
    overall pipe allocation for the kernel remains unchanged.
    
    [1] - pg is correct to cancel a query, as it cannot know if
          the signal was for a) graceful unicorn shutdown or
          b) oh-noes-I-started-a-bad-query-ABORT-ABORT-ABORT!!
Commits on Nov 26, 2013
  1. doc: clarify SIGNALS and reference init example

    Eric Wong authored
    "interactive terminal" needed clarification.
    
    While we're at it, link to the init.sh example since it may
    be shared with nginx.
    
    Reported-by: Rodrigo Rosenfeld Rosas
    ref: <5294E9D4.5030608@gmail.com>
  2. always write PID file early for compatibility

    Eric Wong authored
    This reduces the window for a non-existent PID for folks who monitor
    PIDs (not a great idea anyways).  Unfortunately, this change also brings
    us back to the case where having a PID later (for other process monitors)
    is beneficial but more unicorn releases exist where we write the PID
    early.
    
    Thanks to Jimmy Soho for reporting this issue.
    ref: <CAHStS5gFYcPBDxkVizAHrOeDKAkjT69kruFdgaY0CbB+vLbK8Q@mail.gmail.com>
    
    This partially reverts 7d6ac0c
    
    Folks: please monitor your app with HTTP requests rather than checking
    processes, a stuck/wedged Ruby VM is still a running one.
Commits on Nov 8, 2013
  1. t0300: kill off stray processes in test

    Eric Wong authored
    We shouldn't leave processes running after the test.
Commits on Nov 7, 2013
  1. stream_input: avoid IO#close on client disconnect

    Eric Wong authored
    This can avoid IOError from being seen by the application, and also
    reduces points where IO#close may be called.  This is a good thing
    if we eventually port this code into a low-level server like
    cmogstored where per-client memory space is defined by FD number of
    a client.
    
    Reported-by: Andrew Hobson <ahobson@gmail.com>
Commits on Nov 4, 2013
  1. tests: fix SO_REUSEPORT tests for old Linux and non-Linux

    Eric Wong authored
    On BSD-derived platforms the getsockopt true value may be any
    (>= 0) value, not just one as it is on Linux.
    
    Additionally, SO_REUSEPORT is only supported since Linux 3.9, so
    folks on older kernels may not have it available.  We still define it
    for Linux since kernel upgrades are usually more common than glibc
    upgrades.
    
    Note: we will still raise an exception at runtime if a user
    explicitly requests :reuseport in their config and runs an
    older Linux kernel.
    
    Reported-by: Andrew Hobson <ahobson@gmail.com>
  2. unicorn 4.7.0 - minor updates, license tweak

    Eric Wong authored
    * support SO_REUSEPORT on new listeners (:reuseport)
    
      This allows users to start an independent instance of unicorn on
      a the same port as a running unicorn (as long as both instances
      use :reuseport).
    
      ref: https://lwn.net/Articles/542629/
    
    * unicorn is now GPLv2-or-later and Ruby 1.8-licensed
      (instead of GPLv2-only, GPLv3-only, and Ruby 1.8-licensed)
    
      This changes nothing at the moment.  Once the FSF publishes the next
      version of the GPL, users may choose the newer GPL version without the
      unicorn BDFL approving it.  Two years ago when I got permission to add
      GPLv3 to the license options, I also got permission from all past
      contributors to approve future versions of the GPL.  So now I'm
      approving all future versions of the GPL for use with unicorn.
    
      Reasoning below:
    
      In case the GPLv4 arrives and I am not alive to approve/review it,
      the lesser of evils is have give blanket approval of all future GPL
      versions (as published by the FSF).  The worse evil is to be stuck
      with a license which cannot guarantee the Free-ness of this project
      in the future.
    
      This unfortunately means the FSF can theoretically come out with
      license terms I do not agree with, but the GPLv2 and GPLv3 will
      always be an option to all users.
    
      Note: we currently prefer GPLv3
    
    Two improvements thanks to Ernest W. Durbin III:
    
    * USR2 redirects fixed for Ruby 1.8.6 (broken since 4.1.0)
    * unicorn(1) and unicorn_rails(1) enforces valid integer for -p/--port
    
    A few more odd, minor tweaks and fixes:
    
    * attempt to rename PID file when possible (on USR2)
    * workaround reopen atomicity issues for stdio vs non-stdio
    * improve handling of client-triggerable socket errors
Commits on Nov 1, 2013
  1. bin/*: enforce -p/--port argument to be a valid integer

    Eric Wong authored Eric Wong committed
    Users may confuse '-p' with the (to-be-deprecated) '-P/--pid'
    option, leading to surprising behavior if a pathname is passed as a
    port, because String#to_i would convert it to zero, causing:
    
        TCPServer.new(host, port = 0)
    
    to bind to a random, unused port.
  2. Ernest W. Durbin III

    construct listener_fds Hash in 1.8.6 compatible way

    ewdurbin authored Eric Wong committed
    This renables the ability for Ruby 1.8.6 environments to perform reexecs
    
    [ew: clarified this is for 1.8.6,
     favor literal {} over Hash.new,
     tweaked LISTENERS.map => LISTENERS.each, thanks to Hleb Valoshka
    ]
    
    Signed-off-by: Eric Wong <normalperson@yhbt.net>
Commits on Oct 29, 2013
  1. configurator: validate :reuseport for boolean-ess

    Eric Wong authored
    In case we (and Linux) supports other values in the future,
    we can update it then.  Until now, ensure users only set
    true or false for this option.
Commits on Oct 26, 2013
  1. license: allow all future versions of the GNU GPL

    Eric Wong authored
    There is currently no GPLv4, so this change has no effect at the
    moment.
    
    In case the GPLv4 arrives and I am not alive to approve/review it,
    the lesser of evils is have give blanket approval of all future GPL
    versions (as published by the FSF).  The worse evil is to be stuck
    with a license which cannot guarantee the Free-ness of this project
    in the future.
    
    This unfortunately means the FSF can theoretically come out with
    license terms I do not agree with, but the GPLv2 and GPLv3 will
    always be an option to all users.
Commits on Oct 25, 2013
  1. http_server: fixup comments for PID file renaming

    Eric Wong authored Eric Wong committed
    Thanks to Hongli Lai for noticing my typo.  While we're at it, finish up
    a halfway-written comment for the EXDEV case
  2. avoid IO_PURGATORY on Ruby 1.9+

    Eric Wong authored Eric Wong committed
    Ruby 1.9 and later includes IO#autoclose=, so we can use it
    and prevent some dead IO objects from hanging around.
  3. support SO_REUSEPORT on new listeners (:reuseport)

    Eric Wong authored Eric Wong committed
    This allows users to start an independent instance of unicorn on
    a the same port as a running unicorn (as long as both instances
    use :reuseport).
    
    ref: https://lwn.net/Articles/542629/
  4. tests: limit oobgc check to accepted sockets

    Eric Wong authored Eric Wong committed
    Otherwise these tests fail if we start using IO#autoclose=true
    on Ruby 1.9 (and also if we use IPv6 sockets for tests).
Commits on Oct 24, 2013
  1. attempt to rename PID file when possible

    Eric Wong authored Eric Wong committed
    This will preserve mtime on successful renames for comparisions.
    While we're at it, avoid writing the new PID until the listeners are
    inherited successfully.  This can be useful to avoid accidentally
    clobbering a good PID if binding the listener or building the app
    (preload_app==true) fails
Commits on Oct 20, 2013
  1. workaround reopen atomicity issues for stdio vs non-stdio

    Eric Wong authored Eric Wong committed
    In multithreaded apps, we must use dup2/dup3 with a temporary
    descriptor to reopen log files atomically.  This is the only way
    to protect all concurrent userspace access to a file when reopening.
    
    ref: http://bugs.ruby-lang.org/issues/9036
    ref: yahns commit bcb10abe53cfb1d6a8ef7daef59eb10ced397c8a
Commits on Sep 30, 2013
  1. Rakefile: kill raa_update task

    Eric Wong authored
    RAA is dead.
Commits on Sep 11, 2013
  1. tests: upgrade several gems (rack, kgio, raindrops)

    Eric Wong authored
    All tests seem to pass.
Commits on Sep 4, 2013
  1. Sandbox: document SIGUSR2 + bundler issue with 2.0.0

    Eric Wong authored
    Thanks to Eric Chapweske for the heads up.
    
    ref: http://mid.gmane.org/loom.20130904T205308-432@post.gmane.org
Commits on Aug 17, 2013
  1. test_util: fix encoding test for Ruby trunk (2.1.0dev)

    Eric Wong authored
    As of r40610 in ruby trunk, internal encoding is ignored if
    external coding is ASCII-8BIT (binary)
    
    ref: r40610 http://svn.ruby-lang.org/repos/ruby/trunk
  2. http_server: improve handling of client-triggerable socket errors

    Eric Wong authored
    We do not attempt to write HTTP responses for socket errors if
    clients disconnect from us unexpectedly.
    
    Additionally, we do not hide backtraces EINVAL/EBADF errors, since
    they are indicative of real bugs which must be fixed.
    
    We do continue to hide hide EOF, ECONNRESET, ENOTCONN, and EPIPE
    because clients (even "friendly") ones will break connections due to
    client crashes or network failure (which is common for me :P), and
    the backtraces from those will cause excessive logging and even
    become a DoS vector.
Commits on Jun 21, 2013
  1. unicorn 4.6.3 - fix --no-default-middleware option

    Eric Wong authored
    Thanks to Micah Chalmer for this fix.  There are also minor
    documentation updates and internal cleanups.
Commits on Jun 7, 2013
  1. Micah Chalmer

    Make -N/--no-default-middleware option work

    MicahChalmer authored Eric Wong committed
    This fixes the -N (a.k.a. --no-defaut-middleware) option, which
    was not working.  The problem was that Unicorn::Configurator::RACKUP
    is cleared before the lambda returned by Unicorn.builder is run,
    which means that checking whether the :no_default_middleware option
    was set from the lambda could not detect anything.  This patch copies
    it to a local variable that won't get clobbered, restoring the feature.
    
    [ew: squashed test commit into the fix, whitespace fixes]
    
    Signed-off-by: Eric Wong <normalperson@yhbt.net>
Commits on May 8, 2013
  1. HttpParser#next? becomes response_start_sent-aware

    Eric Wong authored
    This could allow servers with persistent connection support[1]
    to support our check_client_connection in the future.
    
    [1] - Rainbows!/zbatery, possibly others
Commits on May 4, 2013
  1. test_signals: increase delay between Process.kill

    Eric Wong authored
    Otherwise, the signalled process may take too long to react to
    and process all the signals on machines with few CPUs.
Commits on Apr 5, 2013
  1. doc: update documentation for systemd + PrivateTmp users

    Eric Wong authored
    The PrivateTmp feature of systemd breaks the usage of /tmp for the
    shared Unix domain socket between nginx and unicorn, so discourage the
    use of /tmp in that case.
    
    While we're at it, use consistent paths for everything and use an
    obviously intended-for-user-customization "/path/to" prefix instead
    of "/tmp"
    
    ML-Ref: CAKLVLx_t+9zWMhquMWDfStrxS7xrNoGmN0ZDsjSCUE=VxU+oyQ@mail.gmail.com
    Reported-by: David Wilkins <dwilkins@conecuh.com>
Commits on Feb 26, 2013
  1. unicorn 4.6.2 - HTTP parser fix for Rainbows!

    Eric Wong authored
    This release fixes a bug in Unicorn::HttpParser#filter_body
    which affected some configurations of Rainbows!  There is
    also a minor size reduction in the DSO.
  2. http: avoid frozen string bug in filter_body

    Eric Wong authored
    Our rb_str_modify() became no-ops due to incomplete reverts
    of workarounds for old Rubinius, causing rb_str_set_len to
    fail with: can't set length of shared string (RuntimeError)
    
    This bug was introduced due to improper workarounds for old
    versions of Rubinius in 2009 and 2010:
    
    commit 5e8979a
    ("http: cleanups for latest Rubinius")
    commit f37c237
    ("http: no-op rb_str_modify() for Rubies without it")
Commits on Feb 24, 2013
  1. httpdate: minor size reduction in DSO

    Eric Wong authored
    Extra pointers waste space in the DSO.  Normally I wouldn't
    care, but the string lengths are identical and this code
    already made it into another project in this form.
    
    size(1) output:
    
             text      data     bss     dec     hex  filename
    before: 42881      2040     336   45257    b0c9  unicorn_http.so
     after: 42499      1888     336   44723    aeb3  unicorn_http.so
    
    ref: http://www.akkadia.org/drepper/dsohowto.pdf
Commits on Feb 21, 2013
  1. unicorn 4.6.1 - minor cleanups

    Eric Wong authored
    Unicorn::Const::UNICORN_VERSION is now auto-generated from
    GIT-VERSION-GEN and always correct.  Minor cleanups for
    hijacking.
Commits on Feb 9, 2013
  1. http_request: drop conditional assignment for hijack

    Eric Wong authored
    As far as I can tell, this was never necessary.
Commits on Feb 8, 2013
  1. http_request: remove FIXME for rack.version clarification

    Eric Wong authored
    commit a9474624a148fe58e0944664190b259787dcf51e in rack.git
Something went wrong with that request. Please try again.