* [ANN] yahns 1.16.0 -_- sleepy app server for Ruby
@ 2018-08-06 1:32 4% Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2018-08-06 1:32 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 https://yhbt.net/yahns.git
* https://yhbt.net/yahns/README
* 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:
yahns 1.16.0
This release fixes warnings for users combining Rack::Deflater
with HTTPS support:
https://yhbt.net/yahns-public/20180714005630.11812-1-e@80x24.org/
yahns-rackup(1) users may not specify "-O listen=inherit"
when spawning from systemd. The "listen" directive may
be omitted entirely from the yahns-config(5) files.
A few other cleanups and nothing interesting, otherwise.
20 yawn-worthy changes since v1.15.0 (2017-03-23):
config: more descriptive variable name
proxy_pass: comment explaining what rack.hijack calls
USR2 upgrades may use Process.spawn for vfork
avoid Thread#[] and Thread#[]= across threads
gemspec: declare Ruby 2.0+ dependency, here
test_bin: SO_KEEPALIVE value only needs to be true
rackup_handler: remove unnecessary branch
test_bin: use RbConfig.ruby for non-standard names
allow omitting specifying socket name when inheriting listen socket
server: fix incomplete comment about SSLContext#setup
test_rack_env: additional test for Rack environment
test: allow setting TAIL env to watch error logs
fix some unused variables
tests: thread-safety fixes
test/server_helper: describe reason for termination
test/test_ssl: set SSLContext#security_level=0
doc: https:// URLs instead of git://
http_client: clear backtrace on "wrong version number" in OpenSSL
openssl_client: do not attempt writes after SystemCallError
use IO#pread if available in Ruby 2.5
*ZZZZZZ*
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 4%]
* [PATCH] openssl_client: do not attempt writes after SystemCallError
@ 2018-07-14 0:56 7% Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2018-07-14 0:56 UTC (permalink / raw)
To: yahns-public
Whenever @ssl.write_nonblock fails due to ECONNRESET/EPIPE in
Rack::Deflater#each; Rack::Deflater#each will still attempt to
write again in the "ensure" statement via Zlib::GzipWriter#close.
This causes SSL_write to complain of "bad length" or
"bad write retry" errors. Now, re-raise any SystemCallError
we caught from previous write_nonblock calls to prevent
calls to SSL_write which would trigger such an exception.
---
lib/yahns/openssl_client.rb | 39 ++++++++++++++++++++++++++++++-------
1 file changed, 32 insertions(+), 7 deletions(-)
diff --git a/lib/yahns/openssl_client.rb b/lib/yahns/openssl_client.rb
index 0d376bd..c090083 100644
--- a/lib/yahns/openssl_client.rb
+++ b/lib/yahns/openssl_client.rb
@@ -40,15 +40,31 @@ def yahns_init_ssl(ssl_ctx)
def kgio_trywrite(buf)
len = buf.bytesize
return if len == 0
- buf = @ssl_blocked = buf.dup
+
+ case @ssl_blocked
+ when nil # likely
+ buf = @ssl_blocked = buf.dup
+ when Exception
+ raise @ssl_blocked
+ when String
+ if @ssl_blocked != buf
+ pfx = object_id
+ warn("#{pfx} BUG: ssl_blocked != buf\n" \
+ "#{pfx} ssl_blocked=#{@ssl_blocked.inspect}\n" \
+ "#{pfx} buf=#{buf.inspect}\n")
+ raise 'BUG: ssl_blocked} != buf'
+ end
+ end
+
case rv = @ssl.write_nonblock(buf, exception: false)
when :wait_readable, :wait_writable
- return rv # do not clear ssl_blocked
+ rv # do not clear ssl_blocked
when Integer
- rv = len == rv ? nil : buf.byteslice(rv, len - rv)
+ @ssl_blocked = len == rv ? nil : buf.byteslice(rv, len - rv)
end
- @ssl_blocked = nil
- rv
+ rescue SystemCallError => e # ECONNRESET/EPIPE
+ e.set_backtrace([])
+ raise(@ssl_blocked = e)
end
def kgio_trywritev(buf)
@@ -75,22 +91,31 @@ def kgio_tryread(len, buf)
def trysendio(io, offset, count)
return 0 if count == 0
- unless buf = @ssl_blocked
+ case buf = @ssl_blocked
+ when nil
count = 0x4000 if count > 0x4000
buf = Thread.current[:yahns_sfbuf] ||= ''.dup
io.pos = offset
buf = io.read(count, buf) or return # nil for EOF
buf = @ssl_blocked = buf.dup
+ when Exception
+ raise buf
+ # when String # just use it as-is
end
# call write_nonblock directly since kgio_trywrite allocates
# an unnecessary string
+ len = buf.size
case rv = @ssl.write_nonblock(buf, exception: false)
when :wait_readable, :wait_writable
return rv # do not clear ssl_blocked
+ when Integer
+ @ssl_blocked = len == rv ? nil : buf.byteslice(rv, len - rv)
end
- @ssl_blocked = nil
rv
+ rescue SystemCallError => e # ECONNRESET/EPIPE
+ e.set_backtrace([])
+ raise(@ssl_blocked = e)
end
def shutdown # we never call this with a how=SHUT_* arg
--
EW
^ permalink raw reply related [relevance 7%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2018-07-14 0:56 7% [PATCH] openssl_client: do not attempt writes after SystemCallError Eric Wong
2018-08-06 1:32 4% [ANN] yahns 1.16.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).