I hope somewhere out there will be able to help me on this. I have my production evironment as follows:
Rails 2.3.5
Passenger 2.2.11
Nginx
Monit
It seems that everything is working as it's supposed to be but, 2 or 3 times a day, I get an email from Monit as follows:
monit alert -- Connection failed nginx
To: myemail@domain.com
Connection failed Service nginx
Date: Thu, 11 Nov 2010 10:46:44 +0000
Action: restart
Host: mydomain
Description: 'nginx' failed, cannot open a connection to INET[mydomain.com:80] via TCP
Your faithful employee,
monit
Then after about 30 seconds, I have another email as follows:
Connection passed Service nginx
Date: Thu, 11 Nov 2010 10:47:16 +0000
Action: alert
Host: mydomain
Description: 'nginx' connection passed to INET[mydomain.com:80] via TCP
Your faithful employee,
monit
In my monit config file I have the followings:
set daemon 30
check process nginx with pidfile /opt/nginx/logs/nginx.pid
start program = "/opt/nginx/sbin/nginx"
stop program = "/opt/nginx/sbin/nginx -s stop"
if failed host mydomain.com port 80 protocol http request / then restart
if 5 restarts within 5 cycles then timeout
And in Nginx log around that time, I have this:
2010/11/11 10:46:44 [notice] 3812#0: signal process started
*** Exception Errno::EPIPE in Passenger RequestHandler (Broken pipe) (process 3803):
from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11/lib/phusion_passenger/rack/request_handler.rb:94:in `write'
from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11/lib/phusion_passenger/rack/request_handler.rb:94:in `process_request'
from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11/lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11/lib/phusion_passenger/railz/application_spawner.rb:418:in `start_request_handler'
from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11/lib/phusion_passenger/railz/application_spawner.rb:358:in `handle_spawn_application'
from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11/lib/phusion_passenger/utils.rb:184:in `safe_fork'
from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11/lib/phusion_passenger/railz/application_spawner.rb:354:in `handle_spawn_application'
from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11/lib/phusion_passenger/abstract_server.rb:352:in `__send__'
from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11/lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11/lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11/lib/phusion_passenger/abstract_server.rb:163:in `start'
from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11/lib/phusion_passenger/railz/application_spawner.rb:213:in `start'
from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11/lib/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11/lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11/lib/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11/lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11/lib/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11/lib/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11/lib/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11/lib/phusion_passenger/abstract_server.rb:352:in `__send__'
from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11/lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11/lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11/bin/passenger-spawn-server:61
I couldn't make out what's causing this problem. I have tried putting the max_pool_size to 30 in Passenger config file and it didn't make any difference yet.
Any help would be appreciated.
Thanks.
if you want to check for your site being up perhaps you should use a service like wasitup.com (which is free btw).
Passenger will go down if it's not 'active' for awhile. go down is a strong word, but if someone doesn't visit your site in say 10 minutes or so, any passenger instances get killed, and the first person to visit your site will have to wait while it boots up.
I use this to keep passenger awake, for lack of a better word.
Please tell us if you fixed this problem with monit however, maybe someone else will need the help on the interwebs.