From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS14383 205.234.109.0/24 X-Spam-Status: No, score=-0.5 required=5.0 tests=AWL,MSGID_FROM_MTA_HEADER, RP_MATCHES_RCVD shortcircuit=no autolearn=unavailable version=3.3.2 Path: news.gmane.org!not-for-mail From: Eric Wong Newsgroups: gmane.comp.lang.ruby.unicorn.general Subject: Re: "unicorn -D" always returns 0 "success" (even when failed to load) Date: Mon, 28 Dec 2009 11:25:12 -0800 Message-ID: <20091228192512.GB4230@dcvr.yhbt.net> References: <200912260529.45530.ibc@aliax.net> <200912270406.39535.ibc@aliax.net> <20091228032902.GC4349@dcvr.yhbt.net> <200912281350.44760.ibc@aliax.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1262028323 23608 80.91.229.12 (28 Dec 2009 19:25:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 28 Dec 2009 19:25:23 +0000 (UTC) To: unicorn list Original-X-From: mongrel-unicorn-bounces@rubyforge.org Mon Dec 28 20:25:15 2009 Return-path: Envelope-to: gclrug-mongrel-unicorn@m.gmane.org X-Original-To: mongrel-unicorn@rubyforge.org Delivered-To: mongrel-unicorn@rubyforge.org Content-Disposition: inline In-Reply-To: <200912281350.44760.ibc@aliax.net> User-Agent: Mutt/1.5.18 (2008-05-17) X-BeenThere: mongrel-unicorn@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: mongrel-unicorn-bounces@rubyforge.org Errors-To: mongrel-unicorn-bounces@rubyforge.org Xref: news.gmane.org gmane.comp.lang.ruby.unicorn.general:270 Archived-At: Received: from rubyforge.org ([205.234.109.19]) by lo.gmane.org with esmtp (Exim 4.50) id 1NPLDO-00077z-Ru for gclrug-mongrel-unicorn@m.gmane.org; Mon, 28 Dec 2009 20:25:15 +0100 Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 17043167830B; Mon, 28 Dec 2009 14:25:15 -0500 (EST) Received: from dcvr.yhbt.net (dcvr.yhbt.net [64.71.152.64]) by rubyforge.org (Postfix) with ESMTP id DF6041858267 for ; Mon, 28 Dec 2009 14:25:12 -0500 (EST) Received: from localhost (unknown [127.0.2.5]) by dcvr.yhbt.net (Postfix) with ESMTP id 354591F53C; Mon, 28 Dec 2009 19:25:12 +0000 (UTC) I=F1aki Baz Castillo wrote: > El Lunes, 28 de Diciembre de 2009, Eric Wong escribi=F3: > > > It's really awesome! I've tested it and it works great, and avoids th= e = > > > sleeping stuff and a new commandlline option. Congratulations :) > > = > > The current version is actually slightly buggy in that it leaks > > the pipe descriptor... > = > I've detected some other "issue": > = > Imagine port 80 is used by other application (as apache) and Unicorn is = > configured to also bind in same port. > = > = > When running it in foreground all is great: > = > ERROR -- : adding listener failed addr=3D0.0.0.0:80 (in use) > ERROR -- : retrying in 3 seconds (1 tries left) > ERROR -- : adding listener failed addr=3D0.0.0.0:80 (in use) > ERROR -- : retrying in 3 seconds (0 tries left) > ERROR -- : adding listener failed addr=3D0.0.0.0:80 (in use) > /usr/local/lib/ruby1.9/site_ruby/1.9.1/unicorn/socket_helper.rb:110:in = > `initialize': Address already in use - bind(2) (Errno::EADDRINUSE) > = > = > But when running in background an ugly error is displayed: > = > /usr/local/lib/ruby1.9/site_ruby/1.9.1/unicorn/launcher.rb:45:in `sysre= ad': > end of file reached (EOFError) > from /usr/local/lib/ruby1.9/site_ruby/1.9.1/unicorn/launcher.rb:45:in > `daemonize!' > = > = > In both cases $? is 1 (error) but in the last case the error message is n= ot = > very useful. > = > I suspect what is happening: the master tries several times to bind and a= fter = > N retries it terminates (so it closes the pipe and grandparent gets EOFEr= ror). > = > As a suggestion, could the grandparent rescue such exception and display = some = > kind of error message?: > = > "The master couldn't be started. Inspect the log error or run in foregr= ound" Thanks, pushed out to the ready_pipe branch of unicorn.git >>From 52eee4e424198a3c80793ee9c930fd3bb0285168 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 28 Dec 2009 11:16:00 -0800 Subject: [PATCH] launcher: descriptive error message on startup failure MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit Rather than erroring out with a non-descript EOFError, show a warning message telling users to check the logs instead. Reported-by: I=F1aki Baz Castillo mid=3D200912281350.44760.ibc@aliax.net --- lib/unicorn/launcher.rb | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/unicorn/launcher.rb b/lib/unicorn/launcher.rb index 0ea836b..1871420 100644 --- a/lib/unicorn/launcher.rb +++ b/lib/unicorn/launcher.rb @@ -42,8 +42,11 @@ class Unicorn::Launcher = if grandparent =3D=3D $$ # this will block until HttpServer#join runs (or it dies) - master_pid =3D rd.readpartial(16).to_i - exit!(1) unless master_pid > 1 + master_pid =3D (rd.readpartial(16) rescue nil).to_i + unless master_pid > 1 + warn "master failed to start, check stderr log for details" + exit!(1) + end exit 0 else # unicorn master process options[:ready_pipe] =3D wr -- = Eric Wong _______________________________________________ Unicorn mailing list - mongrel-unicorn@rubyforge.org http://rubyforge.org/mailman/listinfo/mongrel-unicorn Do not quote signatures (like this one) or top post when replying