Apologies, this may be off-topic.
I''ve been wrestling with upload issues and Apache 2.2.2 /
mod_proxy_balanacer / mongrel_cluster / Mongrel on Mac OS X Server 10.4.5.
Typically the first upload would be fine but the next would make the mongrel
instance remain running (ps state = "R") essentially locking up that
instance. Apache would then eventually do:
[Fri Jun 16 16:45:54 2006] [error] ap_proxy_connect_backend disabling worker
for (mydomain.com)
[Fri Jun 16 16:45:54 2006] [error] proxy: HTTP: disabled connection for
(mydomain.com)
Requiring me to kill -9 the locked mongrel to get it to die. I''m
testing on
Safari under OS X 10.4 and my user base is 90%+ Safari (it''s an
intranet).
I finally started the mongrels with debugging on and that made me remember
the same issue with Apache/FastCGI and Lighttpd. So for Apache with FastCGI
this [1] is offered:
FastCgiServer /var/web/typo/public/dispatch.fcgi -idle-timeout 120 \
-initial-env RAILS_ENV=production -processes 2
And this for lighttpd:
# Making sure file uploads above 64k always work when using IE or Safari
# For more information, see http://trac.lighttpd.net/trac/ticket/360
$HTTP["useragent"] =~ "^(.*MSIE.*)|(.*AppleWebKit.*)$" {
server.max-keep-alive-requests = 0
}
I''m using Brady''s recipe [2] for my virtual host. So I tried
adding:
KeepAlive Off
to the top of it. Apache squaks in my error_log:
[Sat Jun 17 16:47:46 2006] [crit] (70023)This function has not been
implemented on this platform: DBD: failed to initialise
About 15 times, but the server remains up. And uploads work.
The error_log entry above make me think that my fix is not kosher. Googling
seems to indicate that "KeepAlive Off" can slow things down
marginally, but
if it fixes it I don''t really care.
Is there another, better way to do this in my Apache conf?
Thanks,
Tom
[1]
http://scottstuff.net/blog/articles/2005/07/20/apache-tuning-for-rails-and-f
astcgi
[2]
http://fluxura.com/articles/2006/05/19/apache-for-static-and-mongrel-for-rai
ls-with-mod_deflate-and-capistrano-support
On Sat, 2006-06-17 at 21:18 -0500, Tom Brice wrote:> Apologies, this may be off-topic. >Nope, not off-topic.> I''ve been wrestling with upload issues and Apache 2.2.2 / > mod_proxy_balanacer / mongrel_cluster / Mongrel on Mac OS X Server 10.4.5.Ok, I can test this out, but first I need: * Version of apache. * Version of Mongrel (you got 0.3.13 right?) * How are you doing the upload? Maybe a simple controller code and form snippet. There''s new upload code in the 0.3.13 version of mongrel, but you''re the first to complain. And you say it''s only with safari right? -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/
On 6/18/06 12:01 AM, Zed Shaw wrote:> Ok, I can test this out, but first I need: > > * Version of apache. > * Version of Mongrel (you got 0.3.13 right?) > * How are you doing the upload? Maybe a simple controller code and form > snippet.Apache 2.2.2 mongrel (0.3.13) The upload is a little tricky. I''m using a plugin that does it via a hidden iframe so that I can have an upload form on the same page as an edit form (its a CMS-y type application). This certainly complicates things. I will try to get a simplified app running that exhibits the same behaviour and send the pertinent bits to you. Might take a day or two. Other deadlines...> > There''s new upload code in the 0.3.13 version of mongrel, but you''re the > first to complain. And you say it''s only with safari right?I have only done extensive testing with Safari 2 (Tiger), but it did seem to hang with Firefox 1.5 (Mac) too. I can try to get a Windows machine to test (don''t have a fancy intel mac available). After changing KeepAlive to fix this I assumed that this was an Apache thing and not really related to Mongrel. So this may be Mongrel not releasing the connection? Thanks, Tom
This thread dates back almost a month. At the time I was addressing issues
with an app that does uploads (apache2.2/mod_proxy_balanacer/mongrel 0.3.13)
by setting KeepAlive Off in my virtual host section of my httpd.conf. If
Apache used KeepAlive the mongrel would hang. Not crash but simply remain
running.
I finally had some time to try to setup a sample app and compile apache on
my dev machine. Here''s what I found. I believe I''m still
getting the issue
when KeepAlive is on. I appears that the connection is set to timeout=5 max100.
Here''s the apache conf with KeepAlive on (based on Bradley
Taylor''s
conf):
<VirtualHost *:80>
ServerName domain.tld
DocumentRoot /Library/WebServer/apps/my_domain_app/current/public
# KeepAlive Off
<Directory
"/Library/WebServer/apps/my_domain_app/current/public">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
# Configure mongrel_cluster
<Proxy balancer://mongrel_cluster>
BalancerMember http://127.0.0.1:8000
BalancerMember http://127.0.0.1:8001
BalancerMember http://127.0.0.1:8002
BalancerMember http://127.0.0.1:8003
</Proxy>
RewriteEngine On
# Check for maintenance file and redirect all requests
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /system/maintenance.html [L]
# Rewrite index to check for static
RewriteRule ^/$ /index.html [QSA]
# Rewrite to check for Rails cached page
RewriteRule ^([^.]+)$ $1.html [QSA]
# Redirect all non-static requests to cluster
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]
# Deflate
AddOutputFilterByType DEFLATE text/html text/plain text/xml
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
ErrorLog logs/apache_mongrel_app_error_log
CustomLog logs/apache_mongrel_access_log combined
</VirtualHost>
I''ve tried to adjust the timeout to handle longer uploads:
<Proxy balancer://mongrel_cluster>
BalancerMember http://127.0.0.1:8000 timeout=120 max=150
BalancerMember http://127.0.0.1:8001 timeout=120 max=150
BalancerMember http://127.0.0.1:8002 timeout=120 max=150
BalancerMember http://127.0.0.1:8003 timeout=120 max=150
</Proxy>
But the connection still appears to say timeout=5,max=100. I believe that
if I can fix the timeout I may be able to run with KeepAlive on. Any
suggestions?
Thanks,
Tom
PS Zed if you still want an sample app I can send it to you
On 6/18/06 10:16 AM, Tom Brice wrote:
> On 6/18/06 12:01 AM, Zed Shaw wrote:
>
>> Ok, I can test this out, but first I need:
>>
>> * Version of apache.
>> * Version of Mongrel (you got 0.3.13 right?)
>> * How are you doing the upload? Maybe a simple controller code and
form
>> snippet.
> Apache 2.2.2
> mongrel (0.3.13)
> The upload is a little tricky. I''m using a plugin that does it
via a hidden
> iframe so that I can have an upload form on the same page as an edit form
> (its a CMS-y type application). This certainly complicates things.
>
> I will try to get a simplified app running that exhibits the same behaviour
> and send the pertinent bits to you. Might take a day or two. Other
> deadlines...
>>
>> There''s new upload code in the 0.3.13 version of mongrel, but
you''re the
>> first to complain. And you say it''s only with safari right?
>
> I have only done extensive testing with Safari 2 (Tiger), but it did seem
to
> hang with Firefox 1.5 (Mac) too. I can try to get a Windows machine to
test
> (don''t have a fancy intel mac available).
>
> After changing KeepAlive to fix this I assumed that this was an Apache
thing
> and not really related to Mongrel. So this may be Mongrel not releasing
the
> connection?
>
> Thanks,
> Tom
>
>
>
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users
On Wed, 2006-07-12 at 15:15 -0500, Tom Brice wrote:> This thread dates back almost a month. At the time I was addressing issues > with an app that does uploads (apache2.2/mod_proxy_balanacer/mongrel 0.3.13) > by setting KeepAlive Off in my virtual host section of my httpd.conf. If > Apache used KeepAlive the mongrel would hang. Not crash but simply remain > running. > > I finally had some time to try to setup a sample app and compile apache on > my dev machine. Here''s what I found. I believe I''m still getting the issue > when KeepAlive is on. I appears that the connection is set to timeout=5 max> 100. Here''s the apache conf with KeepAlive on (based on Bradley Taylor''s > conf):<snip>> But the connection still appears to say timeout=5,max=100. I believe that > if I can fix the timeout I may be able to run with KeepAlive on. Any > suggestions? >I''d say just don''t do that. Or as rails people say YAGNI. Unless you have a very compelling technical reason (and I can come up with better alternatives for every one), then keepalive isn''t needed. It actually doesn''t improve performance for various reasons, and it really only causes you obvious pain. Just don''t do it. Simpler is better. On another note, I''m not really sure why apache can''t handle keepalive and why that matters for the proxy. Should be that apache can translate the keepalive and do regular requests to the backend. Seems like apache is broken.> PS Zed if you still want an sample app I can send it to youSure, send it on. I''d be curious to see what you''re doing and why you need the keepalive stuff. Uh, but off list. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ http://www.railsmachine.com/ -- Need Mongrel support?
On 7/12/06 8:42 PM, Zed Shaw wrote:> I''d say just don''t do that. Or as rails people say YAGNI. Unless you > have a very compelling technical reason (and I can come up with better > alternatives for every one), then keepalive isn''t needed. It actually > doesn''t improve performance for various reasons, and it really only > causes you obvious pain. Just don''t do it. Simpler is better.Agreed. Just to be clear: I don''t _need_ KeepAlive. I''m still learning the intricacies of apache voodoo so it was dumb luck that I found the solution was to turn KeepAlive off. Off works so off it stays. I am pursuing this for the sake of clarifying it for the community at large. Anyway, noble intentions aside, thanks for the info. Tom