yahns Ruby server user/dev discussion
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [ANN] yahns 1.12.4 -_- sleepy app server for Ruby
  @ 2016-05-02 19:47  5% ` Eric Wong
  0 siblings, 0 replies; 3+ results
From: Eric Wong @ 2016-05-02 19:47 UTC (permalink / raw)
  To: ruby-talk, yahns-public

A Free Software, multi-threaded, non-blocking network
application server designed for low _idle_ power consumption.
It is primarily optimized for applications with occasional users
which see little or no traffic.  yahns currently hosts Rack/HTTP
applications, but may eventually support other application
types.  Unlike some existing servers, yahns is extremely
sensitive to fatal bugs in the applications it hosts.

* git clone git://yhbt.net/yahns
* https://yahns.yhbt.net/README
* https://yahns.yhbt.net/NEWS.atom.xml
* we only accept plain-text email yahns-public@yhbt.net
* and archive all the mail we receive: https://yhbt.net/yahns-public/
* nntp://news.public-inbox.org/inbox.comp.lang.ruby.yahns

Changes:

    yahns 1.12.4 - rack.hijack and proxy_pass bugfixes

    This release fixes some resource leaks in uncommonly used parts
    of yahns as well as including some documentation improvements.
    No need to upgrade unless you rely on rack.hijack for responses
    or use the (currently-undocumented) proxy_pass module(*).

    9 non-merge changes since 1.12.3:

          proxy_pass: honor wbuf_persist when ending response
          proxy_http_response: fix non-terminated fast responses, too
          test_proxy_pass: test for auto chunking on 1.0 backends
          wbuf: drop persistence if writing to client fails
          proxy_http_response: cleanup: avoid redundant setting of "alive"
          proxy_http_response: do not persist upstream on slow clients
          proxy_pass: drop resources immediately on errors
          document Rack::Chunked/ContentLength semi-requirements
          extras/exec_cgi: document cgit example

     Documentation/yahns-rackup.pod    | 10 ++++++++++
     GIT-VERSION-GEN                   |  2 +-
     examples/yahns_rack_basic.conf.rb |  6 ++++++
     extras/exec_cgi.rb                |  8 ++++++++
     lib/yahns/proxy_http_response.rb  | 40 ++++++++++++++++++++++-----------------
     lib/yahns/proxy_pass.rb           |  5 +++--
     lib/yahns/wbuf_common.rb          |  1 +
     test/test_proxy_pass.rb           | 15 +++++++++++++++
     8 files changed, 67 insertions(+), 20 deletions(-)

    (*) 1.13.0 will include refactoring in proxy_pass and possibly
        documenting it as stable-enough-for-public use:

        https://yhbt.net/yahns-public/20160220081619.GA10850@dcvr.yhbt.net/t/

Please note the disclaimer:

  yahns is extremely sensitive to fatal bugs in the apps it hosts.  There
  is no (and never will be) any built-in "watchdog"-type feature to kill
  stuck processes/threads.  Each yahns process may be handling thousands
  of clients; unexpectedly killing the process will abort _all_ of those
  connections.  Lives may be lost!

  yahns hackers are not responsible for your application/library bugs.
  Use an application server which is tolerant of buggy applications
  if you cannot be bothered to fix all your fatal bugs.

^ permalink raw reply	[relevance 5%]

* [PATCH 5/5] proxy_pass: drop resources immediately on errors
  2016-04-27  0:26  5% [PATCH 0/5] proxy_pass resource cleanup fixes Eric Wong
@ 2016-04-27  0:27  7% ` Eric Wong
  0 siblings, 0 replies; 3+ results
From: Eric Wong @ 2016-04-27  0:27 UTC (permalink / raw)
  To: yahns-public

We don't want to wait on GC to reap sockets on errors,
generational GC in Ruby is less aggressive about reaping
long-lived objects such as long-lived HTTP connections.
---
 lib/yahns/proxy_http_response.rb | 7 ++++++-
 lib/yahns/proxy_pass.rb          | 5 +++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib/yahns/proxy_http_response.rb b/lib/yahns/proxy_http_response.rb
index 3462e40..c5e7be5 100644
--- a/lib/yahns/proxy_http_response.rb
+++ b/lib/yahns/proxy_http_response.rb
@@ -43,7 +43,12 @@ def proxy_err_response(code, req_res, exc, wbuf)
                      Rack::Utils::HTTP_STATUS_CODES[code]}\r\n\r\n") rescue nil
 
     shutdown rescue nil
-    req_res.shutdown rescue nil
+    @input = @input.close if @input
+
+    # this is safe ONLY because we are in an :ignore state after
+    # Fdmap#forget when we got hijacked:
+    close
+
     nil # signal close of req_res from yahns_step in yahns/proxy_pass.rb
   ensure
     wbuf.wbuf_abort if wbuf
diff --git a/lib/yahns/proxy_pass.rb b/lib/yahns/proxy_pass.rb
index 511db02..148957b 100644
--- a/lib/yahns/proxy_pass.rb
+++ b/lib/yahns/proxy_pass.rb
@@ -63,7 +63,8 @@ def yahns_step # yahns event loop entry point
 
         when Yahns::WbufCommon # streaming/buffering the response body
 
-          return c.proxy_response_finish(req, resbuf, self)
+          # we assign wbuf for rescue below:
+          return c.proxy_response_finish(req, wbuf = resbuf, self)
 
         end while true # case @resbuf
 
@@ -79,7 +80,7 @@ def yahns_step # yahns event loop entry point
       when Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EPIPE
         e.set_backtrace([])
       end
-      c.proxy_err_response(502, self, e, nil)
+      c.proxy_err_response(502, self, e, wbuf)
     end
 
     # returns :wait_readable if complete, :wait_writable if not
-- 
EW


^ permalink raw reply related	[relevance 7%]

* [PATCH 0/5] proxy_pass resource cleanup fixes
@ 2016-04-27  0:26  5% Eric Wong
  2016-04-27  0:27  7% ` [PATCH 5/5] proxy_pass: drop resources immediately on errors Eric Wong
  0 siblings, 1 reply; 3+ results
From: Eric Wong @ 2016-04-27  0:26 UTC (permalink / raw)
  To: yahns-public

Lightly-tested, I'm going to let these run on YHBT.net for
a bit before cutting a new release.

And all this proxy_pass stuff could still use some cleanup and
refactoring, it's hairy!

Eric Wong (5):
      test_proxy_pass: test for auto chunking on 1.0 backends
      wbuf: drop persistence if writing to client fails
      proxy_http_response: cleanup: avoid redundant setting of "alive"
      proxy_http_response: do not persist upstream on slow clients
      proxy_pass: drop resources immediately on errors

 lib/yahns/proxy_http_response.rb | 37 +++++++++++++++++++++----------------
 lib/yahns/proxy_pass.rb          |  5 +++--
 lib/yahns/wbuf_common.rb         |  1 +
 test/test_proxy_pass.rb          | 15 +++++++++++++++
 4 files changed, 40 insertions(+), 18 deletions(-)


^ permalink raw reply	[relevance 5%]

Results 1-3 of 3 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2016-04-08 20:01     [ANN] yahns 1.12.3 -_- sleepy app server for Ruby Eric Wong
2016-05-02 19:47  5% ` [ANN] yahns 1.12.4 " Eric Wong
2016-04-27  0:26  5% [PATCH 0/5] proxy_pass resource cleanup fixes Eric Wong
2016-04-27  0:27  7% ` [PATCH 5/5] proxy_pass: drop resources immediately on errors Eric Wong

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

	https://yhbt.net/yahns.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).