From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.9 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, T_RP_MATCHES_RCVD,URIBL_BLOCKED shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: yahns-public@yhbt.net Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 8B2341FABD; Sat, 9 May 2015 09:03:08 +0000 (UTC) Date: Sat, 9 May 2015 09:03:08 +0000 From: Eric Wong To: "Lin Jen-Shin (godfat)" Cc: yahns-public@yhbt.net, wildjcrt@gmail.com Subject: [PATCH] worker threads log LoadError and SyntaxError, too Message-ID: <20150509090308.GA29928@dcvr.yhbt.net> References: <20150508170311.GA1260@dcvr.yhbt.net> <20150509010349.GA23261@dcvr.yhbt.net> <20150509084733.GA4603@dcvr.yhbt.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150509084733.GA4603@dcvr.yhbt.net> List-Id: Some applications may lazily load code during app dispatch, triggering LoadError or SyntaxError exceptions. Log the error and backtrace so application maintainers can more easily notice and diagnose problems. Keep in mind users are likely to have performance and race condition problems with lazy loading, and the process may still be in a bad state due to partially-loaded code. This commit is only intended to give application authors a chance to notice and fix or avoid problems in the future. Note: logging fatal exceptions by default in all threads was proposed in ruby-core, but currently not implemented in any released version: https://bugs.ruby-lang.org/issues/6647 Reported-by: Lin Jen-Shin (godfat) --- I'll push this over the weekend and release 1.7 from master (proxy_pass isn't production-ready, but there's still a good deal of small improvements going in). lib/yahns/queue_epoll.rb | 2 +- lib/yahns/queue_kqueue.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/yahns/queue_epoll.rb b/lib/yahns/queue_epoll.rb index 4f3289e..2875920 100644 --- a/lib/yahns/queue_epoll.rb +++ b/lib/yahns/queue_epoll.rb @@ -64,7 +64,7 @@ class Yahns::Queue < SleepyPenguin::Epoll::IO # :nodoc: raise "BUG: #{io.inspect}#yahns_step returned: #{rv.inspect}" end end - rescue => e + rescue StandardError, LoadError, SyntaxError => e break if closed? # can still happen due to shutdown_timeout Yahns::Log.exception(logger, 'queue loop', e) end while true diff --git a/lib/yahns/queue_kqueue.rb b/lib/yahns/queue_kqueue.rb index 4176f7a..33f5f8b 100644 --- a/lib/yahns/queue_kqueue.rb +++ b/lib/yahns/queue_kqueue.rb @@ -72,7 +72,7 @@ class Yahns::Queue < SleepyPenguin::Kqueue::IO # :nodoc: raise "BUG: #{io.inspect}#yahns_step returned: #{rv.inspect}" end end - rescue => e + rescue StandardError, LoadError, SyntaxError => e break if closed? # can still happen due to shutdown_timeout Yahns::Log.exception(logger, 'queue loop', e) end while true -- EW