From boss at airbladesoftware.com Mon Dec 3 14:42:21 2012 From: boss at airbladesoftware.com (Andrew Stewart) Date: Mon, 3 Dec 2012 15:42:21 +0100 Subject: When a client terminates a connection In-Reply-To: <20121130192620.GB29344@dcvr.yhbt.net> References: <20121129230408.GA2618@dcvr.yhbt.net> <20121130192620.GB29344@dcvr.yhbt.net> Message-ID: On 30 Nov 2012, at 20:26, Eric Wong wrote: >> Nginx logged: >> >> x.xxx.xx.xx - - [27/Nov/2012:14:40:28 +0000] "POST /clients/2248 HTTP/1.1" 499 0 "https://example.com/clients/2248/edit" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)" >> x.xxx.xx.xx - - [27/Nov/2012:14:40:29 +0000] "POST /clients/2248 HTTP/1.1" 404 592 "https://example.com/companies/2248/edit" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)" >> >> You can see the first request was terminated by the user. Hot on its >> heels the user tried again and got a 404. > > Weird, and this is the only nginx instance that saw this request? That's right, I only run a single nginx worker process. > Also, according to your logs above, the two requests above came from > different Referer pages, so perhaps there were more requests involved > that hit a different nginx? Bizarre as it sounds, that was a copy-paste mistake on my part. The second referrer should read: "https://example.com/clients/2248/edit". > Odd. It's been a long time since I looked at Rails; but doesn't Rails > log when a request _starts_? Also, doesn't Rails log all DB queries? I think Rails logs when a request starts, then logs some more when the request ends ? but I'm not certain and I couldn't find the answer when I looked in the Rails source. It must be there somewhere. Rails doesn't log the DB queries in production, at least not by default. > Or, by any chance, do you have query logging enabled in your DB to track > this down? Regrettably not. It's a weird problem which I'd like to dismiss, but it's happened on two occasions now. I'm running an old version of Rails (3.0.12) which may or may not be relevant. Hmm. From tony.arcieri at gmail.com Mon Dec 3 23:53:25 2012 From: tony.arcieri at gmail.com (Tony Arcieri) Date: Mon, 3 Dec 2012 15:53:25 -0800 Subject: Fwd: Maintaining capacity during deploys In-Reply-To: <20121130222739.GA13802@dcvr.yhbt.net> References: <20121129233208.GB2618@dcvr.yhbt.net> <20121130222739.GA13802@dcvr.yhbt.net> Message-ID: On Fri, Nov 30, 2012 at 2:27 PM, Eric Wong wrote: > I usually put that logic in the deployment script (probably just > with "curl -sf"), but a background thread would probably work. Are you doing something different than unicornctl restart? It seems like with unicornctl restart 1) our deployment automation doesn't know when the restart has finished, since unicornctl is just sending signals 2) we don't have any way to send requests specifically to the new worker instead of the old one Perhaps I'm misreading the unicorn source code, but here's what I see happening: 1) old unicorn master forks a new master. They share the same TCP listen socket, but only the old master continues accepting requests 2) new master loads the Rails app and runs the before_fork hook. It seems like normally this hook would send SIGQUIT to the new master, causing it to close its TCP listen socket 3) new master forks and begins accepting on the TCP listen socket 4) new workers run the after_fork hook and begin accepting requests It seems like if we remove the logic which reaps the old master in the before_fork hook and attempt to warm the workers in the after_fork hook, then we're stuck in a state where both the old master and new master are accepting requests but the new workers have not yet been warmed up. Is this the case, and if so, is there a way we can prevent the new master from accepting requests until warmup is complete? Or how would we change the way we restart unicorn to support our deployment automation (Capistrano, in this case) handling starting and healthchecking a new set of workers? Would we have to start the new master on a separate port and use e.g. nginx to handle the switchover? Something which doesn't involve massive changes to the way we presently restart Unicorm (i.e. unicornctl restart) would probably be the most practical solution for us. We have a "real solution" for all of these problems in the works. What I'm looking for in the interim is a band-aid. -- Tony Arcieri From normalperson at yhbt.net Tue Dec 4 00:34:16 2012 From: normalperson at yhbt.net (Eric Wong) Date: Tue, 4 Dec 2012 00:34:16 +0000 Subject: Fwd: Maintaining capacity during deploys In-Reply-To: References: <20121129233208.GB2618@dcvr.yhbt.net> <20121130222739.GA13802@dcvr.yhbt.net> Message-ID: <20121204003416.GA20815@dcvr.yhbt.net> Tony Arcieri wrote: > On Fri, Nov 30, 2012 at 2:27 PM, Eric Wong wrote: > > I usually put that logic in the deployment script (probably just > > with "curl -sf"), but a background thread would probably work. > > Are you doing something different than unicornctl restart? It seems > like with unicornctl restart I'm actually not sure what "unicornctl" is... Is it this? https://gist.github.com/1207003 I normally use a shell script (similar to examples/init.sh) in the unicorn source tree. > 1) our deployment automation doesn't know when the restart has > finished, since unicornctl is just sending signals > 2) we don't have any way to send requests specifically to the new > worker instead of the old one > > Perhaps I'm misreading the unicorn source code, but here's what I see happening: > > 1) old unicorn master forks a new master. They share the same TCP > listen socket, but only the old master continues accepting requests Correct. > 2) new master loads the Rails app and runs the before_fork hook. It > seems like normally this hook would send SIGQUIT to the new master, > causing it to close its TCP listen socket Correct, if you're using preload_app true. Keep in mind you're never required to use the before_fork hook to send SIGQUIT. > 3) new master forks and begins accepting on the TCP listen socket accept() never runs on the master, only workers. > 4) new workers run the after_fork hook and begin accepting requests Instead of sending HTTP requests to warmup, can you put internal warmup logic in your after_fork hook? The worker won't accept a request until after_fork is done running. Hell, maybe you can even use Rack::Mock in your after_fork to fake requests w/o going through sockets. (random idea, I've never tried it) > It seems like if we remove the logic which reaps the old master in the > before_fork hook and attempt to warm the workers in the after_fork > hook, then we're stuck in a state where both the old master and new > master are accepting requests but the new workers have not yet been > warmed up. Yes, but if you have enough resources, the split should be even > Is this the case, and if so, is there a way we can prevent the new > master from accepting requests until warmup is complete? If the new processes never accept requests, can they ever complete warm up? :) > Or how would we change the way we restart unicorn to support our > deployment automation (Capistrano, in this case) handling starting and > healthchecking a new set of workers? > Would we have to start the new > master on a separate port and use e.g. nginx to handle the switchover? Maybe using a separate port for the new master will work. > Something which doesn't involve massive changes to the way we > presently restart Unicorm (i.e. unicornctl restart) would probably be > the most practical solution for us. We have a "real solution" for all > of these problems in the works. What I'm looking for in the interim is > a band-aid. It sounds like you're really in a bad spot :< Honestly I've never had these combinations of problems to deal with. From normalperson at yhbt.net Tue Dec 4 03:00:15 2012 From: normalperson at yhbt.net (Eric Wong) Date: Tue, 4 Dec 2012 03:00:15 +0000 Subject: Combating nginx 499 HTTP responses during flash traffic scenario In-Reply-To: <20121129204100.GA28683@dcvr.yhbt.net> References: <20121030213719.GA6701@dcvr.yhbt.net> <20121102193803.GA17916@dcvr.yhbt.net> <20121105114850.GA15932@dcvr.yhbt.net> <20121106212338.GA4018@dcvr.yhbt.net> <20121129204100.GA28683@dcvr.yhbt.net> Message-ID: <20121204030014.GA1047@dcvr.yhbt.net> Eric Wong wrote: > I fixed up some minor line-wrapping, signed-off, and added your > quote above to the commit message. Pushed as > commit 5c700fc2cf398848ddcf71a2aa3f0f2a6563e87b > to git://bogomips.org/unicorn.git One more fix/cleanup to maintain compatibility with Rainbows! >From 69e6a793d34ff71da7c8ca59962d627e2fb508d8 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 4 Dec 2012 02:35:26 +0000 Subject: [PATCH] fix const error responses for Rainbows! Rainbows! relies on the ERROR_XXX_RESPONSE constants of unicorn 4.x. Changing the constants in unicorn 4.x will break existing versions of Rainbows!, so remove the dependency on the constants and generate the error response dynamically. Unlike Mongrel, unicorn is unlikely to see malicious traffic and thus unlikely to benefit from making error messages constant. For unicorn 5.x, we will drop these constants entirely. (Rainbows! most likely cannot support check_client_connection consistently across all concurrency models since some of them pessimistically buffer all writes in userspace. However, the extra concurrency of Rainbows! makes it less likely to be overloaded than unicorn, so this feature is likely less useful for Rainbows!) --- lib/unicorn/const.rb | 10 ++++++---- lib/unicorn/http_response.rb | 4 ++++ lib/unicorn/http_server.rb | 15 +++++++-------- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/lib/unicorn/const.rb b/lib/unicorn/const.rb index 60a63b1..02e29c7 100644 --- a/lib/unicorn/const.rb +++ b/lib/unicorn/const.rb @@ -29,10 +29,12 @@ module Unicorn::Const # :stopdoc: # common errors we'll send back - ERROR_400_RESPONSE = "400 Bad Request\r\n\r\n" - ERROR_414_RESPONSE = "414 Request-URI Too Long\r\n\r\n" - ERROR_413_RESPONSE = "413 Request Entity Too Large\r\n\r\n" - ERROR_500_RESPONSE = "500 Internal Server Error\r\n\r\n" + # (N.B. these are not used by unicorn, but we won't drop them until + # unicorn 5.x to avoid breaking Rainbows!). + ERROR_400_RESPONSE = "HTTP/1.1 400 Bad Request\r\n\r\n" + ERROR_414_RESPONSE = "HTTP/1.1 414 Request-URI Too Long\r\n\r\n" + ERROR_413_RESPONSE = "HTTP/1.1 413 Request Entity Too Large\r\n\r\n" + ERROR_500_RESPONSE = "HTTP/1.1 500 Internal Server Error\r\n\r\n" EXPECT_100_RESPONSE = "HTTP/1.1 100 Continue\r\n\r\n" EXPECT_100_RESPONSE_SUFFIXED = "100 Continue\r\n\r\nHTTP/1.1 " diff --git a/lib/unicorn/http_response.rb b/lib/unicorn/http_response.rb index 61563cd..579d957 100644 --- a/lib/unicorn/http_response.rb +++ b/lib/unicorn/http_response.rb @@ -17,6 +17,10 @@ module Unicorn::HttpResponse } CRLF = "\r\n" + def err_response(code, response_start_sent) + "#{response_start_sent ? '' : 'HTTP/1.1 '}#{CODES[code]}\r\n\r\n" + end + # writes the rack_response to socket as an HTTP response def http_response_write(socket, status, headers, body, response_start_sent=false) diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb index ef1ea58..aa98aeb 100644 --- a/lib/unicorn/http_server.rb +++ b/lib/unicorn/http_server.rb @@ -519,22 +519,21 @@ class Unicorn::HttpServer # if the socket is already closed or broken. We'll always ensure # the socket is closed at the end of this function def handle_error(client, e) - msg = case e + code = case e when EOFError,Errno::ECONNRESET,Errno::EPIPE,Errno::EINVAL,Errno::EBADF, Errno::ENOTCONN - Unicorn::Const::ERROR_500_RESPONSE + 500 when Unicorn::RequestURITooLongError - Unicorn::Const::ERROR_414_RESPONSE + 414 when Unicorn::RequestEntityTooLargeError - Unicorn::Const::ERROR_413_RESPONSE + 413 when Unicorn::HttpParserError # try to tell the client they're bad - Unicorn::Const::ERROR_400_RESPONSE + 400 else Unicorn.log_error(@logger, "app error", e) - Unicorn::Const::ERROR_500_RESPONSE + 500 end - msg = "HTTP/1.1 #{msg}" unless @request.response_start_sent - client.kgio_trywrite(msg) + client.kgio_trywrite(err_response(code, @request.response_start_sent)) client.close rescue end -- Eric Wong From pete at modeltwozero.com Tue Dec 4 11:38:20 2012 From: pete at modeltwozero.com (Peter Marsh) Date: Tue, 4 Dec 2012 11:38:20 +0000 Subject: Add licenses to gemspec In-Reply-To: <20121204113041.GA17535@dcvr.yhbt.net> References: <20121203211712.GA16488@dcvr.yhbt.net> <20121204113041.GA17535@dcvr.yhbt.net> Message-ID: I made a bit of a mess of emailing in the patch, I'm sorry. I'll submit an inline patch to mongrel-unicorn at rubyforge.org next time. Cheers, Pete On 4 December 2012 11:30, Eric Wong wrote: > Peter Marsh wrote: >> Hi Eric, >> >> The changes look great, thanks for letting me know about the Ruby >> license, I wasn't aware of that. > > Thanks for the patch and followup. Pushed to unicorn.git as > commit bc4c412f15a05a37ec40f374239efa83d2dbdb1e > > Btw, did you email mongrel-unicorn-owner at rubyforge.org since > the application/octet-stream attachment got rejected from > the normal mongrel-unicorn at rubyforge.org list? > > I strongly prefer inline patches (which I can pipe directly to "git am" > w/o leaving my mailer), however setting the attachment MIME type to > text/plain or text/x-diff should get through. From 3337684584 at tim.it Tue Dec 4 16:46:29 2012 From: 3337684584 at tim.it (=?windows-1251?Q?=D2=CB=CA-Groupp?=) Date: Tue, 4 Dec 2012 17:46:29 +0100 Subject: =?windows-1251?Q?=CF=E5=F0=E5=E2=EE=E7=EA=E8_=EB=FE=E1=EE=E9_=F1=EB=EE=E6=ED=EE=F1=F2=E8?= Message-ID: <6654700342.20121204174629@tim.it> http://www.cylent.info/cgi-bin/j4.php From jet at whidbey.com Tue Dec 4 22:01:51 2012 From: jet at whidbey.com (Jerrold Thompson) Date: Tue, 04 Dec 2012 14:01:51 -0800 Subject: 403 Forbidden from nginx when unicorn started in debug mode In-Reply-To: <50BE71E2.6040504@whidbey.com> References: <50BE71E2.6040504@whidbey.com> Message-ID: <50BE72CF.9050602@whidbey.com> ...in Gemfile: gem 'debugger', :git => 'git://github.com/cldwalker/debugger.git', :require => 'debugger' On 12/04/2012 01:57 PM, Jerrold Thompson wrote: > I am using nginx with unicorn as a reverse proxy. > > Has been fantastic, but needed to look through some code > for first time. > > Using ruby 1.9.3p194 with rails 3.2.9, development mode with ssl enabled, > > I start unicorn with -d > > ...and it does not get served up by nginx. > > Any ideas, or more information needed? > > Thanks! > > Jet > > Below is my unicorn.rb for developent: > > # config/unicorn.rb > > env = "development" > > preload_app true > > timeout 30 > > listen "/tmp/unicorn.sock", :backlog => 64 > > if env == 'development' > pid > "/home/jet/RailsApps/spree/aceleathergoods/tmp/pids/unicorn.aceleathergoods.pid" > > stderr_path "/var/www/aceleathergoods/shared/log/unicorn.stderr.log" > stdout_path "/var/www/aceleathergoods/shared/log/unicorn.stdout.log" > end > > > before_fork do |server, worker| > if defined?(ActiveRecord::Base) > ActiveRecord::Base.connection.disconnect! > end > > old_pid = "#{shared_path}/pids/unicorn.aceleathergoods.pid.oldbin" > if File.exists?(old_pid) && server.pid != old_pid > begin > Process.kill("QUIT", File.read(old_pid).to_i) > rescue Errno::ENOENT, Errno::ESRCH > # someone else did our job for us > end > end > end > > after_fork do |server, worker| > if defined?(ActiveRecord::Base) > ActiveRecord::Base.establish_connection > end > end > From jet at whidbey.com Tue Dec 4 21:57:54 2012 From: jet at whidbey.com (Jerrold Thompson) Date: Tue, 04 Dec 2012 13:57:54 -0800 Subject: 403 Forbidden from nginx when unicorn started in debug mode Message-ID: <50BE71E2.6040504@whidbey.com> I am using nginx with unicorn as a reverse proxy. Has been fantastic, but needed to look through some code for first time. Using ruby 1.9.3p194 with rails 3.2.9, development mode with ssl enabled, I start unicorn with -d ...and it does not get served up by nginx. Any ideas, or more information needed? Thanks! Jet Below is my unicorn.rb for developent: # config/unicorn.rb env = "development" preload_app true timeout 30 listen "/tmp/unicorn.sock", :backlog => 64 if env == 'development' pid "/home/jet/RailsApps/spree/aceleathergoods/tmp/pids/unicorn.aceleathergoods.pid" stderr_path "/var/www/aceleathergoods/shared/log/unicorn.stderr.log" stdout_path "/var/www/aceleathergoods/shared/log/unicorn.stdout.log" end before_fork do |server, worker| if defined?(ActiveRecord::Base) ActiveRecord::Base.connection.disconnect! end old_pid = "#{shared_path}/pids/unicorn.aceleathergoods.pid.oldbin" if File.exists?(old_pid) && server.pid != old_pid begin Process.kill("QUIT", File.read(old_pid).to_i) rescue Errno::ENOENT, Errno::ESRCH # someone else did our job for us end end end after_fork do |server, worker| if defined?(ActiveRecord::Base) ActiveRecord::Base.establish_connection end end From normalperson at yhbt.net Wed Dec 5 00:10:35 2012 From: normalperson at yhbt.net (Eric Wong) Date: Wed, 5 Dec 2012 00:10:35 +0000 Subject: 403 Forbidden from nginx when unicorn started in debug mode In-Reply-To: <50BE71E2.6040504@whidbey.com> References: <50BE71E2.6040504@whidbey.com> Message-ID: <20121205001035.GA7126@dcvr.yhbt.net> Jerrold Thompson wrote: > I am using nginx with unicorn as a reverse proxy. > > Has been fantastic, but needed to look through some code > for first time. > > Using ruby 1.9.3p194 with rails 3.2.9, development mode with ssl enabled, > > I start unicorn with -d > > ...and it does not get served up by nginx. > > Any ideas, or more information needed? Can you check your nginx error_log? This is probably an error in the nginx configuration. > if env == 'development' > pid "/home/jet/RailsApps/spree/aceleathergoods/tmp/pids/unicorn.aceleathergoods.pid" > stderr_path "/var/www/aceleathergoods/shared/log/unicorn.stderr.log" > stdout_path "/var/www/aceleathergoods/shared/log/unicorn.stdout.log" In case nginx is configured correctly, maybe the output of stderr can tell you something. From peter.hall at localstars.com Wed Dec 5 05:19:48 2012 From: peter.hall at localstars.com (Peter Hall) Date: Wed, 5 Dec 2012 13:19:48 +0800 Subject: Fwd: Issue starting unicorn with non-ActiveRecord Rails app In-Reply-To: References: Message-ID: Hi, I'm trying to use unicorn in a test deployment of a Rails app that uses Mongoid, so Activerecord isn't included in the app. When I start unicorn through Capistrano though, the stderr log fills up endlessly with identical ActiveRecord-related errors: I, [2012-12-05T04:19:25.375952 #5096] INFO -- : Refreshing Gem list I, [2012-12-05T04:19:32.941249 #5096] INFO -- : listening on addr=/var/www/webapps/fugu-cp/shared/pids/unicorn.sock fd=11 I, [2012-12-05T04:19:32.990825 #5096] INFO -- : master process ready E, [2012-12-05T04:19:33.108183 #5110] ERROR -- : uninitialized constant ActiveRecord (NameError) /var/www/webapps/fugu-cp/current/config/unicorn.rb:68:in `block in reload' /var/www/webapps/fugu-cp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:569:in `call' /var/www/webapps/fugu-cp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:569:in `init_worker_process' /var/www/webapps/fugu-cp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:593:in `worker_loop' /var/www/webapps/fugu-cp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:491:in `spawn_missing_workers' /var/www/webapps/fugu-cp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:141:in `start' /var/www/webapps/fugu-cp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/bin/unicorn_rails:209:in `' /var/www/webapps/fugu-cp/shared/bundle/ruby/1.9.1/bin/unicorn_rails:23:in `load' /var/www/webapps/fugu-cp/shared/bundle/ruby/1.9.1/bin/unicorn_rails:23:in `
' This repeats until I kill Unicorn. If you're curious, the way I'm starting Unicorn in the deploy file is as follows: set :unicorn_rails, "#{deploy_to}/shared/bundle/ruby/1.9.1/bin/unicorn_rails" run "cd #{latest_release} && bundle exec \"#{unicorn_rails} -c #{deploy_to}/current/config/unicorn.rb -D -E #{rails_env}\"" Incidentally, if there's a standard Unicorn include file for Capistrano so I don't have to specify my own tasks to start and stop it, I'd be grateful to know, because I couldn't find one and had to use a very heavily-modified version of something I copied+pasted from this gist: https://gist.github.com/1003099 Thanks, From normalperson at yhbt.net Wed Dec 5 07:45:35 2012 From: normalperson at yhbt.net (Eric Wong) Date: Wed, 5 Dec 2012 07:45:35 +0000 Subject: Fwd: Issue starting unicorn with non-ActiveRecord Rails app In-Reply-To: References: Message-ID: <20121205074535.GA1261@dcvr.yhbt.net> Peter Hall wrote: > Hi, > > I'm trying to use unicorn in a test deployment of a Rails app that > uses Mongoid, so Activerecord isn't included in the app. When I start > unicorn through Capistrano though, the stderr log fills up endlessly > with identical ActiveRecord-related errors: > > I, [2012-12-05T04:19:25.375952 #5096] INFO -- : Refreshing Gem list > I, [2012-12-05T04:19:32.941249 #5096] INFO -- : listening on > addr=/var/www/webapps/fugu-cp/shared/pids/unicorn.sock fd=11 > I, [2012-12-05T04:19:32.990825 #5096] INFO -- : master process ready > E, [2012-12-05T04:19:33.108183 #5110] ERROR -- : uninitialized > constant ActiveRecord (NameError) Hi Peter, this doesn't seem like an issue specific to unicorn... Can you reproduce this issue using another server, perhaps: rackup -s webrick -E #{rails_env} ? > This repeats until I kill Unicorn. > > If you're curious, the way I'm starting Unicorn in the deploy file is > as follows: Which version of Rails is this? Folks more familiar with modern Rails than myself should be able to help given more information. (Maybe asking on a Rails-oriented list can help, too). I do remember it was possible to disable parts of Rails back in the day. Most of my Rails knowledge is stuck in the Rails 1.x-era, though... > set :unicorn_rails, "#{deploy_to}/shared/bundle/ruby/1.9.1/bin/unicorn_rails" > run "cd #{latest_release} && bundle exec \"#{unicorn_rails} -c > #{deploy_to}/current/config/unicorn.rb -D -E #{rails_env}\"" Probably unrelated to the issue at hand, but "unicorn" is preferred if you're on Rails >=3. From daniel at condomitti.com Wed Dec 5 07:48:41 2012 From: daniel at condomitti.com (Daniel Condomitti) Date: Tue, 4 Dec 2012 23:48:41 -0800 Subject: Issue starting unicorn with non-ActiveRecord Rails app In-Reply-To: References: Message-ID: <5B98719E611543C3A54EB428C7869BF7@condomitti.com> On Tuesday, December 4, 2012 at 9:19 PM, Peter Hall wrote: > Hi, > > I'm trying to use unicorn in a test deployment of a Rails app that > uses Mongoid, so Activerecord isn't included in the app. When I start > unicorn through Capistrano though, the stderr log fills up endlessly > with identical ActiveRecord-related errors: > > I, [2012-12-05T04:19:25.375952 #5096] INFO -- : Refreshing Gem list > I, [2012-12-05T04:19:32.941249 #5096] INFO -- : listening on > addr=/var/www/webapps/fugu-cp/shared/pids/unicorn.sock fd=11 > I, [2012-12-05T04:19:32.990825 #5096] INFO -- : master process ready > E, [2012-12-05T04:19:33.108183 #5110] ERROR -- : uninitialized > constant ActiveRecord (NameError) > /var/www/webapps/fugu-cp/current/config/unicorn.rb:68:in `block in reload' > /var/www/webapps/fugu-cp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:569:in > `call' > /var/www/webapps/fugu-cp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:569:in > `init_worker_process' > /var/www/webapps/fugu-cp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:593:in > `worker_loop' > /var/www/webapps/fugu-cp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:491:in > `spawn_missing_workers' > /var/www/webapps/fugu-cp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:141:in > `start' > /var/www/webapps/fugu-cp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/bin/unicorn_rails:209:in > `' > /var/www/webapps/fugu-cp/shared/bundle/ruby/1.9.1/bin/unicorn_rails:23:in `load' > /var/www/webapps/fugu-cp/shared/bundle/ruby/1.9.1/bin/unicorn_rails:23:in > `
' > > This repeats until I kill Unicorn. > > If you're curious, the way I'm starting Unicorn in the deploy file is > as follows: > > set :unicorn_rails, "#{deploy_to}/shared/bundle/ruby/1.9.1/bin/unicorn_rails" > run "cd #{latest_release} && bundle exec \"#{unicorn_rails} -c > #{deploy_to}/current/config/unicorn.rb -D -E #{rails_env}\"" > > Incidentally, if there's a standard Unicorn include file for > Capistrano so I don't have to specify my own tasks to start and stop > it, I'd be grateful to know, because I couldn't find one and had to > use a very heavily-modified version of something I copied+pasted from > this gist: https://gist.github.com/1003099 > > Thanks, What's L68 of your config/unicorn.rb file look like? Check to see if you have copied/pasted a line that references ActiveRecord in the before_fork or after_fork blocks. A lot of unicorn examples have an ActiveRecord::Base.connection.disconnect! (with a defined?(ActiveRecord::Base) but that might not be present in your config) statement to ensure that AR connections aren't shared between the master and worker processes. From peter.hall at localstars.com Wed Dec 5 09:56:57 2012 From: peter.hall at localstars.com (Peter Hall) Date: Wed, 5 Dec 2012 17:56:57 +0800 Subject: Issue starting unicorn with non-ActiveRecord Rails app In-Reply-To: <5B98719E611543C3A54EB428C7869BF7@condomitti.com> References: <5B98719E611543C3A54EB428C7869BF7@condomitti.com> Message-ID: > What's L68 of your config/unicorn.rb file look like? Check to see if you have copied/pasted a line that references ActiveRecord in the before_fork or after_fork blocks. > > A lot of unicorn examples have an ActiveRecord::Base.connection.disconnect! (with a defined?(ActiveRecord::Base) but that might not be present in your config) statement to ensure that AR connections aren't shared between the master and worker processes. Aha! Thanks Daniel. =) I'm such an idiot =oP I totally missed that it was in my own code - including the path on the top line of the trace =|. The reason I presumed it wasn't is because I copied+pasted most of the unicorn config, so I didn't remember *writing* any AR-specific code. I guess it should work if I take that out! The line actually turned out to be ActiveRecord::Base.establish_connection Thanks again! *slaps forehead* From 99miles at gmail.com Thu Dec 6 19:48:13 2012 From: 99miles at gmail.com (Mac Martine) Date: Thu, 6 Dec 2012 11:48:13 -0800 Subject: Unicorn fails to install even though it's already installed and running Message-ID: <0BD39056-4965-488A-B482-EA161849BC6B@gmail.com> I'm deploying a Rails 3.2.8 app to Ubuntu. The server already runs the app with Unicorn and Nginx. unicorn -v returns unicorn v4.4.0 Adn rvm gem list shows: unicorn (4.4.0) Yet when I manually run 'gem install unicorn '4.4.0' it fails with the following. Any ideas why? Installing unicorn (4.4.0) ** [out :: mydomain.net] with native extensions ** [out :: mydomain.net] ** [out :: mydomain.net] Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. ** [out :: mydomain.net] ** [out :: mydomain.net] /home/eg/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb ** [out :: mydomain.net] checking for SIZEOF_OFF_T in ruby.h... *** extconf.rb failed *** ** [out :: mydomain.net] Could not create Makefile due to some reason, probably lack of ** [out :: mydomain.net] necessary libraries and/or headers. Check the mkmf.log file for more ** [out :: mydomain.net] details. You may need configuration options. ** [out :: mydomain.net] ** [out :: mydomain.net] Provided configuration options: ** [out :: mydomain.net] --with-opt-dir ** [out :: mydomain.net] --with-opt-include ** [out :: mydomain.net] --without-opt-include=${opt-dir}/include ** [out :: mydomain.net] --with-opt-lib ** [out :: mydomain.net] --without-opt-lib=${opt-dir}/lib ** [out :: mydomain.net] --with-make-prog ** [out :: mydomain.net] --without-make-prog ** [out :: mydomain.net] --srcdir=. ** [out :: mydomain.net] --curdir ** [out :: mydomain.net] --ruby=/home/eg/.rvm/rubies/ruby-1.9.3-p194/bin/ruby ** [out :: mydomain.net] /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError) ** [out :: mydomain.net] You have to install development tools first. ** [out :: mydomain.net] from /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:491:in `block in try_compile' ** [out :: mydomain.net] from /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:443:in `with_werror' ** [out :: mydomain.net] from /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:491:in `try_compile' ** [out :: mydomain.net] from /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:686:in `macro_defined?' ** [out :: mydomain.net] from /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:822:in `block in have_macro' ** [out :: mydomain.net] from /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for' ** [out :: mydomain.net] from /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone' ** [out :: mydomain.net] from /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open' ** [out :: mydomain.net] from /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone' ** [out :: mydomain.net] from /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open' ** [out :: mydomain.net] from /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:280:in `postpone' ** [out :: mydomain.net] from /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for' ** [out :: mydomain.net] ** [out :: mydomain.net] from /home/eg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:821:in `have_macro' ** [out :: mydomain.net] from extconf.rb:4:in `
' ** [out :: mydomain.net] ** [out :: mydomain.net] ** [out :: mydomain.net] Gem files will remain installed in /rails_apps/eg/production/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0 for inspection. ** [out :: mydomain.net] Results logged to /rails_apps/eg/production/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/ext/unicorn_http/gem_make.out ** [out :: mydomain.net] ** [out :: mydomain.net] An error occurred while installing unicorn (4.4.0), and Bundler cannot continue. ** [out :: mydomain.net] Make sure that `gem install unicorn -v '4.4.0'` succeeds before bundling. Here's the content from what I _think_ is the relevant mkmf.log have_macro: checking for SIZEOF_SIZE_T in ruby.h... -------------------- yes "gcc -I/home/evergreen/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/x86_64-linux -I/home/eg/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/backward -I/home/eg/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1 -I. -I/home/eg/.rvm/usr/include -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC -c conftest.c" checked program was: /* begin */ 1: #include "ruby.h" 2: 3: #include 4: /*top*/ 5: #ifndef SIZEOF_SIZE_T 6: # error 7: >>>>>> SIZEOF_SIZE_T undefined <<<<<< 8: #endif /* end */ -------------------- have_macro: checking for SIZEOF_LONG in ruby.h... -------------------- yes From normalperson at yhbt.net Thu Dec 6 20:23:28 2012 From: normalperson at yhbt.net (Eric Wong) Date: Thu, 6 Dec 2012 20:23:28 +0000 Subject: Unicorn fails to install even though it's already installed and running In-Reply-To: <0BD39056-4965-488A-B482-EA161849BC6B@gmail.com> References: <0BD39056-4965-488A-B482-EA161849BC6B@gmail.com> Message-ID: <20121206202328.GA26032@dcvr.yhbt.net> Mac Martine <99miles at gmail.com> wrote: > I'm deploying a Rails 3.2.8 app to Ubuntu. The server already runs the app with Unicorn and Nginx. > unicorn -v returns unicorn v4.4.0 > > Adn rvm gem list shows: > unicorn (4.4.0) > > Yet when I manually run 'gem install unicorn '4.4.0' it fails with the following. Any ideas why? Not sure, yet, (see below) Then there's also errors which may not be logged correctly: permissions and out-of-disk-space errors > Installing unicorn (4.4.0) > ** [out :: mydomain.net] with native extensions > ** [out :: mydomain.net] > ** [out :: mydomain.net] Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. > ** [out :: mydomain.net] > ** [out :: mydomain.net] /home/eg/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb > ** [out :: mydomain.net] checking for SIZEOF_OFF_T in ruby.h... *** extconf.rb failed *** > ** [out :: mydomain.net] Could not create Makefile due to some reason, probably lack of > ** [out :: mydomain.net] necessary libraries and/or headers. Check the mkmf.log file for more > ** [out :: mydomain.net] details. You may need configuration options. > ** [out :: mydomain.net] Gem files will remain installed in /rails_apps/eg/production/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0 for inspection. > ** [out :: mydomain.net] Results logged to /rails_apps/eg/production/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/ext/unicorn_http/gem_make.out Maybe gem_make.out will have more info than mkmf.log > Here's the content from what I _think_ is the relevant mkmf.log > > have_macro: checking for SIZEOF_SIZE_T in ruby.h... -------------------- yes > > "gcc -I/home/evergreen/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/x86_64-linux -I/home/eg/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/backward -I/home/eg/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1 -I. -I/home/eg/.rvm/usr/include -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC -c conftest.c" > checked program was: > /* begin */ > 1: #include "ruby.h" > 2: > 3: #include > 4: /*top*/ > 5: #ifndef SIZEOF_SIZE_T > 6: # error > 7: >>>>>> SIZEOF_SIZE_T undefined <<<<<< > 8: #endif > /* end */ > > -------------------- > > have_macro: checking for SIZEOF_LONG in ruby.h... -------------------- yes That looks fine, actually. I think any error will be near the end of mkmf.log. From 99miles at gmail.com Thu Dec 6 21:11:53 2012 From: 99miles at gmail.com (Mac Martine) Date: Thu, 6 Dec 2012 13:11:53 -0800 Subject: Unicorn fails to install even though it's already installed and running In-Reply-To: <20121206202328.GA26032@dcvr.yhbt.net> References: <0BD39056-4965-488A-B482-EA161849BC6B@gmail.com> <20121206202328.GA26032@dcvr.yhbt.net> Message-ID: <9A4BDE03-B10B-4754-8CAF-F1E97B3C86CA@gmail.com> Thanks, I can install other gems just fine in the same way, so it doesn't seem like permissions then, right? And disk space looks ok: df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 38G 17G 21G 45% / udev 490M 4.0K 490M 1% /dev tmpfs 199M 240K 199M 1% /run none 5.0M 0 5.0M 0% /run/lock none 497M 0 497M 0% /run/shm Here's the end of mkmf.log have_macro: checking for SIZEOF_SIZE_T in ruby.h... -------------------- no "gcc -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -fno-strict-aliasing -g -g -O2 -fPIC -c conftest.c" conftest.c:4:3: error: #error conftest.c:5:1: error: expected identifier or ?(? before ?>>? token checked program was: /* begin */ 1: #include 2: /*top*/ 3: #ifndef SIZEOF_SIZE_T 4: # error 5: >>>>>> SIZEOF_SIZE_T undefined <<<<<< 6: #endif /* end */ -------------------- check_sizeof: checking size of size_t in sys/types.h... -------------------- 8 "gcc -o conftest -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -fno-strict-aliasing -g -g -O2 -fPIC conftest.c -L. -L/usr/lib -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic -lruby1.8-static -lpthread -lrt -ldl -lcrypt -lm -lc" checked program was: /* begin */ 1: #include 2: 3: #include 4: /*top*/ 5: int conftest_const = (int)(sizeof(size_t)); 6: int main() {printf("%d\n", conftest_const); return 0;} /* end */ ./conftest | -------------------- have_macro: checking for SIZEOF_LONG in ruby.h... -------------------- yes "gcc -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -fno-strict-aliasing -g -g -O2 -fPIC -c conftest.c" checked program was: /* begin */ 1: #include 2: /*top*/ 3: #ifndef SIZEOF_LONG 4: # error 5: >>>>>> SIZEOF_LONG undefined <<<<<< 6: #endif /* end */ -------------------- have_func: checking for rb_str_set_len() in ruby.h... -------------------- yes "gcc -o conftest -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -fno-strict-aliasing -g -g -O2 -fPIC conftest.c -L. -L/usr/lib -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic -lruby1.8-static -lpthread -lrt -ldl -lcrypt -lm -lc" checked program was: /* begin */ 1: #include 2: 3: /*top*/ 4: int main() { return 0; } 5: int t() { void ((*volatile p)()); p = (void ((*)()))rb_str_set_len; return 0; } /* end */ -------------------- have_func: checking for gmtime_r() in time.h... -------------------- yes "gcc -o conftest -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -fno-strict-aliasing -g -g -O2 -fPIC conftest.c -L. -L/usr/lib -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic -lruby1.8-static -lpthread -lrt -ldl -lcrypt -lm -lc" checked program was: /* begin */ 1: #include 2: 3: /*top*/ 4: int main() { return 0; } 5: int t() { void ((*volatile p)()); p = (void ((*)()))gmtime_r; return 0; } /* end */ -------------------- On Dec 6, 2012, at 12:23 PM, Eric Wong wrote: > Mac Martine <99miles at gmail.com> wrote: >> I'm deploying a Rails 3.2.8 app to Ubuntu. The server already runs the app with Unicorn and Nginx. >> unicorn -v returns unicorn v4.4.0 >> >> Adn rvm gem list shows: >> unicorn (4.4.0) >> >> Yet when I manually run 'gem install unicorn '4.4.0' it fails with the following. Any ideas why? > > Not sure, yet, (see below) > > Then there's also errors which may not be logged correctly: permissions > and out-of-disk-space errors > >> Installing unicorn (4.4.0) >> ** [out :: mydomain.net] with native extensions >> ** [out :: mydomain.net] >> ** [out :: mydomain.net] Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. >> ** [out :: mydomain.net] >> ** [out :: mydomain.net] /home/eg/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb >> ** [out :: mydomain.net] checking for SIZEOF_OFF_T in ruby.h... *** extconf.rb failed *** >> ** [out :: mydomain.net] Could not create Makefile due to some reason, probably lack of >> ** [out :: mydomain.net] necessary libraries and/or headers. Check the mkmf.log file for more >> ** [out :: mydomain.net] details. You may need configuration options. > >> ** [out :: mydomain.net] Gem files will remain installed in /rails_apps/eg/production/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0 for inspection. >> ** [out :: mydomain.net] Results logged to /rails_apps/eg/production/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/ext/unicorn_http/gem_make.out > > Maybe gem_make.out will have more info than mkmf.log > >> Here's the content from what I _think_ is the relevant mkmf.log >> >> have_macro: checking for SIZEOF_SIZE_T in ruby.h... -------------------- yes >> >> "gcc -I/home/evergreen/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/x86_64-linux -I/home/eg/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/backward -I/home/eg/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1 -I. -I/home/eg/.rvm/usr/include -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC -c conftest.c" >> checked program was: >> /* begin */ >> 1: #include "ruby.h" >> 2: >> 3: #include >> 4: /*top*/ >> 5: #ifndef SIZEOF_SIZE_T >> 6: # error >> 7: >>>>>> SIZEOF_SIZE_T undefined <<<<<< >> 8: #endif >> /* end */ >> >> -------------------- >> >> have_macro: checking for SIZEOF_LONG in ruby.h... -------------------- yes > > That looks fine, actually. I think any error will be near the end of > mkmf.log. > _______________________________________________ > 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 Dec 6 21:54:27 2012 From: normalperson at yhbt.net (Eric Wong) Date: Thu, 6 Dec 2012 21:54:27 +0000 Subject: Unicorn fails to install even though it's already installed and running In-Reply-To: <9A4BDE03-B10B-4754-8CAF-F1E97B3C86CA@gmail.com> References: <0BD39056-4965-488A-B482-EA161849BC6B@gmail.com> <20121206202328.GA26032@dcvr.yhbt.net> <9A4BDE03-B10B-4754-8CAF-F1E97B3C86CA@gmail.com> Message-ID: <20121206215427.GA14698@dcvr.yhbt.net> Mac Martine <99miles at gmail.com> wrote: > Thanks, > > I can install other gems just fine in the same way, so it doesn't seem > like permissions then, right? > > And disk space looks ok: That's good to know. > Here's the end of mkmf.log > > have_macro: checking for SIZEOF_SIZE_T in ruby.h... -------------------- no > > "gcc -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -fno-strict-aliasing -g -g -O2 -fPIC -c conftest.c" Wait, are you now using a different version of Ruby? Your original message had 1.9 (via RVM) > >> ** [out :: mydomain.net] Results logged to /rails_apps/eg/production/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/ext/unicorn_http/gem_make.out > > > > Maybe gem_make.out will have more info than mkmf.log Again ^^ However, scrutinizing your original email more: > >> "gcc -I/home/evergreen/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/x86_64-linux -I/home/eg/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/backward -I/home/eg/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1 -I. -I/home/eg/.rvm/usr/include -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC -c conftest.c" I see both /home/evergreen/ and /home/eg/ in there; that looks suspicious. Did you perhaps copy anything in .rvm/ between home directories or rename the home directory at some point after RVM was installed? From tony.arcieri at gmail.com Fri Dec 7 23:42:21 2012 From: tony.arcieri at gmail.com (Tony Arcieri) Date: Fri, 7 Dec 2012 15:42:21 -0800 Subject: Maintaining capacity during deploys In-Reply-To: References: Message-ID: Here's a quick followup with what we're going to try: We changed the before_fork/after_fork hooks, getting rid of the original before_fork hook which sent SIGQUIT to the old master. Instead, we send SIGTTOU to the old master at the very end of the after_fork block, so that as each new worker completes booting it tells the old master to kill off one old worker. We're also using Rack::MockRequest in the after_fork block (but before we send SIGTTOU) to send a request to our most heavily trafficked action. Subsequent requests to the same action are ~20X faster, so it's clear we're pulling in a lot of code on that first request and warming up the new workers is definitely needed. Does this sound sane? -- Tony Arcieri From unicorn at obduk.com Fri Dec 7 23:52:30 2012 From: unicorn at obduk.com (Owen Davies) Date: Fri, 7 Dec 2012 23:52:30 +0000 Subject: Ubuntu upstart Message-ID: I cannot find any good example of a unicorn upstart task that works properly for the following: * Upstart will restart if unicorn dies * Can send USR2 signal to unicorn to do a no downtime deploys * Able to stop upstart job, even after a deploy I have tried the following: expect fork respawn setuid www-data chdir /var/www/app/current exec bundle exec unicorn_rails -E production -c /var/www/app/current/config/unicorn.rb I also tried using the following in various combinations: normal exit 0 QUIT USR2 post-stop exec kill `cat /var/www/app/current/tmp/pids/unicorn.pid` Can anyone help? Thanks Owen From normalperson at yhbt.net Fri Dec 7 23:54:12 2012 From: normalperson at yhbt.net (Eric Wong) Date: Fri, 7 Dec 2012 23:54:12 +0000 Subject: Maintaining capacity during deploys In-Reply-To: References: Message-ID: <20121207235412.GA21493@dcvr.yhbt.net> Tony Arcieri wrote: > Here's a quick followup with what we're going to try: > > We changed the before_fork/after_fork hooks, getting rid of the > original before_fork hook which sent SIGQUIT to the old master. > Instead, we send SIGTTOU to the old master at the very end of the > after_fork block, so that as each new worker completes booting it > tells the old master to kill off one old worker. AFAIK, this is pretty common in existing deployments due to the default example, so it probably works well for many users already. > We're also using Rack::MockRequest in the after_fork block (but before > we send SIGTTOU) to send a request to our most heavily trafficked > action. Subsequent requests to the same action are ~20X faster, so > it's clear we're pulling in a lot of code on that first request and > warming up the new workers is definitely needed. I haven't heard of anybody using this, but I expect it to work. A followup report would be much appreciated. Thanks in advance. > Does this sound sane? Sure! (of course, my definition of "sane" may not match the rest of the world :) From normalperson at yhbt.net Sat Dec 8 00:17:25 2012 From: normalperson at yhbt.net (Eric Wong) Date: Sat, 8 Dec 2012 00:17:25 +0000 Subject: [ANN] unicorn 4.5.0 (final) - check_client_connection option Message-ID: <20121208001725.GA31472@dcvr.yhbt.net> Changes: The new check_client_connection option allows unicorn to detect most disconnected local clients before potentially expensive application processing begins. This feature is useful for applications experiencing spikes of traffic leading to undesirable queue times, as clients will disconnect (and perhaps even retry, compounding the problem) before unicorn can even start processing the request. To enable this feature, add the following line to a unicorn config file: check_client_connection true This feature only works when nginx (or any other HTTP/1.0+ client) is on the same machine as unicorn. A huge thanks to Tom Burns for implementing and testing this change in production with real traffic (including mitigating an unexpected DoS attack). ref: http://mid.gmane.org/CAK4qKG3rkfVYLyeqEqQyuNEh_nZ8yw0X_cwTxJfJ+TOU+y8F+w at mail.gmail.com This release fixes broken Rainbows! compatibility in 4.5.0pre1. * http://unicorn.bogomips.org/ * mongrel-unicorn at rubyforge.org * git://bogomips.org/unicorn.git * http://unicorn.bogomips.org/NEWS.atom.xml -- Eric Wong From normalperson at yhbt.net Sat Dec 8 00:30:15 2012 From: normalperson at yhbt.net (Eric Wong) Date: Sat, 8 Dec 2012 00:30:15 +0000 Subject: Ubuntu upstart In-Reply-To: References: Message-ID: <20121208003015.GA24216@dcvr.yhbt.net> Owen Davies wrote: > I cannot find any good example of a unicorn upstart task that works > properly for the following: > > * Upstart will restart if unicorn dies > * Can send USR2 signal to unicorn to do a no downtime deploys I don't think you can combine the first two items. Sending QUIT to the original process (after USR2) will confuse Upstart (and similar process managers which rely on the wait/waitpid family of functions) into thinking unicorn died and needs to be restarted. If there's an existing upstart task for nginx, it should be easy to convert for usage with unicorn. Anyways if you find or come up with a good upstart task, I'll include it in the examples/ section (as long as it's Freely redistributable) From boss at airbladesoftware.com Sat Dec 8 12:59:51 2012 From: boss at airbladesoftware.com (Andrew Stewart) Date: Sat, 8 Dec 2012 13:59:51 +0100 Subject: Ubuntu upstart In-Reply-To: References: Message-ID: On 8 Dec 2012, at 00:52, Owen Davies wrote: > I cannot find any good example of a unicorn upstart task that works > properly for the following: > > * Upstart will restart if unicorn dies > * Can send USR2 signal to unicorn to do a no downtime deploys > * Able to stop upstart job, even after a deploy I take the view that the Unicorn master process is as reliable as a process manager and therefore there's no need to manage Unicorn with a process manager. Some may regard that as cheating but it neatly sidesteps your problem :) I use a control script like the one in the examples/ directory of the Unicorn source to start/stop/restart Unicorn. Yours, Andrew Stewart From unicorn at obduk.com Sat Dec 8 13:40:03 2012 From: unicorn at obduk.com (Owen Davies) Date: Sat, 8 Dec 2012 13:40:03 +0000 Subject: Ubuntu upstart In-Reply-To: References: Message-ID: Is it then possible to have an upstart script that doesn't do the restart? Just because upstart scripts are much cleaner than init scripts. Thanks, Owen On 8 December 2012 12:59, Andrew Stewart wrote: > > On 8 Dec 2012, at 00:52, Owen Davies wrote: >> I cannot find any good example of a unicorn upstart task that works >> properly for the following: >> >> * Upstart will restart if unicorn dies >> * Can send USR2 signal to unicorn to do a no downtime deploys >> * Able to stop upstart job, even after a deploy > > I take the view that the Unicorn master process is as reliable as a process manager and therefore there's no need to manage Unicorn with a process manager. > > Some may regard that as cheating but it neatly sidesteps your problem :) > > I use a control script like the one in the examples/ directory of the Unicorn source to start/stop/restart Unicorn. > > Yours, > Andrew Stewart > > > _______________________________________________ > 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 gamet at webenterprisesltd.com Sun Dec 9 22:36:02 2012 From: gamet at webenterprisesltd.com (Carrie Lugo) Date: Sun, 9 Dec 2012 16:36:02 -0600 Subject: Arouse your senses Message-ID: <001801cdd65e$26f85050$3d395c51@adminPCziq> The best technique to satisfy your lady http://80.93.213.237/noted.html From jdunn at aquezada.com Thu Dec 27 05:43:49 2012 From: jdunn at aquezada.com (Julian Dunn) Date: Thu, 27 Dec 2012 00:43:49 -0500 Subject: superclass mismatch for class TeeInput? In-Reply-To: References: Message-ID: <-3968653883392025602@unknownmsgid> > I was trying to run Unicorn 4.5.0's tests and I'm getting this. Am I doing something wrong? > > [vagrant at localhost unicorn-4.5.0]$ testrb -Ilib -Iext/unicorn_http -I. test > /home/vagrant/.gem/ruby/1.9.1/gems/unicorn-4.5.0/test/unit/test_tee_input.rb:7:in `': superclass mismatch for class TeeInput (TypeError) > from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require' > from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require' > from /usr/share/ruby/test/unit.rb:221:in `block in non_options' > from /usr/share/ruby/test/unit.rb:215:in `each' > from /usr/share/ruby/test/unit.rb:215:in `non_options' > from /usr/share/ruby/test/unit.rb:52:in `process_args' > from /usr/share/ruby/test/unit.rb:625:in `process_args' > from /usr/bin/testrb:5:in `
' > > > - Julian From normalperson at yhbt.net Thu Dec 27 06:59:38 2012 From: normalperson at yhbt.net (Eric Wong) Date: Thu, 27 Dec 2012 06:59:38 +0000 Subject: superclass mismatch for class TeeInput? In-Reply-To: <-3968653883392025602@unknownmsgid> References: <-3968653883392025602@unknownmsgid> Message-ID: <20121227065938.GA13410@dcvr.yhbt.net> Julian Dunn wrote: > > I was trying to run Unicorn 4.5.0's tests and I'm getting this. Am I doing something wrong? > > > > [vagrant at localhost unicorn-4.5.0]$ testrb -Ilib -Iext/unicorn_http -I. test I'm not sure what testrb is doing, I never use it. I can reproduce your error and it's not obvious what's causing it... Anyways, the following works for me: ruby -Ilib -Iext/unicorn_http -I. test/unit/test_tee_input.rb However, I normally just run: make -j$(nproc) test-all from a git checkout... Despite the filenames, most of the tests for unicorn aren't unit tests. They interact with the entire process (trapping signals, forking, exiting, etc...). Thus, test runners relying on exit/at_exit hooks (especially if nested like testrb seems to do) probably triggers some strange behavior... From 20680535 at qq.com Fri Dec 28 00:58:06 2012 From: 20680535 at qq.com (Richard) Date: Fri, 28 Dec 2012 08:58:06 +0800 Subject: Racing tent Message-ID: Tents Company Introduction: To Whom It May Concern, We find your company's information on the internet. We would like to introduce ourselves to you. We have been in the quickup tent manufacturing business for many years and are currently in the process of expanding and our customer base. We are specialized in quickup tents and mountain tents. All of our ranges are displayed on our website. You can try to view our webpage http://www.tent.net.cn The quickup tents can be easy setup and fold within 60 second. It was widely used in market booths, fairs, racing sports, carport etc.... And they can be imprinting your logos for advertisement. We would be interested in receiving more information from you so we could submit a suitable offer to you. We are awaiting your favorable response. Richard Zheng Marketing Director XiaMen JiaoXia Trade Company No.89, CangHong Rd, HaiCang Xia Men China(361026) Tel: 0086-592-5553842 P.s please let us know if you don't want to receive the mail! thank you! From danmelnick at gmail.com Fri Dec 28 21:38:22 2012 From: danmelnick at gmail.com (Dan Melnick) Date: Fri, 28 Dec 2012 21:38:22 +0000 (UTC) Subject: Maintaining capacity during deploys References: Message-ID: Tony Arcieri gmail.com> writes: > We're also using Rack::MockRequest in the after_fork block (but before > we send SIGTTOU) to send a request to our most heavily trafficked > action. Subsequent requests to the same action are ~20X faster, so > it's clear we're pulling in a lot of code on that first request and > warming up the new workers is definitely needed. Is this code you're able to share in a gist or elsewhere? I'm curious to see how you're using Rack::MockRequest on a per-worker basis. Thanks, Dan From tony.arcieri at gmail.com Fri Dec 28 22:07:41 2012 From: tony.arcieri at gmail.com (Tony Arcieri) Date: Fri, 28 Dec 2012 14:07:41 -0800 Subject: Maintaining capacity during deploys In-Reply-To: References: Message-ID: On Fri, Dec 28, 2012 at 1:38 PM, Dan Melnick wrote: >> Is this code you're able to share in a gist or elsewhere? I'm curious to > see how you're using Rack::MockRequest on a per-worker basis. It looks like this, more or less: app = ActionController::Dispatcher.new map = Rack::URLMap.new('/' => app) Rack::MockRequest.new(map).get(url) -- Tony Arcieri From 20680535 at qq.com Sat Dec 29 05:58:58 2012 From: 20680535 at qq.com (Richard) Date: Sat, 29 Dec 2012 13:58:58 +0800 Subject: Racing tent Message-ID: Tents Company Introduction: To Whom It May Concern, We find your company's information on the internet. We would like to introduce ourselves to you. We have been in the quickup tent manufacturing business for many years and are currently in the process of expanding and our customer base. We are specialized in quickup tents and mountain tents. All of our ranges are displayed on our website. You can try to view our webpage http://www.tent.net.cn The quickup tents can be easy setup and fold within 60 second. It was widely used in market booths, fairs, racing sports, carport etc.... And they can be imprinting your logos for advertisement. We would be interested in receiving more information from you so we could submit a suitable offer to you. We are awaiting your favorable response. Richard Zheng Marketing Director XiaMen JiaoXia Trade Company No.89, CangHong Rd, HaiCang Xia Men China(361026) Tel: 0086-592-5553842 P.s please let us know if you don't want to receive the mail! thank you! From ndiaibra at yahoo.com Sun Dec 30 16:57:10 2012 From: ndiaibra at yahoo.com (Mrs. Nadia Ibrahim) Date: Sun, 30 Dec 2012 16:57:10 H0300 Subject: Good Day Message-ID: Good Day, Sorry to take a little of your time. My name is Nadia Ibrahim aged 57yrs, suffering from long cancer of the lung. I am a widow to Late Iskandar Ibrahim who was killed during U.S. raid against Terrorism in Afghanistan. Until his death, my late husband was into oil and gas business that fetched him huge sum of money which I inherited as his next of kin. During the period of our marriage, we couldn't produce any child but by the special grace of God we adopted a little girl by name Aisah Ibrahim. I decided to contact you through this medium because I was told by my personal doctor that my cancer stage has deteriorated so much that I many not live up to two more months from now and considering the faith of this little girl we adopted, I decided to will my inherited money to you so that you can take care of her. My late husband before his death, deposited a total amount of $10.5M with a Financial Firm in Malaysia where we lived for years before relocated to this country Afghanistan that claimed the life of the most loving husband and father on this whole earth (My Husband). I want to introduce you as the new beneficiary of this fund to the Financial Firm in Malaysia if only you will promise me that you shall take care of my little Aisah as your own biological daughter and invest part of my fund into charity. Please, you are entitled to 30% of this fund for your efforts while you invest the balance of 70% into charity and taking care of little Aisah. Respond urgently to this message if you are interested. Regards, Mrs. Nadia Ibrahim Message-ID: <1A81BA3E45774E0B83BAD104E7EF4A82.MAI at seusitenainternet.com.br>