[Mongrel] Mongrel stops responding after period of inactivity

Pete DeLaurentis pete at nextengine.com
Sun Jul 29 22:23:06 EDT 2007


I get the same issue behind Lighttpd, and so I don't believe this is  
an Apache bug.

Facts:

- Mongrel stops working after a period of inactivity
- ActiveRecord timeout is not the issue (recommended fix changes  
nothing)
- Happens behind lighttpd and apache
- Nothing in the logs to give any clues

Workaround:

I haven't found a solution yet, but if I setup monit to contact the  
mongrels every few minutes, I'm able to prevent this issue, since  
it's related to inactivity.

Hope this helps,
Pete

PS. Does anyone know if Zed has any future bug-fix releases or  
updates planned?  I believe the last release was January, right?


On Jul 29, 2007, at 4:47 PM, Evan Weaver wrote:

> Looks like you hit the venerable Apache bug 39499 (and/or 37770),  
> maybe.
>
> Try adding
>
>   SetEnv force-proxy-request-1.0 1
>   SetEnv proxy-nokeepalive 1
>
> to your VirtualHost block for the Rails app.
>
> Evan
>
> On 7/29/07, Olly Lylo <list at lylo.co.uk> wrote:
>> Hi
>>
>>
>> I posted this to the Ruby on Rails Talk group but I thought I'd  
>> post it here
>> too as it's probably a more appropriate group.  Hope this is ok.
>>
>>
>> I'm running a 2-instance Mongrel cluster behind Apache 2.2.4 with  
>> Rails
>> 1.2.3.  If no requests are received by the application for several  
>> hours
>> (this usually happens overnight) then Mongrel stops
>> responding and no requests are detected by Rails (at least nothing  
>> is in the
>> Rails log).  Nothing untoward is in the Mongrel log.
>>
>>
>> If you try and visit the application, the request times out with a  
>> 502 Proxy
>> Error.  Apache is still up and running and serving static files  
>> without a
>> problem, but the following is present in the Apache error log  
>> (from trying
>> to hit the SessionController, identified by / sessions) which may  
>> provide a
>> clue:
>>
>>
>>     [Sun Jul 29 08:37:36 2007] [error] proxy: error reading status  
>> line from
>> remote server 127.0.0.1
>>     [Sun Jul 29 08:37:36 2007] [error] proxy: Error reading from  
>> remote
>> server returned by /sessions
>>
>>
>> Restarting the Mongrel cluster resolves the problem until the next  
>> time it
>> happens.  I have done a lot of reading about this issue online and  
>> a number
>> of sources -- including the Mongrel FAQ -- point to being able to  
>> fix a
>> 'hanging mongrel' situation by setting this value in  environment.rb:
>>
>>
>>     ActiveRecord::Base.verification_timeout = 14400
>>
>>
>> This make the ActiveRecord timeout value less than the MySQL  
>> default of
>> 28800.  I have made this change and it doesn't appear to make a  
>> difference.
>>
>>
>> Can anyone advise me on what to try next to diagnose this issue?  I'm
>> quickly running out of ideas and I'd appreciate a bit of help!
>>
>>
>> Here are the vitals from our Ubuntu 6.0.6 server:
>>
>>
>>     MySQL
>>         Ver 14.12 Distrib 5.0.22, for pc-linux-gnu (x86_64) using  
>> readline
>> 5.1
>>         connect_timeout                 5
>>         interactive_timeout             28800
>>         max_connect_errors           10
>>         max_connections               100
>>         max_user_connections       0
>>         wait_timeout                      28800
>>
>>
>>     ruby 1.8.6 (2007-03-13 patchlevel 0) [x86_64-linux]
>>         cgi_multipart_eof_fix ( 2.2)
>>         fastthread (1.0)
>>         mongrel (1.0.1)
>>         mongrel_cluster (1.0.2)
>>
>>
>>     Apache/2.2.4 (Unix)
>>
>>
>>     Mongrel Cluster Config:
>>         port: "8000"
>>         environment: production
>>         address: 127.0.0.1
>>         pid_file: log/mongrel.pid
>>         servers: 2
>>         user: [the user]
>>         group: [the group]
>>
>>
>>     Apache Load Balancer setup:
>>         <Proxy balancer://appname_cluster>
>>         BalancerMember http://127.0.0.1:8000
>>         BalancerMember  http://127.0.0.1:8001
>>         </Proxy>
>>
>>
>>     Apache Loaded Modules:
>>         core_module (static)
>>          authn_file_module (static)
>>         authn_default_module (static)
>>         authz_host_module (static)
>>         authz_groupfile_module (static)
>>         authz_user_module (static)
>>         authz_default_module (static)
>>         auth_basic_module (static)
>>         cache_module (static)
>>         include_module (static)
>>         filter_module (static)
>>         deflate_module (static)
>>         log_config_module (static)
>>          env_module (static)
>>         headers_module (static)
>>         setenvif_module (static)
>>         proxy_module (static)
>>         proxy_connect_module (static)
>>         proxy_ftp_module (static)
>>         proxy_http_module (static)
>>         proxy_ajp_module (static)
>>         proxy_balancer_module (static)
>>         ssl_module (static)
>>         mpm_prefork_module (static)
>>         http_module (static)
>>         mime_module (static)
>>          status_module (static)
>>         autoindex_module (static)
>>         asis_module (static)
>>         cgi_module (static)
>>         negotiation_module (static)
>>         dir_module (static)
>>         actions_module (static)
>>         userdir_module (static)
>>         alias_module (static)
>>         rewrite_module (static)
>>         so_module (static)
>>         php5_module (shared)
>>         info_module (shared)
>> _______________________________________________
>> Mongrel-users mailing list
>> Mongrel-users at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/mongrel-users
>>
>
>
> -- 
> Evan Weaver
> Cloudburst, LLC
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20070729/fe997a29/attachment-0001.html 


More information about the Mongrel-users mailing list