* [ANN] yahns 1.17.0 -_- sleepy app server for Ruby
@ 2019-04-22 7:37 7% Eric Wong
0 siblings, 0 replies; 2+ 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 7%]
* [PATCH] remove IO#close_on_exec= calls
@ 2018-12-08 17:35 4% Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2018-12-08 17:35 UTC (permalink / raw)
To: yahns-public
Since we've required Ruby 2.0+ for a while, we can assume
descriptors are created with IO#close_on_exec=true and
avoid bloating our code with calls to it.
---
lib/yahns/config.rb | 2 +-
lib/yahns/daemon.rb | 1 -
lib/yahns/queue_kqueue.rb | 6 ------
lib/yahns/queue_quitter_pipe.rb | 1 -
lib/yahns/sigevent_pipe.rb | 1 -
lib/yahns/socket_helper.rb | 2 +-
test/helper.rb | 2 +-
test/server_helper.rb | 4 +---
test/test_serve_static.rb | 1 -
test/test_server.rb | 3 ---
test/test_unix_socket.rb | 4 +---
test/test_wbuf.rb | 2 +-
12 files changed, 6 insertions(+), 23 deletions(-)
diff --git a/lib/yahns/config.rb b/lib/yahns/config.rb
index bcea0d4..e64cb77 100644
--- a/lib/yahns/config.rb
+++ b/lib/yahns/config.rb
@@ -409,7 +409,7 @@ def errors(val)
if String === val
# we've already bound working_directory by the time we get here
val = File.open(File.expand_path(val), "ab")
- val.close_on_exec = val.sync = true
+ val.sync = true
else
rt = [ :puts, :write, :flush ] # match Rack::Lint
rt.all? { |m| val.respond_to?(m) } or raise ArgumentError,
diff --git a/lib/yahns/daemon.rb b/lib/yahns/daemon.rb
index e3e2d9c..cca2f3a 100644
--- a/lib/yahns/daemon.rb
+++ b/lib/yahns/daemon.rb
@@ -32,7 +32,6 @@ def self.daemon(yahns_server)
# We cannot use Yahns::Sigevent (eventfd) here because we need
# to detect EOF on unexpected death, not just read/write
rd, wr = IO.pipe
- rd.close_on_exec = wr.close_on_exec = true
grandparent = $$
if fork
wr.close # grandparent does not write
diff --git a/lib/yahns/queue_kqueue.rb b/lib/yahns/queue_kqueue.rb
index 064cd0e..3c4c51c 100644
--- a/lib/yahns/queue_kqueue.rb
+++ b/lib/yahns/queue_kqueue.rb
@@ -17,12 +17,6 @@ class Yahns::Queue < SleepyPenguin::Kqueue::IO # :nodoc:
ADD_ONESHOT = Ev::ADD | Ev::ONESHOT # private
- def self.new
- rv = super
- rv.close_on_exec = true
- rv
- end
-
# for HTTP and HTTPS servers, we rely on the io writing to us, first
# flags: QEV_RD/QEV_WR (usually QEV_RD)
def queue_add(io, flags)
diff --git a/lib/yahns/queue_quitter_pipe.rb b/lib/yahns/queue_quitter_pipe.rb
index 789eacd..9a2e494 100644
--- a/lib/yahns/queue_quitter_pipe.rb
+++ b/lib/yahns/queue_quitter_pipe.rb
@@ -7,7 +7,6 @@ class Yahns::QueueQuitter # :nodoc:
attr_reader :to_io
def initialize
@reader, @to_io = IO.pipe
- @to_io.close_on_exec = true
end
def yahns_step
diff --git a/lib/yahns/sigevent_pipe.rb b/lib/yahns/sigevent_pipe.rb
index a85fb2a..f630e72 100644
--- a/lib/yahns/sigevent_pipe.rb
+++ b/lib/yahns/sigevent_pipe.rb
@@ -6,7 +6,6 @@ class Yahns::Sigevent # :nodoc:
attr_reader :to_io
def initialize
@to_io, @wr = Kgio::Pipe.new
- @to_io.close_on_exec = @wr.close_on_exec = true
end
def kgio_wait_readable(*args)
diff --git a/lib/yahns/socket_helper.rb b/lib/yahns/socket_helper.rb
index 9d4afc0..963c9fa 100644
--- a/lib/yahns/socket_helper.rb
+++ b/lib/yahns/socket_helper.rb
@@ -19,7 +19,7 @@ def so_reuseport
def set_server_sockopt(sock, opt)
opt = {backlog: 1024}.merge!(opt)
- sock.close_on_exec = true
+ sock.close_on_exec = true # needed for inherited sockets
TCPSocket === sock and sock.setsockopt(:IPPROTO_TCP, :TCP_NODELAY, 1)
sock.setsockopt(:SOL_SOCKET, :SO_KEEPALIVE, 1)
diff --git a/test/helper.rb b/test/helper.rb
index 3023dee..550a0f1 100644
--- a/test/helper.rb
+++ b/test/helper.rb
@@ -125,7 +125,7 @@ def nread
end if ! IO.method_defined?(:nread) && RUBY_PLATFORM =~ /linux/
def cloexec_pipe
- IO.pipe.each { |io| io.close_on_exec = true }
+ IO.pipe
end
def require_exec(cmd)
diff --git a/test/server_helper.rb b/test/server_helper.rb
index b794ee6..095cba1 100644
--- a/test/server_helper.rb
+++ b/test/server_helper.rb
@@ -52,9 +52,7 @@ def quit_wait(pid)
# only use for newly bound sockets
def get_tcp_client(host, port, tries = 500)
begin
- c = TCPSocket.new(host, port)
- c.close_on_exec = true
- return c
+ return TCPSocket.new(host, port)
rescue Errno::ECONNREFUSED
raise if tries < 0
tries -= 1
diff --git a/test/test_serve_static.rb b/test/test_serve_static.rb
index 68e84f7..837414b 100644
--- a/test/test_serve_static.rb
+++ b/test/test_serve_static.rb
@@ -38,7 +38,6 @@ def test_serve_static
# ensure sendfile works on Unix sockets
s = UNIXSocket.new(sock)
- s.close_on_exec = true
s.write "GET /COPYING\r\n\r\n"
assert_equal gplv3, Timeout.timeout(30) { s.read }
s.close
diff --git a/test/test_server.rb b/test/test_server.rb
index a113b43..75e1857 100644
--- a/test/test_server.rb
+++ b/test/test_server.rb
@@ -182,7 +182,6 @@ def test_check_client_connection
tmpdir = yahns_mktmpdir
sock = "#{tmpdir}/sock"
unix_srv = UNIXServer.new(sock)
- unix_srv.close_on_exec = true
msgs = %w(ZZ zz)
err = @err
cfg = Yahns::Config.new
@@ -234,7 +233,6 @@ def a.each
bpipe[0].close
a = UNIXSocket.new(sock)
b = UNIXSocket.new(sock)
- b.close_on_exec = a.close_on_exec = true
a.write("GET /sleep HTTP/1.0\r\n\r\n")
r = IO.select([a], nil, nil, 4)
assert r, "nothing ready"
@@ -681,7 +679,6 @@ def test_errors
assert_equal "INFO HIHI\n", re.read
c = UNIXSocket.new(sock)
- c.close_on_exec = true
c.write "GET /\r\n\r\n"
assert_equal c, c.wait(30)
assert_equal "OK", c.read
diff --git a/test/test_unix_socket.rb b/test/test_unix_socket.rb
index 7b821e3..b4e338c 100644
--- a/test/test_unix_socket.rb
+++ b/test/test_unix_socket.rb
@@ -12,9 +12,7 @@ class TestUnixSocket < Testcase
def unix_socket(path)
Timeout.timeout(30) do
begin
- c = UNIXSocket.new(path)
- c.close_on_exec = true
- return c
+ return UNIXSocket.new(path)
rescue Errno::ENOENT
sleep 0.01
retry
diff --git a/test/test_wbuf.rb b/test/test_wbuf.rb
index 89825db..0135958 100644
--- a/test/test_wbuf.rb
+++ b/test/test_wbuf.rb
@@ -19,7 +19,7 @@ def self.output_buffer_tmpdir
end
def socketpair
- KgioUS.pair.each { |io| io.close_on_exec = true }
+ KgioUS.pair
end
def test_wbuf
^ permalink raw reply related [relevance 4%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2018-12-08 17:35 4% [PATCH] remove IO#close_on_exec= calls Eric Wong
2019-04-22 7:37 7% [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).