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.7 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: =?iso-8859-1?q?I=F1aki_Baz_Castillo?= Newsgroups: gmane.comp.lang.ruby.unicorn.general Subject: Re: "unicorn -D" always returns 0 "success" (even when failed to load) Date: Sat, 26 Dec 2009 00:58:13 +0100 Message-ID: <200912260058.14046.ibc@aliax.net> References: <200912230320.59469.ibc@aliax.net> <20091223072617.GA28704@dcvr.yhbt.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 1261785535 6611 80.91.229.12 (25 Dec 2009 23:58:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 25 Dec 2009 23:58:55 +0000 (UTC) To: mongrel-unicorn@rubyforge.org Original-X-From: mongrel-unicorn-bounces@rubyforge.org Sat Dec 26 00:58:48 2009 Return-path: Envelope-to: gclrug-mongrel-unicorn@m.gmane.org X-Original-To: mongrel-unicorn@rubyforge.org Delivered-To: mongrel-unicorn@rubyforge.org User-Agent: KMail/1.12.2 (Linux/2.6.28-16-generic; KDE/4.3.2; x86_64; ; ) In-Reply-To: <20091223072617.GA28704@dcvr.yhbt.net> 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:248 Archived-At: Received: from rubyforge.org ([205.234.109.19]) by lo.gmane.org with esmtp (Exim 4.50) id 1NOK3U-0004n4-8z for gclrug-mongrel-unicorn@m.gmane.org; Sat, 26 Dec 2009 00:58:48 +0100 Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 1428818582CA; Fri, 25 Dec 2009 18:58:48 -0500 (EST) Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.26]) by rubyforge.org (Postfix) with ESMTP id 3C56418582C9 for ; Fri, 25 Dec 2009 18:58:46 -0500 (EST) Received: by ey-out-2122.google.com with SMTP id 25so880364eya.29 for ; Fri, 25 Dec 2009 15:58:45 -0800 (PST) Received: by 10.213.107.16 with SMTP id z16mr471149ebo.47.1261785525458; Fri, 25 Dec 2009 15:58:45 -0800 (PST) Received: from ibc-laptop.localnet (3.Red-83-57-15.dynamicIP.rima-tde.net [83.57.15.3]) by mx.google.com with ESMTPS id 16sm6637091ewy.2.2009.12.25.15.58.43 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 25 Dec 2009 15:58:44 -0800 (PST) El Mi=E9rcoles, 23 de Diciembre de 2009, Eric Wong escribi=F3: > > Usually if a worker (all the workers) fail to start at the moment of > > running it, it obviously means that there is some error in the > > application with prevents it to run. It could be great if Unicorn could > > detect it. > = > I'm generally hesitant to introduce code/features/bloat that aren't > helpful to people who properly test configurations before deploying :) > = > Adding this code doesn't solve problems. Either way the site can become > inaccessible/unusable and problems are noticeable very quickly. Ok, I should explain better why I need this feature: I'm not coding a HTTP app on top of Unicorn to host in a server. Instead I'= m = building a XCAP server (RFC 4825) using Rack and Unicorn. I'll also publish= a = Ruby gem containing all the server (Unicorn + Rack application). So, any user could install the gem, set the database(s), fill the = configuration file and star the server in background by running the provide= d = init script ("/etc/init.d/xcapserver start") which runs the server daemoniz= ed. Imagine that the user wrote a typo, i.e: after_fork do |server, worker| # Note the space typo: worker.u ser("www-data", "www-data") if Process.euid =3D=3D 0 end Then the init script would return 0 (success) but the server wouldn't work. = The user would check "ps aux | grep xcapserver" and would see the xcapserve= r = running. It would be complex to understand why the server it's failing. So it would be great the following: - The user start the init script (which calls "unicorn -D ...") with a = hypotethical new option ("--no-error-time 2"). - The command "unicorn -D" remains in foreground for 2 seconds before maste= r = process going to background. - Unicorn fails to create the workers at the moment (so within 2 seconds). - Instead of re-spawning them, the command (still in foreground) exits with = return code 1 (error). But there is other case which is much wrose IMHO. Imagine the user writes a = space typo: stde rr_path "/var/log/xcapserver.err.log" or imagine it uses a path that doesn't exist (/var/log/xcapserver/ doesn't = exist): stderr_path "/var/log/xcapserver/err.log" In both cases "unicorn -D" returns 0 but the server is not running (no unic= orn = process running). So, why did it return 0? It's not an error when creating = the = workers, but when running also the master process. IMHO in this case Unicor= n = should return non zero (even if it called with "-D"). I'm playing right now with unicorn/launcher.rb (daemonize! method)but I get = nothing. Unfortunatelly I think that the usage of fork makes very difficult = the main command to behave as I desire (exit status). If you could give me some tips I'd try to implement it. Reall thanks a lot again and again :) -- = I=F1aki Baz Castillo _______________________________________________ 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