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.17.0 -_- sleepy app server for Ruby
@ 2019-04-22  7:37  6% Eric Wong
  0 siblings, 0 replies; 4+ results
From: Eric Wong @ 2019-04-22  7:37 UTC (permalink / raw)
  To: ruby-talk, yahns-public

Earth day release of a server designed for low energy use!

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 https://yhbt.net/yahns.git
* https://yhbt.net/yahns.git/about/
* https://yhbt.net/yahns/NEWS.atom.xml (supported by most "RSS" readers)
* 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

lrg nabgure ubeevoyl-anzrq freire :>

Changes:

    This releases includes a few kqueue-related bugfixes from
    Lin Jen-Shin <godfat@godfat.org>.  There's also some
    shutdown_timeout-related bugfixes and some cleanups to
    reduce dependencies on kgio.

    extras/exec_cgi and extras/autoindex both got some minor
    updates; the latter of which defaults to a dark scheme to save
    power on OLED and CRT displays (it is Earth Day, after all :>)

    Eric Wong (25):
          doc: fix git URLs in README and HACKING
          http_client: do not warn on do_pread overreach
          remove IO#close_on_exec= calls
          yahns/worker: shrink pipe under Linux
          test/test_extras_exec_cgi.rb: improve test reliability
          extras/exec_cgi: remove kgio dependency
          extras/exec_cgi: update copyright year and use SPDX
          extras/exec_cgi: @body_tip is always set
          extras/exec_cgi: support Process.spawn options (e.g. RLIMIT_*)
          server_mp: favor "Kernel#select" instead of "IO.select"
          server_mp: remove redundant srand call
          extras/exec_cgi: remove unecessary .freeze calls
          server: respect shutdown_timeout
          server: extra shutdown timeout debugging
          wbuf: use IO#write directly in Ruby 2.5+ for writev
          worker: rely on F_SETPIPE_SZ to set mininum value
          remove calls to kgio_wait_* able
          do not shutdown until listeners are all stopped
          README: remove SMTP-based subscription info
          sigevent_*: fixup non-eventfd path
          README: note HTTPS support for HTTP/1.1
          extras/autoindex: use dark colors by default
          doc: update homepage to point to cgit install
          doc: update wording to avoid "mailing list"
          doc: remove inaccurate comment about "GNU-ism"

    Lin Jen-Shin (2):
          Add QueueQuitter#closed? to queue_quitter_pipe.rb
          @srv.shutdown could raise Errno::ENOTCONN

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.

*zzzzzzz*

^ permalink raw reply	[relevance 6%]

* [PATCH] sigevent_*: fixup non-eventfd path
@ 2019-04-02  3:13  6% Eric Wong
  0 siblings, 0 replies; 4+ results
From: Eric Wong @ 2019-04-02  3:13 UTC (permalink / raw)
  To: yahns-public

And slightly cleanup the Kgio::DefaultWaiters include for
the eventfd path, too.

Fixes: 96825e8ca734cfbb ("remove calls to kgio_wait_* able")
---
 lib/yahns/sigevent_efd.rb  |  1 -
 lib/yahns/sigevent_pipe.rb | 18 +++++++++++++++---
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/lib/yahns/sigevent_efd.rb b/lib/yahns/sigevent_efd.rb
index 1250cf4..264097d 100644
--- a/lib/yahns/sigevent_efd.rb
+++ b/lib/yahns/sigevent_efd.rb
@@ -3,7 +3,6 @@
 # License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
 # frozen_string_literal: true
 class Yahns::Sigevent < SleepyPenguin::EventFD # :nodoc:
-  include Kgio::DefaultWaiters
   def self.new
     super(0, :CLOEXEC)
   end
diff --git a/lib/yahns/sigevent_pipe.rb b/lib/yahns/sigevent_pipe.rb
index df4c31a..5d9b441 100644
--- a/lib/yahns/sigevent_pipe.rb
+++ b/lib/yahns/sigevent_pipe.rb
@@ -5,16 +5,24 @@
 class Yahns::Sigevent # :nodoc:
   attr_reader :to_io
   def initialize
-    @to_io, @wr = Kgio::Pipe.new
+    @to_io, @wr = IO.pipe
+  end
+
+  def wait_readable(*args)
+    @to_io.wait_readable(*args)
+  end
+
+  def fileno
+    @to_io.fileno
   end
 
   def sev_signal
-    @wr.kgio_trywrite(".")
+    @wr.write_nonblock(".", exception: false)
   end
 
   def yahns_step
     # 11 byte strings -> no malloc on YARV
-    while String === @to_io.kgio_tryread(11)
+    while String === @to_io.read_nonblock(11, exception: false)
     end
     :wait_readable
   end
@@ -23,4 +31,8 @@ def close
     @to_io.close
     @wr.close
   end
+
+  def closed?
+    @to_io.closed?
+  end
 end
-- 
EW


^ permalink raw reply related	[relevance 6%]

* [PATCH] sigevent_*: fixup non-eventfd path
@ 2019-04-02  3:10  6% Eric Wong
  0 siblings, 0 replies; 4+ results
From: Eric Wong @ 2019-04-02  3:10 UTC (permalink / raw)
  To: yahns-public

And slightly cleanup the Kgio::DefaultWaiters include for
the eventfd path, too.

Fixes: 96825e8ca734cfbb ("remove calls to kgio_wait_* able")
---
 lib/yahns/sigevent_efd.rb  |  1 -
 lib/yahns/sigevent_pipe.rb | 18 +++++++++++++++---
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/lib/yahns/sigevent_efd.rb b/lib/yahns/sigevent_efd.rb
index 1250cf4..264097d 100644
--- a/lib/yahns/sigevent_efd.rb
+++ b/lib/yahns/sigevent_efd.rb
@@ -3,7 +3,6 @@
 # License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
 # frozen_string_literal: true
 class Yahns::Sigevent < SleepyPenguin::EventFD # :nodoc:
-  include Kgio::DefaultWaiters
   def self.new
     super(0, :CLOEXEC)
   end
diff --git a/lib/yahns/sigevent_pipe.rb b/lib/yahns/sigevent_pipe.rb
index df4c31a..5d9b441 100644
--- a/lib/yahns/sigevent_pipe.rb
+++ b/lib/yahns/sigevent_pipe.rb
@@ -5,16 +5,24 @@
 class Yahns::Sigevent # :nodoc:
   attr_reader :to_io
   def initialize
-    @to_io, @wr = Kgio::Pipe.new
+    @to_io, @wr = IO.pipe
+  end
+
+  def wait_readable(*args)
+    @to_io.wait_readable(*args)
+  end
+
+  def fileno
+    @to_io.fileno
   end
 
   def sev_signal
-    @wr.kgio_trywrite(".")
+    @wr.write_nonblock(".", exception: false)
   end
 
   def yahns_step
     # 11 byte strings -> no malloc on YARV
-    while String === @to_io.kgio_tryread(11)
+    while String === @to_io.read_nonblock(11, exception: false)
     end
     :wait_readable
   end
@@ -23,4 +31,8 @@ def close
     @to_io.close
     @wr.close
   end
+
+  def closed?
+    @to_io.closed?
+  end
 end
-- 
EW


^ permalink raw reply related	[relevance 6%]

* [PATCH] remove calls to kgio_wait_* able
@ 2019-01-07 10:43  7% Eric Wong
  0 siblings, 0 replies; 4+ results
From: Eric Wong @ 2019-01-07 10:43 UTC (permalink / raw)
  To: yahns-public

IO#wait_readable existed since Ruby 2.0, so we don't need
to use the "kgio_"-prefixed version.
---
 extras/proxy_pass.rb       |  4 ++--
 lib/yahns.rb               |  1 +
 lib/yahns/http_client.rb   | 16 ++++------------
 lib/yahns/http_response.rb |  5 ++---
 lib/yahns/server.rb        |  2 +-
 lib/yahns/server_mp.rb     |  2 +-
 lib/yahns/sigevent_pipe.rb |  4 ----
 7 files changed, 11 insertions(+), 23 deletions(-)

diff --git a/extras/proxy_pass.rb b/extras/proxy_pass.rb
index 310da9e..af6fe01 100644
--- a/extras/proxy_pass.rb
+++ b/extras/proxy_pass.rb
@@ -36,7 +36,7 @@ class UpstreamSocket < Kgio::Socket # :nodoc:
     attr_writer :expiry
 
     # called automatically by kgio_read!
-    def kgio_wait_readable(timeout = nil)
+    def wait_readable(timeout = nil)
       super(timeout || wait_time)
     end
 
@@ -59,7 +59,7 @@ def req_write(buf, timeout)
       @expiry = Time.now + timeout
       case rv = kgio_trywrite(buf)
       when :wait_writable
-        kgio_wait_writable(wait_time)
+        wait_writable(wait_time)
       when nil
         return
       when String
diff --git a/lib/yahns.rb b/lib/yahns.rb
index a0abe49..21464ca 100644
--- a/lib/yahns.rb
+++ b/lib/yahns.rb
@@ -5,6 +5,7 @@
 
 require 'unicorn' # pulls in raindrops, kgio, fcntl, etc, stringio, and logger
 require 'sleepy_penguin'
+require 'io/wait'
 
 # kill off some unicorn internals we don't need
 # we'll probably just make kcar into a server parser so we don't depend
diff --git a/lib/yahns/http_client.rb b/lib/yahns/http_client.rb
index 8744053..b6b6035 100644
--- a/lib/yahns/http_client.rb
+++ b/lib/yahns/http_client.rb
@@ -235,25 +235,17 @@ def app_call(input)
     http_response_write(res, opt)
   end
 
-  # called automatically by kgio_write
-  def kgio_wait_writable(timeout = self.class.client_timeout)
-    super timeout
-  end
-
-  # called automatically by kgio_read
-  def kgio_wait_readable(timeout = self.class.client_timeout)
-    super timeout
-  end
-
   # used by StreamInput (and thus TeeInput) for input_buffering {false|:lazy}
   def yahns_read(bytes, buf)
     case rv = kgio_tryread(bytes, buf)
     when String, nil
       return rv
     when :wait_readable
-      kgio_wait_readable or raise Yahns::ClientTimeout, "waiting for read", []
+      wait_readable(self.class.client_timeout) or
+        raise Yahns::ClientTimeout, "waiting for read", []
     when :wait_writable
-      kgio_wait_writable or raise Yahns::ClientTimeout, "waiting for write", []
+      wait_writable(self.class.client_timeout) or
+        raise Yahns::ClientTimeout, "waiting for write", []
     end while true
   end
 
diff --git a/lib/yahns/http_response.rb b/lib/yahns/http_response.rb
index 865193d..2e719eb 100644
--- a/lib/yahns/http_response.rb
+++ b/lib/yahns/http_response.rb
@@ -46,10 +46,9 @@ def response_start
     @hs.response_start_sent ? ''.freeze : 'HTTP/1.1 '.freeze
   end
 
-  def response_wait_write(rv)
-    # call the kgio_wait_readable or kgio_wait_writable method
-    ok = __send__("kgio_#{rv}") and return ok
+  def response_wait_write(rv) # rv = [:wait_writable | :wait_readable ]
     k = self.class
+    ok = __send__(rv, k.client_timeout) and return ok
     k.logger.info("fd=#{fileno} ip=#@kgio_addr timeout on :#{rv} after "\
                   "#{k.client_timeout}s")
     false
diff --git a/lib/yahns/server.rb b/lib/yahns/server.rb
index 2ad65a9..c078ade 100644
--- a/lib/yahns/server.rb
+++ b/lib/yahns/server.rb
@@ -476,7 +476,7 @@ def reap_reexec
   end
 
   def sp_sig_handle(alive)
-    @sev.kgio_wait_readable(alive ? nil : 0.01)
+    @sev.wait_readable(alive ? nil : 0.01)
     @sev.yahns_step
     case sig = @sig_queue.shift
     when :QUIT, :TERM, :INT
diff --git a/lib/yahns/server_mp.rb b/lib/yahns/server_mp.rb
index 8752a08..5467674 100644
--- a/lib/yahns/server_mp.rb
+++ b/lib/yahns/server_mp.rb
@@ -89,7 +89,7 @@ def join
     @logger.info "master process ready"
     daemon_ready
     begin
-      @sev.kgio_wait_readable
+      @sev.wait_readable
       @sev.yahns_step
       reap_all
       case @sig_queue.shift
diff --git a/lib/yahns/sigevent_pipe.rb b/lib/yahns/sigevent_pipe.rb
index f630e72..df4c31a 100644
--- a/lib/yahns/sigevent_pipe.rb
+++ b/lib/yahns/sigevent_pipe.rb
@@ -8,10 +8,6 @@ def initialize
     @to_io, @wr = Kgio::Pipe.new
   end
 
-  def kgio_wait_readable(*args)
-    @to_io.kgio_wait_readable(*args)
-  end
-
   def sev_signal
     @wr.kgio_trywrite(".")
   end
-- 
EW


^ permalink raw reply related	[relevance 7%]

Results 1-4 of 4 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2019-01-07 10:43  7% [PATCH] remove calls to kgio_wait_* able Eric Wong
2019-04-02  3:10  6% [PATCH] sigevent_*: fixup non-eventfd path Eric Wong
2019-04-02  3:13  6% Eric Wong
2019-04-22  7:37  6% [ANN] yahns 1.17.0 -_- sleepy app server for Ruby 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).