Hi, I hope this is the right place to post my issue (tried the #rubyonrails to no avail.) I am having major issues trying to setup rails to use fastcgi on Windows + Apache 1.3 machine. I have followed the instructions from http://wiki.rubyonrails.com/rails/show/FastCGI but still can''t get it to work. It looks like Apache tries to execute the controller but I never see an error or a successful page. Also whats interesting, after each new request, a new rubyw.exe process gets started every second. If I wait long enough and don''t shutdown apache, those processes quickly eatup all the memory in my system. I would realy apreciate any help. Thanks Rafael Btw, here is my htaccess and dispatch.fcgi files: AddHandler fastcgi-script .fcgi AddHandler cgi-script .cgi Options +FollowSymLinks +ExecCGI RewriteEngine On RewriteRule ^$ index.html [QSA] RewriteRule ^([^.]+)$ $1.html [QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly" and here is dispatch.fcgi: #!c:\ruby\bin\rubyw.exe def dispatcher_error(path,e,msg="") error_message "[#{Time.now}] Dispatcher failed to catch: #{e} (#{e.class})\n #{ e.backtrace.join("\n ")}\n#{msg}" Logger.new(path).fatal(error_message) rescue Object => log_error STDERR << "Couldn''t write to #{path} (#{e} [#{e.class}])\n" << error_message end begin require File.dirname(__FILE__) + "/../config/environment" require ''dispatcher'' require ''fcgi'' log_file_path = "#{RAILS_ROOT}/log/fastcgi.crash.log" FCGI.each_cgi do |cgi| begin Dispatcher.dispatch(cgi) rescue Object => rails_error dispatcher_error(log_file_path, rails_error) end end rescue Object => fcgi_error dispatcher_error(log_file_path, fcgi_error, "FCGI process #{$$} killed by this error\n") end _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
What do you have in your httpd.conf? You''ll need the following to prevent Apache starting up too many processes: FastCgiConfig -maxClassProcesses 3 -startDelay 30 Don''t be too worried about rubyw.exe taking up too much memory - each will inititally take up around 15-20mb, although that will increase as time goes on, depending on the size of your project. You need to allow each process to "spin up" - it''s possible your first attempt will time out before the process has started. Just try refreshing once each process has stopped using CPU. -paul
I had exactly the same problem on a low end PC. I have set -startDelay 120 and -appConnTimeout 120. -----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Paul Nicholls Sent: Tuesday, April 26, 2005 11:39 AM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails] FastCGI on Windows What do you have in your httpd.conf? You''ll need the following to prevent Apache starting up too many processes: FastCgiConfig -maxClassProcesses 3 -startDelay 30 Don''t be too worried about rubyw.exe taking up too much memory - each will inititally take up around 15-20mb, although that will increase as time goes on, depending on the size of your project. You need to allow each process to "spin up" - it''s possible your first attempt will time out before the process has started. Just try refreshing once each process has stopped using CPU. -paul _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Thanks, this limits the rubyw processes launched but the app is still not working under apache and fcgi. Here is my Apache error log: [Tue Apr 26 09:27:25 2005] [warn] FastCGI: (dynamic) server "c:/webserver/bdcnew/rails_test/public/dispatch.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds [Tue Apr 26 09:31:22 2005] [warn] FastCGI: (dynamic) server "c:/webserver/bdcnew/rails_test/public/dispatch.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds [Tue Apr 26 09:35:19 2005] [warn] FastCGI: (dynamic) server "c:/webserver/bdcnew/rails_test/public/dispatch.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds and ofcourse I get the standard message: Rails application failed to start properly" This is just a single controler test app, all it does it renders one line of text. It works perfectly with Brick or Apache with CGI. Any other ideas what might be misconfigured? btw, here are the relevant conf entries: LoadModule fastcgi_module "C:/Program Files/Apache Group/Apache/modules/mod_fastcgi-2.4.2-AP13.dll" AddHandler fastcgi-script .fcgi .fcg .fpl FastCgiConfig -maxClassProcesses 3 -startDelay 30 the rest is configured in the htaccess file On 4/26/05, Paul Nicholls <paul.nicholls-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > What do you have in your httpd.conf? You''ll need the following to > prevent Apache starting up too many processes: > > FastCgiConfig -maxClassProcesses 3 -startDelay 30 > > Don''t be too worried about rubyw.exe taking up too much memory - each > will inititally take up around 15-20mb, although that will increase as > time goes on, depending on the size of your project. > > You need to allow each process to "spin up" - it''s possible your first > attempt will time out before the process has started. Just try > refreshing once each process has stopped using CPU. > > -paul > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Any way to avoid a spinup time? Im running into this, its fine if I run the app continuously however it does not appear to be an issue. I even resorted in through a schedule wget http://mysite/list to try to keep the processes "awake." I have all mentioned tweaks in this thread deployed. On 4/26/05, Paul Nicholls <paul.nicholls-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> What do you have in your httpd.conf? You''ll need the following to > prevent Apache starting up too many processes: > > FastCgiConfig -maxClassProcesses 3 -startDelay 30 > > Don''t be too worried about rubyw.exe taking up too much memory - each > will inititally take up around 15-20mb, although that will increase as > time goes on, depending on the size of your project. > > You need to allow each process to "spin up" - it''s possible your first > attempt will time out before the process has started. Just try > refreshing once each process has stopped using CPU. > > -paul > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- ==== | |--| |___ |-:_ ==== Y ===http://www.stacksys.com Open Daemon Support for Business
On 4/26/05, Rafael Szuminski <raf1hh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thanks, this limits the rubyw processes launched but the app is still not > working under apache and fcgi. Here is my Apache error log: > > [Tue Apr 26 09:27:25 2005] [warn] FastCGI: (dynamic) server > "c:/webserver/bdcnew/rails_test/public/dispatch.fcgi" has > failed to remain running for 30 seconds given 3 attempts, its restart > interval has been backed off to 600 seconds > [Tue Apr 26 09:31:22 2005] [warn] FastCGI: (dynamic) server > "c:/webserver/bdcnew/rails_test/public/dispatch.fcgi" has > failed to remain running for 30 seconds given 3 attempts, its restart > interval has been backed off to 600 seconds > [Tue Apr 26 09:35:19 2005] [warn] FastCGI: (dynamic) server > "c:/webserver/bdcnew/rails_test/public/dispatch.fcgi" has > failed to remain running for 30 seconds given 3 attempts, its restart > interval has been backed off to 600 secondsI got this a lot on my Linux/Apache server with FastCGI. I *think* the fix was to install some FastCGI-related gem for Ruby, but I cannot be sure any more. I just tried "gem install fcgi" on my Windows box but it failed fast about a missing header file, so I can''t confirm. Sincerely, Tom Reinhart tom-V0YqjHVuocLQT0dZR+AlfA@public.gmane.org http://www.AllTom.com/
Tom: Ah, good thinking, could be that. Ruby for Apache is a handy installer for getting fastcgi into Ruby. http://rubyforge.org/projects/rubyforapache/ Ron: Preventing a fastcgi process from expiring too early can be controlled by -appConnTimeout and -idle-timeout. Have a look at this page for more configuration options: http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html I''ve seen MySQL connections die when they haven''t been used, though - you''ll get a Rails error if this happens. Not sure if this has been reported as a bug though; has anyone else has seen it?
On 4/26/05, Paul Nicholls <paul.nicholls-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Tom: Ah, good thinking, could be that. Ruby for Apache is a handy > installer for getting fastcgi into Ruby. > > http://rubyforge.org/projects/rubyforapache/Wow.. That''s.. That was so easy! Woo hoo! Sincerely, Tom Reinhart tom-V0YqjHVuocLQT0dZR+AlfA@public.gmane.org http://AllTom.com/
I got it running on one of my machines. Apache 2.0 XAMPP + RubyForApache worked like a charm. (The only thing I had to do is delete the dipatch.cgifrom the public directory, because it was taking precedence over .fcgi for some reason) Now, my dev machine is running Apache 1.3 (there are many reasons for this, one of them is that my host is also running 1.3). The RubyForApache.exe is only for Apache 2.0, so during the installation I spacified a fake Apache dir for the Apache files and the actual Ruby dir for the ruby files. Unfortunately this did not solve the issue. Executig a simple test controler still takes 30 sec (timeout duration) and afterwards I get the standard 500 error. Has anybody gotten fcgi working with Apache 1.3 on windows? Btw, thanks to Paul, Tom and all others for the help so far. Rafael On 4/26/05, Tom Reinhart <alltom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > On 4/26/05, Paul Nicholls <paul.nicholls-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Tom: Ah, good thinking, could be that. Ruby for Apache is a handy > > installer for getting fastcgi into Ruby. > > > > http://rubyforge.org/projects/rubyforapache/ > > Wow.. That''s.. That was so easy! Woo hoo! > > Sincerely, > > Tom Reinhart > tom-V0YqjHVuocLQT0dZR+AlfA@public.gmane.org > http://AllTom.com/ > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 4/26/05, Paul Nicholls <paul.nicholls-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Tom: Ah, good thinking, could be that. Ruby for Apache is a handy > installer for getting fastcgi into Ruby. > > http://rubyforge.org/projects/rubyforapache/ >Is there a similar solution for Ruby/FastCGI on Red Hat EL3? I''m expriencing similar problems (and also getting the HTML response dumped to the Apache logs). -- "Thanks to the crew of rocketscientists.ca for the gmail invitation!" http://www.rocketscientists.ca/ _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Ok, got it to work on Windows + Apache 1.3. Here are the steps that I had to take (just in case somebody has the same issue): 1. Make sure your setup (Ruby/Rails/Apache) is working in CGI mode 2. Download http://www.fastcgi.com/dist/mod_fastcgi-2.4.2-AP13.dll and copy this dll into the Apache modules directory 3. Add the following lines to the end of your httpd.conf file LoadModule fastcgi_module "C:/Program Files/Apache Group/Apache/modules/mod_fastcgi-2.4.2-AP13.dll" <IfModule mod_fastcgi.c> AddHandler fastcgi-script .fcgi </IfModule> (path should represent the dll location) 4. Download and install RubyForApache . During the installation, point to a temp directory for the Apache files (becasue this will install fastcgi.so module for Apache 2.0), and to the real directory for the Ruby files 5. Change the first line of the dispatch.fcgi file in the /public/ directory of your rails app to point to your rubyw.exe (ie: #!c:/ruby/bin/rubyw.exe) 6. In dispatch.fcgi make sure you have a line: require ''fcgi'' end not require ''rubygems'' require_gem ''fcgi'' like the rails doc for fastcgi suggest 7. Make sure your httpd.conf allows .htaccess override for the directory (ie: AllowOverride All) 8. Change .htaccess in /public/ to point to dispacth.fcgi This should be it. On 4/27/05, Rafael Szuminski <raf1hh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I got it running on one of my machines. Apache 2.0 XAMPP + RubyForApache worked like a charm. (The only thing I had to do is delete the dipatch.cgi from the public directory, because it was taking precedence over .fcgi for some reason) > > Now, my dev machine is running Apache 1.3 (there are many reasons for this, one of them is that my host is also running 1.3). The RubyForApache.exe is only for Apache 2.0, so during the installation I spacified a fake Apache dir for the Apache files and the actual Ruby dir for the ruby files. Unfortunately this did not solve the issue. Executig a simple test controler still takes 30 sec (timeout duration) and afterwards I get the standard 500 error. > > Has anybody gotten fcgi working with Apache 1.3 on windows? > > Btw, thanks to Paul, Tom and all others for the help so far. > > Rafael > > > > On 4/26/05, Tom Reinhart <alltom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > On 4/26/05, Paul Nicholls <paul.nicholls-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Tom: Ah, good thinking, could be that. Ruby for Apache is a handy > > > installer for getting fastcgi into Ruby. > > > > > > http://rubyforge.org/projects/rubyforapache/ > > > > Wow.. That''s.. That was so easy! Woo hoo! > > > > Sincerely, > > > > Tom Reinhart > > tom-V0YqjHVuocLQT0dZR+AlfA@public.gmane.org > > http://AllTom.com/ > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > >