From normalperson at yhbt.net Mon Mar 7 23:40:31 2011 From: normalperson at yhbt.net (Eric Wong) Date: Mon, 7 Mar 2011 20:40:31 -0800 Subject: [RFC/PATCH] Bundler/Sandbox documentation updates Message-ID: <20110308044031.GA12532@dcvr.yhbt.net> I started playing around with Bundler 1.0.10 today and noticed it's quite different than previous versions (based on my limited experiences) and the out-of-the-box experience is pretty good regarding (lack of) ENV pollution. Can any more experienced Bundler (and possibly Capistrano) users comment on the below changes and see if they make sense? Thanks in advance! diff --git a/Sandbox b/Sandbox index d101106..46dfb91 100644 --- a/Sandbox +++ b/Sandbox @@ -45,11 +45,20 @@ This is no longer be an issue as of bundler 0.9.17 ref: http://mid.gmane.org/8FC34B23-5994-41CC-B5AF-7198EF06909E at tramchase.com +=== BUNDLE_GEMFILE for Capistrano users + +You may need to set or reset the BUNDLE_GEMFILE environment variable in +the before_exec hook: + + before_exec do |server| + ENV["BUNDLE_GEMFILE"] = "/path/to/app/current/Gemfile" + end + === Other ENV pollution issues -You may need to set or reset BUNDLE_GEMFILE, GEM_HOME, GEM_PATH and PATH -environment variables in the before_exec hook as illustrated by -http://gist.github.com/534668 +If you're using an older Bundler version (0.9.x), you may need to set or +reset GEM_HOME, GEM_PATH and PATH environment variables in the +before_exec hook as illustrated by http://gist.github.com/534668 == Isolate -- Eric Wong From justin.giancola at gmail.com Tue Mar 8 09:22:32 2011 From: justin.giancola at gmail.com (Justin Giancola) Date: Tue, 8 Mar 2011 09:22:32 -0500 Subject: [RFC/PATCH] Bundler/Sandbox documentation updates In-Reply-To: <20110308044031.GA12532@dcvr.yhbt.net> References: <20110308044031.GA12532@dcvr.yhbt.net> Message-ID: Setting BUNDLE_GEMFILE in the before_exec hook is the only Bundler-related Unicorn config I've needed for Bundler >= 1.0.3 For <= 1.0.2 not even this was necessary because the template executables Bundler generates didn't fully resolve the BUNDLE_GEMFILE path until 1.0.3 Justin On Mon, Mar 7, 2011 at 11:40 PM, Eric Wong wrote: > I started playing around with Bundler 1.0.10 today and noticed it's > quite different than previous versions (based on my limited experiences) > and the out-of-the-box experience is pretty good regarding (lack of) > ENV pollution. > > Can any more experienced Bundler (and possibly Capistrano) users > comment on the below changes and see if they make sense? > > Thanks in advance! > > diff --git a/Sandbox b/Sandbox > index d101106..46dfb91 100644 > --- a/Sandbox > +++ b/Sandbox > @@ -45,11 +45,20 @@ This is no longer be an issue as of bundler 0.9.17 > > ?ref: http://mid.gmane.org/8FC34B23-5994-41CC-B5AF-7198EF06909E at tramchase.com > > +=== BUNDLE_GEMFILE for Capistrano users > + > +You may need to set or reset the BUNDLE_GEMFILE environment variable in > +the before_exec hook: > + > + ? ? ? ?before_exec do |server| > + ? ? ? ? ?ENV["BUNDLE_GEMFILE"] = "/path/to/app/current/Gemfile" > + ? ? ? ?end > + > ?=== Other ENV pollution issues > > -You may need to set or reset BUNDLE_GEMFILE, GEM_HOME, GEM_PATH and PATH > -environment variables in the before_exec hook as illustrated by > -http://gist.github.com/534668 > +If you're using an older Bundler version (0.9.x), you may need to set or > +reset GEM_HOME, GEM_PATH and PATH environment variables in the > +before_exec hook as illustrated by http://gist.github.com/534668 > > ?== Isolate > > -- > Eric Wong > _______________________________________________ > Unicorn mailing list - mongrel-unicorn at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-unicorn > Do not quote signatures (like this one) or top post when replying > From lawrence.pit at gmail.com Wed Mar 9 05:39:35 2011 From: lawrence.pit at gmail.com (Lawrence Pit) Date: Wed, 09 Mar 2011 21:39:35 +1100 Subject: [RFC/PATCH] Bundler/Sandbox documentation updates In-Reply-To: <20110308044031.GA12532@dcvr.yhbt.net> References: <20110308044031.GA12532@dcvr.yhbt.net> Message-ID: <4D7758E7.6020505@gmail.com> Hi Eric, I tested this out: - in the before_exec and after_fork I log PATH GEM_HOME GEM_PATH BUNDLE_GEMFILE for inspection after deployment - deploy latest release, make sure to shutdown unicorn, then start cleanly - prune all releases, except the last one - deploy latest release again (which only sets the BUNDLE_GEMFILE env var) I've tried this a few times, and everytime I get something like this: https://gist.github.com/331b0decab62fd58483c If I revert back to setting the GEM_HOME, GEM_PATH and PATH in the before_exec it works fine. PS. When deploying I use USR2 followed by QUIT Cheers, Lawrence > I started playing around with Bundler 1.0.10 today and noticed it's > quite different than previous versions (based on my limited experiences) > and the out-of-the-box experience is pretty good regarding (lack of) > ENV pollution. > > Can any more experienced Bundler (and possibly Capistrano) users > comment on the below changes and see if they make sense? > > Thanks in advance! > > diff --git a/Sandbox b/Sandbox > index d101106..46dfb91 100644 > --- a/Sandbox > +++ b/Sandbox > @@ -45,11 +45,20 @@ This is no longer be an issue as of bundler 0.9.17 > > ref: http://mid.gmane.org/8FC34B23-5994-41CC-B5AF-7198EF06909E at tramchase.com > > +=== BUNDLE_GEMFILE for Capistrano users > + > +You may need to set or reset the BUNDLE_GEMFILE environment variable in > +the before_exec hook: > + > + before_exec do |server| > + ENV["BUNDLE_GEMFILE"] = "/path/to/app/current/Gemfile" > + end > + > === Other ENV pollution issues > > -You may need to set or reset BUNDLE_GEMFILE, GEM_HOME, GEM_PATH and PATH > -environment variables in the before_exec hook as illustrated by > -http://gist.github.com/534668 > +If you're using an older Bundler version (0.9.x), you may need to set or > +reset GEM_HOME, GEM_PATH and PATH environment variables in the > +before_exec hook as illustrated by http://gist.github.com/534668 > > == Isolate > From normalperson at yhbt.net Wed Mar 9 19:49:08 2011 From: normalperson at yhbt.net (Eric Wong) Date: Thu, 10 Mar 2011 00:49:08 +0000 Subject: [RFC/PATCH] Bundler/Sandbox documentation updates In-Reply-To: References: <20110308044031.GA12532@dcvr.yhbt.net> Message-ID: <20110310004908.GA1088@dcvr.yhbt.net> Justin Giancola wrote: > Setting BUNDLE_GEMFILE in the before_exec hook is the only > Bundler-related Unicorn config I've needed for Bundler >= 1.0.3 Thanks, that seems to match my observations, too. From normalperson at yhbt.net Wed Mar 9 19:52:27 2011 From: normalperson at yhbt.net (Eric Wong) Date: Thu, 10 Mar 2011 00:52:27 +0000 Subject: [RFC/PATCH] Bundler/Sandbox documentation updates In-Reply-To: <4D7758E7.6020505@gmail.com> References: <20110308044031.GA12532@dcvr.yhbt.net> <4D7758E7.6020505@gmail.com> Message-ID: <20110310005227.GA1002@dcvr.yhbt.net> Lawrence Pit wrote: > Hi Eric, > > I tested this out: Thanks for taking your time to test. > - in the before_exec and after_fork I log PATH GEM_HOME GEM_PATH > BUNDLE_GEMFILE for inspection after deployment > > - deploy latest release, make sure to shutdown unicorn, then start cleanly > > - prune all releases, except the last one > > - deploy latest release again (which only sets the BUNDLE_GEMFILE env var) > > I've tried this a few times, and everytime I get something like this: > > https://gist.github.com/331b0decab62fd58483c Yikes, it looks like the UNICORN_FD env is getting clobbered somehow. Not sure what could be causing that. > If I revert back to setting the GEM_HOME, GEM_PATH and PATH in the > before_exec it works fine. Which Bundler version is this with? > PS. When deploying I use USR2 followed by QUIT From lawrence.pit at gmail.com Wed Mar 9 22:30:14 2011 From: lawrence.pit at gmail.com (Lawrence Pit) Date: Thu, 10 Mar 2011 14:30:14 +1100 Subject: [RFC/PATCH] Bundler/Sandbox documentation updates In-Reply-To: <20110310005227.GA1002@dcvr.yhbt.net> References: <20110308044031.GA12532@dcvr.yhbt.net> <4D7758E7.6020505@gmail.com> <20110310005227.GA1002@dcvr.yhbt.net> Message-ID: <4D7845C6.2070301@gmail.com> > Which Bundler version is this with? Bundler 1.0.10 Cheers, Lawrence > I've tried this a few times, and everytime I get something like this: >> https://gist.github.com/331b0decab62fd58483c > Yikes, it looks like the UNICORN_FD env is getting clobbered somehow. > Not sure what could be causing that. > >> If I revert back to setting the GEM_HOME, GEM_PATH and PATH in the >> before_exec it works fine. From julien.palmas at gmail.com Thu Mar 10 06:21:14 2011 From: julien.palmas at gmail.com (Julien Palmas) Date: Thu, 10 Mar 2011 12:21:14 +0100 Subject: Hello and Rack Handler question ;-) Message-ID: Hi list, This is my first post here, so Hello World! ;-) By default, `rails server` starts webrick on a new rails 3 project. If you include Thin in the gemfile, you can run `rails s thin`to use thin instead. Same works with mongrel. Unfortunately, this does not work with unicorn, since it seems that Rack does not provide a handler for Unicorn by default (as it does for Thin and Mongrel). I know I can run `unicorn` in my app root to achieve the same, but it'd be nice to stick with rails commands and have `rails s unicorn` Can you tell me if such a handler already exists ? ++ Ju From list at mrtech.ru Thu Mar 10 12:16:56 2011 From: list at mrtech.ru (Troex Nevelin) Date: Thu, 10 Mar 2011 20:16:56 +0300 Subject: Memcache reset on rails 2.3 with preload Message-ID: <4D790788.8010305@mrtech.ru> What is a right code for resetting memcache connection in after_fork for Rails 2.3 with "preload_app true" on REE? The only configurations about memcache in my app are: config/initializers/session_store.rb: ActionController::Base.session_store = :mem_cache_store config/environment.rb: config.cache_store = :mem_cache_store I tried: Rails.cache.reset But it fails to start, looks like this code is for Rails3 only From cliftonk at gmail.com Thu Mar 10 15:48:22 2011 From: cliftonk at gmail.com (Clifton King) Date: Thu, 10 Mar 2011 14:48:22 -0600 Subject: Memcache reset on rails 2.3 with preload In-Reply-To: <4D790788.8010305@mrtech.ru> References: <4D790788.8010305@mrtech.ru> Message-ID: I opt to use this gem: https://github.com/fauna/memcached I use the following settings in my environment: $memcached = Memcached::Rails.new(cache_server, :namespace => "os-", :tcp_nodelay => true, # disable nagle algorithm :no_block => true) # dont block on writes ActionController::Base.cache_store = :mem_cache_store, $memcached $session_memcached = Memcached::Rails.new(cache_server, :namespace => "os-", :tcp_nodelay => true, # disable nagle algorithm :no_block => true) ActionController::Base.cache_store = :mem_cache_store, $memcached ActionController::Base.session_store = :mem_cache_store ActionController::Base.session_options[:cache] = $session_memcached in after_fork i have $memcached.reset $session_memcached.reset Clifton On Thu, Mar 10, 2011 at 11:16 AM, Troex Nevelin wrote: > What is a right code for resetting memcache connection in after_fork for > Rails 2.3 with "preload_app true" on REE? > > The only configurations about memcache in my app are: > > config/initializers/session_store.rb: > ActionController::Base.session_store = :mem_cache_store > > config/environment.rb: > config.cache_store = :mem_cache_store > > > I tried: > Rails.cache.reset > > But it fails to start, looks like this code is for Rails3 only > _______________________________________________ > Unicorn mailing list - mongrel-unicorn at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-unicorn > Do not quote signatures (like this one) or top post when replying > From normalperson at yhbt.net Thu Mar 10 16:08:01 2011 From: normalperson at yhbt.net (Eric Wong) Date: Thu, 10 Mar 2011 13:08:01 -0800 Subject: Hello and Rack Handler question ;-) In-Reply-To: References: Message-ID: <20110310210801.GA8221@dcvr.yhbt.net> Julien Palmas wrote: > Hi list, > > This is my first post here, so Hello World! ;-) Hello Julien :> > By default, `rails server` starts webrick on a new rails 3 project. > If you include Thin in the gemfile, you can run `rails s thin`to use > thin instead. > Same works with mongrel. > > Unfortunately, this does not work with unicorn, since it seems that > Rack does not provide a handler for Unicorn by default (as it does for > Thin and Mongrel). > > I know I can run `unicorn` in my app root to achieve the same, but > it'd be nice to stick with rails commands and have `rails s unicorn` > > Can you tell me if such a handler already exists ? No it does not. Unicorn provides configuration options and signal handler interfaces that Thin and Mongrel do not. Trying to tie them to the same interface would just cripple Unicorn users attempting to use the generic interface and make it more confusing and difficult to support for everyone (Rack/Rails/Unicorn developers). There was a similar discussion here back in 2009: http://thread.gmane.org/gmane.comp.lang.ruby.unicorn.general/130/focus=130 -- Eric Wong From normalperson at yhbt.net Thu Mar 10 16:23:10 2011 From: normalperson at yhbt.net (Eric Wong) Date: Thu, 10 Mar 2011 13:23:10 -0800 Subject: Memcache reset on rails 2.3 with preload In-Reply-To: <4D790788.8010305@mrtech.ru> References: <4D790788.8010305@mrtech.ru> Message-ID: <20110310212310.GA7801@dcvr.yhbt.net> Troex Nevelin wrote: > What is a right code for resetting memcache connection in after_fork for > Rails 2.3 with "preload_app true" on REE? > > The only configurations about memcache in my app are: > > config/initializers/session_store.rb: > ActionController::Base.session_store = :mem_cache_store > > config/environment.rb: > config.cache_store = :mem_cache_store So that uses the memcache-client gem? I seem to remember that (and dalli) only connects when it's needed, but I suppose some apps use memcached at load time. The following should work, not the most elegant: before_fork do |server,worker| ObjectSpace.each_object(MemCache) { |mc| mc.reset } end An after_fork would probably send unnecessary messages to the memcached servers. > I tried: > Rails.cache.reset > > But it fails to start, looks like this code is for Rails3 only Hopefully somebody else knows a more elegant way to handle this. -- Eric Wong From normalperson at yhbt.net Thu Mar 10 16:29:03 2011 From: normalperson at yhbt.net (Eric Wong) Date: Thu, 10 Mar 2011 13:29:03 -0800 Subject: [RFC/PATCH] Bundler/Sandbox documentation updates In-Reply-To: <4D7845C6.2070301@gmail.com> References: <20110308044031.GA12532@dcvr.yhbt.net> <4D7758E7.6020505@gmail.com> <20110310005227.GA1002@dcvr.yhbt.net> <4D7845C6.2070301@gmail.com> Message-ID: <20110310212903.GB7801@dcvr.yhbt.net> Lawrence Pit wrote: > Eric Wong wrote: >> I've tried this a few times, and everytime I get something like this: >>> https://gist.github.com/331b0decab62fd58483c >> Yikes, it looks like the UNICORN_FD env is getting clobbered somehow. >> Not sure what could be causing that. >> >>> If I revert back to setting the GEM_HOME, GEM_PATH and PATH in the >>> before_exec it works fine. > > Which Bundler version is this with? > > Bundler 1.0.10 Odd, I actually used this in my Rainbows! config file to switch an Isolate deploy to Bundler (1.0.10) yesterday. Everything for Rainbows! applies to Unicorn, too). # switching from Isolate to Bundler: if ENV["GEM_HOME"] =~ %r{/isolate/} ENV.delete "GEM_HOME" ENV.delete "GEM_PATH" # don't need anything else in $PATH for a web server ENV["PATH"] = "/home/ew/ruby-1.9.2/bin" # START_CTX is considered a stable interface in Unicorn start_ctx = Unicorn::HttpServer::START_CTX start_ctx[0] = "bundle" # it's even possible to use USR2 to switch between Unicorn and # Rainbows! without any downtime :) start_ctx[:argv] = %w(exec rainbows).concat(start_ctx[:argv]) end -- Eric Wong From lawrence.pit at gmail.com Thu Mar 10 17:01:24 2011 From: lawrence.pit at gmail.com (Lawrence Pit) Date: Fri, 11 Mar 2011 09:01:24 +1100 Subject: Memcache reset on rails 2.3 with preload In-Reply-To: <4D790788.8010305@mrtech.ru> References: <4D790788.8010305@mrtech.ru> Message-ID: <4D794A34.4090900@gmail.com> I use: if Rails.cache.is_a?(ActiveSupport::Cache::MemCacheStore) Rails.cache.instance_variable_get(:@data).reset end Cheers, Lawrence > What is a right code for resetting memcache connection in after_fork > for Rails 2.3 with "preload_app true" on REE? > > The only configurations about memcache in my app are: > > config/initializers/session_store.rb: > ActionController::Base.session_store = :mem_cache_store > > config/environment.rb: > config.cache_store = :mem_cache_store > > > I tried: > Rails.cache.reset > > But it fails to start, looks like this code is for Rails3 only > _______________________________________________ > Unicorn mailing list - mongrel-unicorn at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-unicorn > Do not quote signatures (like this one) or top post when replying > From cliftonk at gmail.com Thu Mar 10 17:14:27 2011 From: cliftonk at gmail.com (Clifton King) Date: Thu, 10 Mar 2011 16:14:27 -0600 Subject: Memcache reset on rails 2.3 with preload In-Reply-To: <20110310212310.GA7801@dcvr.yhbt.net> References: <4D790788.8010305@mrtech.ru> <20110310212310.GA7801@dcvr.yhbt.net> Message-ID: Eric, No, I'm using the "memcached" gem which has a binding for libmemcached (and is much faster than the memcache-client gem). The memcached gem has a compatibility wrapper (Memcached::Rails) which is made to be backwards compatible with memcache-client. Clifton On Thu, Mar 10, 2011 at 3:23 PM, Eric Wong wrote: > Troex Nevelin wrote: >> What is a right code for resetting memcache connection in after_fork for >> Rails 2.3 with "preload_app true" on REE? >> >> The only configurations about memcache in my app are: >> >> config/initializers/session_store.rb: >> ActionController::Base.session_store = :mem_cache_store >> >> config/environment.rb: >> config.cache_store = :mem_cache_store > > So that uses the memcache-client gem? ?I seem to remember that (and > dalli) only connects when it's needed, but I suppose some apps use > memcached at load time. > > The following should work, not the most elegant: > > ?before_fork do |server,worker| > ? ?ObjectSpace.each_object(MemCache) { |mc| mc.reset } > ?end > > An after_fork would probably send unnecessary messages to the memcached > servers. > >> I tried: >> Rails.cache.reset >> >> But it fails to start, looks like this code is for Rails3 only > > Hopefully somebody else knows a more elegant way to handle this. > > -- > Eric Wong > _______________________________________________ > Unicorn mailing list - mongrel-unicorn at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-unicorn > Do not quote signatures (like this one) or top post when replying > From empresamaravilha at hotmail.com Sat Mar 12 07:13:16 2011 From: empresamaravilha at hotmail.com (Vascon) Date: Sat, 12 Mar 2011 09:13:16 -0300 Subject: VOCÊ GOSTA DE INTERNET? Message-ID: VOC? GOSTA DE INTERNET? J? ganhou algum dinheiro com ela? Trabalhe em suas horas vagas, sem atrapalhar sua atual ocupa??o. SUPER HONESTO! MUITO LUCRATIVO! SIMPLES! N?O PRECISA INSTALAR NADA! Sem Consumir Produtos ou Fazer Reuni?es. N?O TEM MENSALIDADES! Ficou curioso? Acesse e descubra... www.macleusrendaextra.com.br/3905 From normalperson at yhbt.net Tue Mar 15 08:32:41 2011 From: normalperson at yhbt.net (Eric Wong) Date: Tue, 15 Mar 2011 12:32:41 +0000 Subject: [ANN] unicorn 3.5.0 - very minor improvements Message-ID: <20110315123241.GA11932@dcvr.yhbt.net> Changes: A small set of small changes but it's been more than a month since our last release. There are minor memory usage and efficiently improvements (for graceful shutdowns). MRI 1.8.7 users on *BSD should be sure they're using the latest patchlevel (or upgrade to 1.9.x) because we no longer workaround their broken stdio (that's MRI's job :) * http://unicorn.bogomips.org/ * mongrel-unicorn at rubyforge.org * git://bogomips.org/unicorn.git -- Eric Wong From normalperson at yhbt.net Tue Mar 15 19:48:36 2011 From: normalperson at yhbt.net (Eric Wong) Date: Tue, 15 Mar 2011 16:48:36 -0700 Subject: Anybody running any Unicorn 3.x versions? Message-ID: <20110315234836.GA22839@dcvr.yhbt.net> Just wondering, are most people still using 1.1.x or have you started using 3.x, yet? If you're using Ruby 1.9.2, I expect 3.x to be better (unless you have other things constantly wiping away your method cache ..)[1] I've only heard a little feedback regarding breakage[2], so either nobody's running it or it just works :) [1] backport r28813 and r29673 in Ruby trunk to prevent that [2] portability issues due to Kgio, but those are fixed -- Eric Wong From ghazel at gmail.com Tue Mar 15 21:27:01 2011 From: ghazel at gmail.com (Greg Hazel) Date: Tue, 15 Mar 2011 18:27:01 -0700 Subject: Anybody running any Unicorn 3.x versions? In-Reply-To: <20110315234836.GA22839@dcvr.yhbt.net> References: <20110315234836.GA22839@dcvr.yhbt.net> Message-ID: <-530372658282867050@unknownmsgid> Running Unicorn 3 here, the one you just released, on REE 1.8.7 in production with no problems. -Greg On Mar 15, 2011, at 6:23 PM, Eric Wong wrote: > Just wondering, are most people still using 1.1.x or have you started > using 3.x, yet? If you're using Ruby 1.9.2, I expect 3.x to be better > (unless you have other things constantly wiping away your method cache > ..)[1] > > I've only heard a little feedback regarding breakage[2], > so either nobody's running it or it just works :) > > [1] backport r28813 and r29673 in Ruby trunk to prevent that > [2] portability issues due to Kgio, but those are fixed > > -- > Eric Wong > _______________________________________________ > Unicorn mailing list - mongrel-unicorn at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-unicorn > Do not quote signatures (like this one) or top post when replying From cliftonk at gmail.com Tue Mar 15 21:59:24 2011 From: cliftonk at gmail.com (Clifton King) Date: Tue, 15 Mar 2011 20:59:24 -0500 Subject: Anybody running any Unicorn 3.x versions? In-Reply-To: <-530372658282867050@unknownmsgid> References: <20110315234836.GA22839@dcvr.yhbt.net> <-530372658282867050@unknownmsgid> Message-ID: Running unicorn 3.4 on 1.8.7. On Tue, Mar 15, 2011 at 8:27 PM, Greg Hazel wrote: > Running Unicorn 3 here, the one you just released, on REE 1.8.7 in > production with no problems. > > -Greg > > On Mar 15, 2011, at 6:23 PM, Eric Wong wrote: > >> Just wondering, are most people still using 1.1.x or have you started >> using 3.x, yet? ?If you're using Ruby 1.9.2, I expect 3.x to be better >> (unless you have other things constantly wiping away your method cache >> ..)[1] >> >> I've only heard a little feedback regarding breakage[2], >> so either nobody's running it or it just works :) >> >> [1] backport r28813 and r29673 in Ruby trunk to prevent that >> [2] portability issues due to Kgio, but those are fixed >> >> -- >> Eric Wong >> _______________________________________________ >> Unicorn mailing list - mongrel-unicorn at rubyforge.org >> http://rubyforge.org/mailman/listinfo/mongrel-unicorn >> Do not quote signatures (like this one) or top post when replying > _______________________________________________ > Unicorn mailing list - mongrel-unicorn at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-unicorn > Do not quote signatures (like this one) or top post when replying > From normalperson at yhbt.net Fri Mar 18 14:09:02 2011 From: normalperson at yhbt.net (Eric Wong) Date: Fri, 18 Mar 2011 11:09:02 -0700 Subject: [ANN] raindrops updates (mainly for Linux users) Message-ID: <20110318180902.GA6076@dcvr.yhbt.net> I figured I should cross post here. raindrops (listen queue stats package for Unicorn/Rainbows!) has gotten some largish updates over the past few weeks: raindrops 0.5.0 release announcement: http://mid.gmane.org/20110317033547.GA30653 at dcvr.yhbt.net demo site changes (will probably be in 0.6.0 soon): http://mid.gmane.org/20110318094637.GA3526 at dcvr.yhbt.net Feedback would be greatly appreciated (either here or raindrops at librelist.com). There are no backwards-incompatible changes for existing users as far as I'm aware of. Thanks for reading! -- Eric Wong From chenggn at gmail.com Mon Mar 21 03:37:50 2011 From: chenggn at gmail.com (Guang-Nan Cheng) Date: Mon, 21 Mar 2011 15:37:50 +0800 Subject: Does unicorn support mount the webapp with a prefix like Thin does? In-Reply-To: References: Message-ID: For example, I have a webapp that handles /welcome. Does unicorn support to mount the entire webapp at /prefix so request to /prefix/welcome are?handled? From edhoprima at gmail.com Mon Mar 21 04:34:35 2011 From: edhoprima at gmail.com (Edho P Arief) Date: Mon, 21 Mar 2011 15:34:35 +0700 Subject: Does unicorn support mount the webapp with a prefix like Thin does? In-Reply-To: References: Message-ID: On Mon, Mar 21, 2011 at 2:37 PM, Guang-Nan Cheng wrote: > For example, I have a webapp that handles /welcome. > > Does unicorn support to mount the entire webapp at /prefix so request > to /prefix/welcome are?handled? yes, it does. I don't remember exactly how though as my main server is currently offline (it has the config and all). Probably using --path or something. From normalperson at yhbt.net Mon Mar 21 12:14:10 2011 From: normalperson at yhbt.net (Eric Wong) Date: Mon, 21 Mar 2011 09:14:10 -0700 Subject: Does unicorn support mount the webapp with a prefix like Thin does? In-Reply-To: References: Message-ID: <20110321161410.GA26947@dcvr.yhbt.net> Guang-Nan Cheng wrote: > For example, I have a webapp that handles /welcome. > > Does unicorn support to mount the entire webapp at /prefix so request > to /prefix/welcome are?handled? Yes, all Rack servers that support rackup (config.ru) files can do it: map "/prefix" do use Rack::Chunked run WelcomeApp.new end # ... map "/lobster" do use Rack::Lint run Rack::Lobster.new end # You can do virtual hosts, too: map "http://example.com/" do run ExampleApp.new end See the Rack::Builder and Rack::URLMap RDoc for more info. -- Eric Wong From david at zendesk.com Tue Mar 22 15:19:36 2011 From: david at zendesk.com (David Nghiem) Date: Tue, 22 Mar 2011 12:19:36 -0700 Subject: unicorn 1.1.x never-ending listen loop IOError exceptions Message-ID: We run unicorn 1.1.5 behind nginx under Ruby Enterprise Edition 2011.02. We're using UNIX sockets instead of TCP sockets. Once in a while, one worker will throw exceptions in a loop, taking up lots of CPU and log space. Killing the worker removes the problem. Other workers are not affected. Here's the exception: E, [2011-01-10T10:13:13.518795 #15209] ERROR -- : Unhandled listen loop exception #. E, [2011-01-10T10:13:13.518881 #15209] ERROR -- : /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/unicorn-1.1.5/lib/unicorn.rb:732:in `select' /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/unicorn-1.1.5/lib/unicorn.rb:732:in `worker_loop' /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/newrelic_rpm-2.13.1/lib/new_relic/control/../agent/instrumentation/unicorn_instrumentation.rb:7:in `call' /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/newrelic_rpm-2.13.1/lib/new_relic/control/../agent/instrumentation/unicorn_instrumentation.rb:7:in `worker_loop' /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/unicorn-1.1.5/lib/unicorn.rb:603:in `spawn_missing_workers' /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/unicorn-1.1.5/lib/unicorn.rb:600:in `fork' /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/unicorn-1.1.5/lib/unicorn.rb:600:in `spawn_missing_workers' /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/unicorn-1.1.5/lib/unicorn.rb:596:in `each' /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/unicorn-1.1.5/lib/unicorn.rb:596:in `spawn_missing_workers' /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/unicorn-1.1.5/lib/unicorn.rb:610:in `maintain_worker_count' /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/unicorn-1.1.5/lib/unicorn.rb:407:in `join' /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/unicorn-1.1.5/lib/unicorn.rb:395:in `loop' /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/unicorn-1.1.5/lib/unicorn.rb:395:in `join' /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/unicorn-1.1.5/lib/unicorn.rb:29:in `run' /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/unicorn-1.1.5/bin/unicorn_rails:210 /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/bin/unicorn_rails:19:in `load' /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/bin/unicorn_rails:19 I don't get any other exceptions. I've found other people have this "IOError: closed stream" error coupled with "Errno::EMFILE" but we have plenty of file-descriptors left. Here's an lsof dump of the worker: COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME ruby 15209 zendesk cwd DIR 252,0 4096 2940970 /data/zendesk/releases/alpha ruby 15209 zendesk rtd DIR 8,1 4096 2 / ruby 15209 zendesk txt REG 8,1 2831149 246513 /usr/local/rvm/rubies/ree-1.8.7-2010.02/bin/ruby ruby 15209 zendesk mem REG 8,1 10192 146145 /usr/lib/gconv/ISO8859-1.so ruby 15209 zendesk mem REG 8,1 22848 263831 /lib/libnss_dns-2.9.so ruby 15209 zendesk mem REG 8,1 9760 260915 /lib/libnss_mdns4_minimal.so.2 ruby 15209 zendesk mem REG 8,1 43472 263939 /lib/libnss_nis-2.9.so ruby 15209 zendesk mem REG 8,1 35632 263929 /lib/libnss_compat-2.9.so ruby 15209 zendesk mem REG 8,1 51616 263934 /lib/libnss_files-2.9.so ruby 15209 zendesk mem REG 252,0 35772 3377231 /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/em-http-request-0.2.7/lib/em_buffer.so ruby 15209 zendesk mem REG 252,0 45360 3377237 /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/em-http-request-0.2.7/lib/http11_client.so ruby 15209 zendesk mem REG 252,0 1175256 3377180 /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/eventmachine-0.12.10/lib/rubyeventmachine.so ruby 15209 zendesk mem REG 8,1 35184 155430 /usr/lib/sasl2/libntlm.so.2.0.22 ruby 15209 zendesk mem REG 8,1 18672 155418 /usr/lib/sasl2/libanonymous.so.2.0.22 ruby 15209 zendesk mem REG 8,1 18672 155421 /usr/lib/sasl2/libcrammd5.so.2.0.22 ruby 15209 zendesk mem REG 8,1 18640 155433 /usr/lib/sasl2/libplain.so.2.0.22 ruby 15209 zendesk mem REG 8,1 18640 155427 /usr/lib/sasl2/liblogin.so.2.0.22 ruby 15209 zendesk mem REG 8,1 1297736 140958 /usr/lib/libdb-4.6.so ruby 15209 zendesk mem REG 8,1 22616 155410 /usr/lib/sasl2/libsasldb.so.2.0.22 ruby 15209 zendesk mem REG 8,1 52000 155424 /usr/lib/sasl2/libdigestmd5.so.2.0.22 ruby 15209 zendesk mem REG 8,1 88824 263949 /lib/libresolv-2.9.so ruby 15209 zendesk mem REG 8,1 105760 139781 /usr/lib/libsasl2.so.2.0.22 ruby 15209 zendesk mem REG 252,0 4110920 3384825 /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/memcached-0.20.1/lib/rlibmemcached.so ruby 15209 zendesk mem REG 8,1 97168 263938 /lib/libnsl-2.9.so ruby 15209 zendesk mem REG 8,1 2086600 145819 /usr/lib/libmysqlclient.so.15.0.0 ruby 15209 zendesk mem REG 252,0 169011 3385005 /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/mysql-2.8.1/lib/mysql_api.so ruby 15209 zendesk mem REG 252,0 150950 3401474 /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/yajl-ruby-0.7.6/lib/yajl_ext.so ruby 15209 zendesk mem REG 252,0 29311 3367472 /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/SystemTimer-1.2/lib/system_timer_native.so ruby 15209 zendesk mem REG 8,1 13144 260768 /lib/libgpg-error.so.0.3.0 ruby 15209 zendesk mem REG 8,1 422664 260765 /lib/libgcrypt.so.11.4.4 ruby 15209 zendesk mem REG 8,1 1425368 141140 /usr/lib/libxml2.so.2.6.32 ruby 15209 zendesk mem REG 8,1 233152 439848 /usr/lib/libxslt.so.1.1.24 ruby 15209 zendesk mem REG 8,1 80792 439847 /usr/lib/libexslt.so.0.8.13 ruby 15209 zendesk mem REG 252,0 417564 3385563 /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/nokogiri-1.4.1/lib/nokogiri/nokogiri.so ruby 15209 zendesk mem REG 8,1 14220 252540 /usr/local/rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/x86_64-linux/digest/md5.so ruby 15209 zendesk mem REG 8,1 42715 252537 /usr/local/rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/x86_64-linux/racc/cparse.so ruby 15209 zendesk mem REG 252,0 121676 3465790 /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/json-1.4.6/ext/json/ext/json/ext/generator.so ruby 15209 zendesk mem REG 252,0 52561 3465795 /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/json-1.4.6/ext/json/ext/json/ext/parser.so ruby 15209 zendesk mem REG 252,0 20227 3401531 /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/fast_xs-0.7.3/lib/fast_xs.so ruby 15209 zendesk mem REG 8,1 46499 255504 /usr/local/rvm/rubies/ree-1.8.7-2010.02/lib/ruby/site_ruby/1.8/x86_64-linux/iconv.so ruby 15209 zendesk mem REG 8,1 139431 247137 /usr/local/rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/x86_64-linux/bigdecimal.so ruby 15209 zendesk mem REG 8,1 433200 247152 /usr/local/rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/x86_64-linux/nkf.so ruby 15209 zendesk mem REG 252,0 106488 3531787 /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/unicorn-1.1.5/lib/unicorn_http.so ruby 15209 zendesk mem REG 8,1 53645 247158 /usr/local/rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/x86_64-linux/strscan.so ruby 15209 zendesk mem REG 8,1 128208 247138 /usr/local/rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/x86_64-linux/socket.so ruby 15209 zendesk mem REG 8,1 12144 247141 /usr/local/rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/x86_64-linux/fcntl.so ruby 15209 zendesk mem REG 8,1 329504 260852 /lib/libssl.so.0.9.8 ruby 15209 zendesk mem REG 8,1 1002954 247156 /usr/local/rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/x86_64-linux/openssl.so ruby 15209 zendesk mem REG 8,1 110815 247146 /usr/local/rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/x86_64-linux/zlib.so ruby 15209 zendesk mem REG 8,1 35684 247140 /usr/local/rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/x86_64-linux/digest.so ruby 15209 zendesk mem REG 8,1 96768 260746 /lib/libz.so.1.2.3.3 ruby 15209 zendesk mem REG 8,1 1594824 260668 /lib/libcrypto.so.0.9.8 ruby 15209 zendesk mem REG 8,1 15204 252539 /usr/local/rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/x86_64-linux/digest/sha1.so ruby 15209 zendesk mem REG 8,1 12723 247159 /usr/local/rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/x86_64-linux/rational.so ruby 15209 zendesk mem REG 8,1 351320 247142 /usr/local/rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/x86_64-linux/syck.so ruby 15209 zendesk mem REG 8,1 57484 247154 /usr/local/rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/x86_64-linux/stringio.so ruby 15209 zendesk mem REG 8,1 29818 247150 /usr/local/rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/x86_64-linux/etc.so ruby 15209 zendesk mem REG 8,1 51878 247139 /usr/local/rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/x86_64-linux/thread.so ruby 15209 zendesk mem REG 8,1 130151 263933 /lib/libpthread-2.9.so ruby 15209 zendesk mem REG 8,1 96560 260672 /lib/libgcc_s.so.1 ruby 15209 zendesk mem REG 8,1 1023448 139822 /usr/lib/libstdc++.so.6.0.10 ruby 15209 zendesk mem REG 8,1 1502512 263944 /lib/libc-2.9.so ruby 15209 zendesk mem REG 8,1 542928 263942 /lib/libm-2.9.so ruby 15209 zendesk mem REG 8,1 39112 263932 /lib/libcrypt-2.9.so ruby 15209 zendesk mem REG 8,1 14608 263945 /lib/libdl-2.9.so ruby 15209 zendesk mem REG 8,1 31656 263930 /lib/librt-2.9.so ruby 15209 zendesk mem REG 8,1 728968 246427 /usr/local/rvm/rubies/ree-1.8.7-2010.02/lib/libtcmalloc_minimal.so.0.0.0 ruby 15209 zendesk mem REG 8,1 135680 263936 /lib/ld-2.9.so ruby 15209 zendesk mem REG 8,1 26048 139155 /usr/lib/gconv/gconv-modules.cache ruby 15209 zendesk 0r CHR 1,3 3125 /dev/null ruby 15209 zendesk 1w REG 252,0 0 3015360 /data/zendesk/log/unicorn.stdout.log ruby 15209 zendesk 2w REG 252,0 24585 3015203 /data/zendesk/log/unicorn.stderr.log-20110110 (deleted) ruby 15209 zendesk 3w REG 252,0 61617590073 3015097 /data/zendesk/log/unicorn.log-20110110 (deleted) ruby 15209 zendesk 5u unix 0xffff88043bdf9080 49439 /var/run/zendesk/unicorn.sock ruby 15209 zendesk 6w FIFO 0,6 5651378 pipe ruby 15209 zendesk 7w REG 252,0 0 3015676 /data/zendesk/log/newrelic_agent.log ruby 15209 zendesk 8w REG 252,0 68330048 3015673 /data/zendesk/log/production.log ruby 15209 zendesk 9w REG 252,0 0 3015677 /data/zendesk/log/resque.log ruby 15209 zendesk 10u IPv4 41707462 TCP 192.168.100.148:49364->192.168.100.183:mysql (ESTABLISHED) ruby 15209 zendesk 11w REG 252,0 0 3015672 /data/zendesk/log/mail_processing_production.log ruby 15209 zendesk 12u IPv4 55517 TCP 192.168.100.148:60198->192.168.100.182:mysql (ESTABLISHED) ruby 15209 zendesk 13u IPv4 55521 TCP 192.168.100.148:42351->192.168.100.150:11211 (ESTABLISHED) ruby 15209 zendesk 14u IPv4 55523 TCP 192.168.100.148:52409->192.168.100.148:11211 (ESTABLISHED) ruby 15209 zendesk 15u IPv4 56105 TCP 192.168.100.148:58562->192.168.100.140:11211 (ESTABLISHED) ruby 15209 zendesk 16u IPv4 56108 TCP 192.168.100.148:50500->192.168.100.144:11211 (ESTABLISHED) ruby 15209 zendesk 17u IPv4 56110 TCP 192.168.100.148:46723->192.168.100.142:11211 (ESTABLISHED) ruby 15209 zendesk 18u IPv4 56137 TCP 192.168.100.148:49568->192.168.100.146:11211 (ESTABLISHED) ruby 15209 zendesk 19u IPv4 5845535 TCP 192.168.100.148:43836->192.168.100.183:mysql (ESTABLISHED) ruby 15209 zendesk 20u IPv4 63603 TCP 192.168.100.148:41990->192.168.100.149:6379 (ESTABLISHED) ruby 15209 zendesk 21u REG 8,1 0 90084 /tmp/0.961990208371916 (deleted) ruby 15209 zendesk 22u IPv4 10795792 TCP 192.168.100.148:34587->192.168.100.183:mysql (ESTABLISHED) ruby 15209 zendesk 23u IPv4 33013892 TCP 192.168.100.148:54382->192.168.100.183:mysql (ESTABLISHED) I'm tempted to exit the worker when I get this exception N number of times as a workaround; it tends to only happen when I'm sleeping =) From normalperson at yhbt.net Tue Mar 22 17:39:05 2011 From: normalperson at yhbt.net (Eric Wong) Date: Tue, 22 Mar 2011 14:39:05 -0700 Subject: unicorn 1.1.x never-ending listen loop IOError exceptions In-Reply-To: References: Message-ID: <20110322213905.GA23207@dcvr.yhbt.net> David Nghiem wrote: > We run unicorn 1.1.5 behind nginx under Ruby Enterprise Edition > 2011.02. We're using UNIX sockets instead of TCP sockets. > > Once in a while, one worker will throw exceptions in a loop, taking up > lots of CPU and log space. Killing the worker removes the problem. > Other workers are not affected. > > Here's the exception: > > E, [2011-01-10T10:13:13.518795 #15209] ERROR -- : Unhandled listen > loop exception #. > E, [2011-01-10T10:13:13.518881 #15209] ERROR -- : > /data/zendesk/releases/alpha/vendor/bundle/ruby/1.8/gems/unicorn-1.1.5/lib/unicorn.rb:732:in > `select' > > I don't get any other exceptions. I've found other people have this > "IOError: closed stream" error coupled with "Errno::EMFILE" but we > have plenty of file-descriptors left. No Errno::EBADF errors at all? > Here's an lsof dump of the worker: > > COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME It looks like log reopening failed, below: > ruby 15209 zendesk 1w REG 252,0 0 > 3015360 /data/zendesk/log/unicorn.stdout.log > ruby 15209 zendesk 2w REG 252,0 24585 > 3015203 /data/zendesk/log/unicorn.stderr.log-20110110 (deleted) > ruby 15209 zendesk 3w REG 252,0 61617590073 > 3015097 /data/zendesk/log/unicorn.log-20110110 (deleted) Permissions issue during log rotation? Are you doing "killall -USR1 unicorn" by any chance or sending a bunch of USR1 signals faster than unicorn can process them? Try just sending one USR1 to the master process and letting the master signal the workers. -- Eric Wong From david at zendesk.com Tue Mar 22 20:04:48 2011 From: david at zendesk.com (David Nghiem) Date: Tue, 22 Mar 2011 17:04:48 -0700 Subject: unicorn 1.1.x never-ending listen loop IOError exceptions In-Reply-To: <20110322213905.GA23207@dcvr.yhbt.net> References: <20110322213905.GA23207@dcvr.yhbt.net> Message-ID: On Tue, Mar 22, 2011 at 2:39 PM, Eric Wong wrote: >> I don't get any other exceptions. ?I've found other people have this >> "IOError: closed stream" error coupled with "Errno::EMFILE" but we >> have plenty of file-descriptors left. > > No Errno::EBADF errors at all? I didn't check before or after the block of Errno::IOError errors, there were enough IOError logs to fill up 40gb of disk. I'll capture the entire deleted log next time. > ?It looks like log reopening failed, below: > >> ruby ? ?15209 zendesk ? ?1w ? REG ? ? ? ? ? ? ?252,0 ? ? ? ? ? 0 >> 3015360 /data/zendesk/log/unicorn.stdout.log >> ruby ? ?15209 zendesk ? ?2w ? REG ? ? ? ? ? ? ?252,0 ? ? ? 24585 >> 3015203 /data/zendesk/log/unicorn.stderr.log-20110110 (deleted) >> ruby ? ?15209 zendesk ? ?3w ? REG ? ? ? ? ? ? ?252,0 61617590073 >> 3015097 /data/zendesk/log/unicorn.log-20110110 (deleted) > > Permissions issue during log rotation? ?Are you doing "killall -USR1 > unicorn" by any chance or sending a bunch of USR1 signals faster than > unicorn can process them? > > Try just sending one USR1 to the master process and letting the master > signal the workers. We rotate logs once a night using logrotate. There's a post-rotate hook that sends USR1 once to the master. There are three log files but logrotate is run with the sharedscripts option so only one hook runs. The log dirs and unicorn processes are run as the same non-root user. I'll run an lsof on the healthy workers next time to see if they have the same deleted log file descriptors. Are the IOError exceptions and failure to rotate logs related? My wild guess was this specific worker's unix socket got corrupted somehow. From normalperson at yhbt.net Tue Mar 22 21:09:35 2011 From: normalperson at yhbt.net (Eric Wong) Date: Wed, 23 Mar 2011 01:09:35 +0000 Subject: unicorn 1.1.x never-ending listen loop IOError exceptions In-Reply-To: References: <20110322213905.GA23207@dcvr.yhbt.net> Message-ID: <20110323010935.GA25934@dcvr.yhbt.net> David Nghiem wrote: > On Tue, Mar 22, 2011 at 2:39 PM, Eric Wong wrote: > > No Errno::EBADF errors at all? > > I didn't check before or after the block of Errno::IOError errors, > there were enough IOError logs to fill up 40gb of disk. I'll capture > the entire deleted log next time. Yikes. The first few lines of error messages should be enough. > >> ruby ? ?15209 zendesk ? ?1w ? REG ? ? ? ? ? ? ?252,0 ? ? ? ? ? 0 > >> 3015360 /data/zendesk/log/unicorn.stdout.log > >> ruby ? ?15209 zendesk ? ?2w ? REG ? ? ? ? ? ? ?252,0 ? ? ? 24585 > >> 3015203 /data/zendesk/log/unicorn.stderr.log-20110110 (deleted) > >> ruby ? ?15209 zendesk ? ?3w ? REG ? ? ? ? ? ? ?252,0 61617590073 > >> 3015097 /data/zendesk/log/unicorn.log-20110110 (deleted) > > > > Permissions issue during log rotation? ?Are you doing "killall -USR1 > > unicorn" by any chance or sending a bunch of USR1 signals faster than > > unicorn can process them? > > > > Try just sending one USR1 to the master process and letting the master > > signal the workers. > > Are the IOError exceptions and failure to rotate logs related? My > wild guess was this specific worker's unix socket got corrupted > somehow. There's a good possibility. The USR1 signal closes a pipe we normally select() on. The closed pipe triggers a wakeup from select(), which triggers the log reopening (and reopening of the pipe). Do you see: "worker=$NUM done reopening logs" messages in your logs? Another explanation is somehow you have a library that does something along the lines of: ObjectSpace.each_object(IO) { |io| io.close unless io.closed? } -- Eric Wong From list at mrtech.ru Wed Mar 23 14:12:13 2011 From: list at mrtech.ru (Troex Nevelin) Date: Wed, 23 Mar 2011 21:12:13 +0300 Subject: [ANN] raindrops updates (mainly for Linux users) In-Reply-To: <20110318180902.GA6076@dcvr.yhbt.net> References: <20110318180902.GA6076@dcvr.yhbt.net> Message-ID: <4D8A37FD.6010807@mrtech.ru> On 03/18/2011 09:09 PM, Eric Wong wrote: > I figured I should cross post here. raindrops (listen queue stats > package for Unicorn/Rainbows!) has gotten some largish updates over the > past few weeks: > > raindrops 0.5.0 release announcement: > http://mid.gmane.org/20110317033547.GA30653 at dcvr.yhbt.net > > demo site changes (will probably be in 0.6.0 soon): > http://mid.gmane.org/20110318094637.GA3526 at dcvr.yhbt.net > > Feedback would be greatly appreciated (either here or > raindrops at librelist.com). There are no backwards-incompatible changes > for existing users as far as I'm aware of. This update is really great! Now we can see 'Mean' users awaiting for their requests to be served - this information is very useful, because we now can calculate avarage wait time for each request. For example we know that an average request time is 0.15 sec, than if our mean queue is 32 requests, each request will be served in (32+1)*0.15=4.95 seconds. This information is very useful and even NewRelics cannot provide it. I'm going to build graphs for this data. You can see live stats for 700k request per day project running on 2x Xeon E5410 2.33 Ghz (4 cores each): http://kinokopilka.tv:9292/queued/%2Fvar%2Fwww%2Fkk%2Fcurrent%2Ftmp%2Fsockets%2Funicorn.sock.html From list at mrtech.ru Wed Mar 23 14:25:58 2011 From: list at mrtech.ru (Troex Nevelin) Date: Wed, 23 Mar 2011 21:25:58 +0300 Subject: Memcache reset on rails 2.3 with preload In-Reply-To: <4D794A34.4090900@gmail.com> References: <4D790788.8010305@mrtech.ru> <4D794A34.4090900@gmail.com> Message-ID: <4D8A3B36.4000600@mrtech.ru> On 03/11/2011 01:01 AM, Lawrence Pit wrote: > I use: > > if Rails.cache.is_a?(ActiveSupport::Cache::MemCacheStore) > Rails.cache.instance_variable_get(:@data).reset > end Thanks a lot, that is exactly what I needed From list at mrtech.ru Wed Mar 23 15:27:56 2011 From: list at mrtech.ru (Troex Nevelin) Date: Wed, 23 Mar 2011 22:27:56 +0300 Subject: [ANN] raindrops updates (mainly for Linux users) In-Reply-To: <4D8A37FD.6010807@mrtech.ru> References: <20110318180902.GA6076@dcvr.yhbt.net> <4D8A37FD.6010807@mrtech.ru> Message-ID: <4D8A49BC.1080903@mrtech.ru> On 03/23/2011 09:12 PM, Troex Nevelin wrote: > For example we know that an average response time is 0.15 sec, than if > our mean queue is 32 requests, each request will be served in > (32+1)*0.15=4.95 seconds. Probably it should be: ((mean_queue + 1) * avg_response_time) / workers so in my example it would be: ((32 + 1) * 0.15) / 8 =~ 0.62 sec From normalperson at yhbt.net Wed Mar 23 18:26:29 2011 From: normalperson at yhbt.net (Eric Wong) Date: Wed, 23 Mar 2011 15:26:29 -0700 Subject: [ANN] raindrops updates (mainly for Linux users) In-Reply-To: <4D8A37FD.6010807@mrtech.ru> References: <20110318180902.GA6076@dcvr.yhbt.net> <4D8A37FD.6010807@mrtech.ru> Message-ID: <20110323222629.GB26826@dcvr.yhbt.net> Troex Nevelin wrote: > This update is really great! Awesome, your feedback is much appreciated. I'll forward a link to your posts to the raindrops list. -- Eric Wong From normalperson at yhbt.net Tue Mar 29 12:24:44 2011 From: normalperson at yhbt.net (Eric Wong) Date: Tue, 29 Mar 2011 09:24:44 -0700 Subject: unicorn 1.1.x never-ending listen loop IOError exceptions In-Reply-To: References: <20110322213905.GA23207@dcvr.yhbt.net> <20110323010935.GA25934@dcvr.yhbt.net> Message-ID: <20110329162444.GA12293@dcvr.yhbt.net> David Nghiem wrote: > I'm wondering if the problem is three logs for unicorn (unicorn.log, and the > stdout, stderr logs) are rotated by logrotate, but the first log triggers > the USR1 and in the middle of rotating the remaining logs, the unicorn log > reopening gets confused. > > I'll make it so the USR1 signal is sent after all three logs have been > rotated. Let this run for a couple months and report back. That could be it. logrotate (without the scary/expensive "copytruncate" option) works very quickly for individual files. Do you have the "sharedscripts" option in logrotate enabled? You should enable "sharedscripts" I should post a logrotate example config so other users don't run into the same problem... > Thanks, Eric, for your help. I've been running unicorn since the pre-1.0 > days and it's my favorite ruby software. Good to know! -- Eric Wong From normalperson at yhbt.net Tue Mar 29 12:54:58 2011 From: normalperson at yhbt.net (Eric Wong) Date: Tue, 29 Mar 2011 09:54:58 -0700 Subject: [PATCH] add examples/logrotate.conf In-Reply-To: <20110329162444.GA12293@dcvr.yhbt.net> References: <20110322213905.GA23207@dcvr.yhbt.net> <20110323010935.GA25934@dcvr.yhbt.net> <20110329162444.GA12293@dcvr.yhbt.net> Message-ID: <20110329165458.GA14389@dcvr.yhbt.net> Eric Wong wrote: > That could be it. logrotate (without the scary/expensive > "copytruncate" option) works very quickly for individual files. Do you > have the "sharedscripts" option in logrotate enabled? You should enable > "sharedscripts" I actually went with lastaction in my example (I keep forgetting it over the years and going to postrotate + sharedscripts for some reason..) > I should post a logrotate example config so other users don't run into > the same problem... http://unicorn.bogomips.org/examples/logrotate.conf and pushed this out to unicorn.git >From c1ebb313735a280582d87c1ba44619aa47e00b06 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 29 Mar 2011 09:47:26 -0700 Subject: [PATCH] add examples/logrotate.conf logrotate is the de facto tool for logrotation, so an example config for highlighting important parts are in order. Since our USR1 signal handling is part of the crusade against the slow and lossy "copytruncate" option, be sure to emphasize that :) --- examples/logrotate.conf | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+), 0 deletions(-) create mode 100644 examples/logrotate.conf diff --git a/examples/logrotate.conf b/examples/logrotate.conf new file mode 100644 index 0000000..03fefc6 --- /dev/null +++ b/examples/logrotate.conf @@ -0,0 +1,29 @@ +# example logrotate config file, I usually keep this in +# /etc/logrotate.d/unicorn_app on my Debian systems +# +# See the logrotate(8) manpage for more information: +# http://linux.die.net/man/8/logrotate + +# Modify the following glob to match the logfiles your app writes to: +/var/log/unicorn_app/*.log { + # this first block is mostly just personal preference, though + # I wish logrotate offered an "hourly" option... + daily + missingok + rotate 180 + compress # must use with delaycompress below + dateext + + # this is important if using "compress" since we need to call + # the "lastaction" script below before compressing: + delaycompress + + # note the lack of the evil "copytruncate" option in this + # config. Unicorn supports the USR1 signal and we send it + # as our "lastaction" action: + lastaction + # assuming your pid file is in /var/run/unicorn_app/pid + pid=/var/run/unicorn_app/pid + test -s $pid && kill -USR1 "$(cat $pid)" + endscript +} -- Eric Wong From list at mrtech.ru Wed Mar 30 07:48:21 2011 From: list at mrtech.ru (Troex Nevelin) Date: Wed, 30 Mar 2011 15:48:21 +0400 Subject: TAG for process list view and start-up-scripts Message-ID: <4D931885.9070605@mrtech.ru> 1. Thin has 'tag' option in config, it is shown process list. This feature was very useful for me, because on servers I run 2 and more unicorn instances it would be nice to identify them fast with one look. 2. It would be nice to have example sh startup scripts come with unicorn. I know they can be very specific but anyway it will help people start using unicorn. From normalperson at yhbt.net Wed Mar 30 13:52:39 2011 From: normalperson at yhbt.net (Eric Wong) Date: Wed, 30 Mar 2011 10:52:39 -0700 Subject: TAG for process list view and start-up-scripts In-Reply-To: <4D931885.9070605@mrtech.ru> References: <4D931885.9070605@mrtech.ru> Message-ID: <20110330175239.GA9877@dcvr.yhbt.net> Troex Nevelin wrote: > 1. Thin has 'tag' option in config, it is shown process list. > This feature was very useful for me, because on servers I > run 2 and more unicorn instances it would be nice to identify > them fast with one look. I won't be supporting something like this because everybody has a different idea of what it should be and it bloats terminals. A similar idea that was rejected in this thread: http://mid.gmane.org/20100702205004.GI4248 at jeremyevans.local In a related thread, Jeremy's monkey patch (which should work for all future/current versions): http://mid.gmane.org/AANLkTimQoEH7QBPn9ppMP-W_kWPi5UyhKwm4jMmSvHlu at mail.gmail.com I only do the "master"/"worker" distinction because it's what nginx users are used to seeing and it can usually fit in argv[0] without needing more space (moving + clobbering environ)[1] > 2. It would be nice to have example sh startup scripts come with > unicorn. I know they can be very specific but anyway it will help > people start using unicorn. Something like examples/init.sh in our source tree? All of the examples/ directories is uploaded to http://unicorn.bogomips.org/examples/ too [1] /proc/$PID/environ under Linux is a sometimes useful debugging tool but broken under Ruby 1.9.2, I'm working on fixing this for 1.9.3 -- Eric Wong From jheiss at aput.net Wed Mar 30 14:19:48 2011 From: jheiss at aput.net (Jason Heiss) Date: Wed, 30 Mar 2011 11:19:48 -0700 Subject: Does unicorn support mount the webapp with a prefix like Thin does? In-Reply-To: References: Message-ID: <90F62515-83A6-4D2F-ABD8-7B60476B9BF6@aput.net> On Mar 21, 2011, at 12:37 AM, Guang-Nan Cheng wrote: > For example, I have a webapp that handles /welcome. > > Does unicorn support to mount the entire webapp at /prefix so request > to /prefix/welcome are handled? If it is a Rails app you can put the following in your unicorn config file: ENV['RAILS_RELATIVE_URL_ROOT'] = '/prefix' From mkocher at pivotallabs.com Thu Mar 31 13:45:32 2011 From: mkocher at pivotallabs.com (Matthew Kocher) Date: Thu, 31 Mar 2011 10:45:32 -0700 Subject: Reopening logs - why no relative paths? Message-ID: We just spend a couple hours trying to figure out why sending a USR1 signal wasn't causing unicorn to reopen logs. Looking at the source reveals that only files opened with absolute paths are eligible for rotation, the others are silently skipped. We use the fairly standard practice of always logging to log/unicorn.error.log and creating symlinks to where we'd like the logs to live on individual hosts. We'll change our configs for the time being, but is there a reason to not reopen the relative paths? Thanks, Matthew From normalperson at yhbt.net Thu Mar 31 18:02:48 2011 From: normalperson at yhbt.net (Eric Wong) Date: Thu, 31 Mar 2011 15:02:48 -0700 Subject: Reopening logs - why no relative paths? In-Reply-To: References: Message-ID: <20110331220248.GA1826@dcvr.yhbt.net> Matthew Kocher wrote: > We just spend a couple hours trying to figure out why sending a USR1 > signal wasn't causing unicorn to reopen logs. Looking at the source > reveals that only files opened with absolute paths are eligible for > rotation, the others are silently skipped. > > We use the fairly standard practice of always logging to > log/unicorn.error.log and creating symlinks to where we'd like the > logs to live on individual hosts. We'll change our configs for the > time being, but is there a reason to not reopen the relative paths? It's ambiguous due to directory changes[1]. It may be easier now that we have the "working_directory" directive now, but configuration changes also change (or unset) the "working_directory" which adds to the confusion. We could try allowing it and see what happens, I suppose... [1] - in my experience with writing daemons, directory changes make everything much harder all around. -- Eric Wong