Hi, something strange is going on with my WinXP/Apache2/Rails/FastCGI... When I first start my Rails app I get the following: 1. In the browser a page with: Application error Rails application failed to start properly 2. Two (2) ''Apache.exe'' and ten (10) ''rubyw.exe'' running instances 3. In the ''error.log'' (from apache''s ''logs'' dir) [Tue Apr 05 14:47:34 2005] [notice] Apache/2.0.53 (Win32) mod_fastcgi/2.4.2 configured -- resuming normal operations [Tue Apr 05 14:47:34 2005] [notice] Server built: Feb 10 2005 06:11:34 [Tue Apr 05 14:47:34 2005] [notice] Parent: Created child process 1804 [Tue Apr 05 14:47:34 2005] [notice] Child 1804: Child process is running [Tue Apr 05 14:47:34 2005] [notice] FastCGI: process manager initialized [Tue Apr 05 14:47:34 2005] [notice] Child 1804: Acquired the start mutex. [Tue Apr 05 14:47:34 2005] [notice] Child 1804: Starting 250 worker threads. [Tue Apr 05 14:47:45 2005] [warn] FastCGI: (dynamic) server "E:/www/adbk/public/dispatch.fcgi" started (pid 3920) [Tue Apr 05 14:47:48 2005] [warn] FastCGI: (dynamic) server "E:/www/adbk/public/dispatch.fcgi" started (pid 2884) [Tue Apr 05 14:47:51 2005] [warn] FastCGI: (dynamic) server "E:/www/adbk/public/dispatch.fcgi" started (pid 260) [Tue Apr 05 14:47:54 2005] [warn] FastCGI: (dynamic) server "E:/www/adbk/public/dispatch.fcgi" started (pid 3284) [Tue Apr 05 14:47:57 2005] [warn] FastCGI: (dynamic) server "E:/www/adbk/public/dispatch.fcgi" started (pid 3876) [Tue Apr 05 14:48:00 2005] [warn] FastCGI: (dynamic) server "E:/www/adbk/public/dispatch.fcgi" started (pid 3516) [Tue Apr 05 14:48:03 2005] [warn] FastCGI: (dynamic) server "E:/www/adbk/public/dispatch.fcgi" started (pid 3424) [Tue Apr 05 14:48:06 2005] [warn] FastCGI: (dynamic) server "E:/www/adbk/public/dispatch.fcgi" started (pid 1708) [Tue Apr 05 14:48:09 2005] [warn] FastCGI: (dynamic) server "E:/www/adbk/public/dispatch.fcgi" started (pid 444) [Tue Apr 05 14:48:12 2005] [warn] FastCGI: scheduled the start of the last (dynamic) server "E:/www/adbk/public/dispatch.fcgi" process: reached dynamicMaxClassProcs (10) [Tue Apr 05 14:48:12 2005] [warn] FastCGI: (dynamic) server "E:/www/adbk/public/dispatch.fcgi" started (pid 880) 4. In the ''Apache.log'' (from my rails applications ''log'' dir) [Tue Apr 05 14:48:18 2005] [error] [client 127.0.0.1] FastCGI: comm with (dynamic) server "E:/www/adbk/public/dispatch.fcgi" aborted: (first read) idle timeout (30 sec) [Tue Apr 05 14:48:19 2005] [error] [client 127.0.0.1] FastCGI: incomplete headers (0 bytes) received from server "E:/www/adbk/public/dispatch.fcgi" 5. In the ''development.log'' (from my rails applications ''log'' dir) Processing EmnController#index (for 127.0.0.1 at Tue Apr 05 14:49:14 Hora oficial do Brasil 2005) Parameters: {"action"=>"index", "controller"=>"emn"} Rendering emn/index within layouts/default Rendering layouts/default (200 OK) Completed in 0.090000 (11 reqs/sec) | Rendering: 0.090000 (100%) 6. The CPU goes to 100% of utilization... But, the most strange (at least for me) is that after a while, when the cpu goes down to normal utilization ( I noticed that at that time all rubyw.exe instances are 0% cpu and +-15MB), and if I use the application everything goes wright!!! Even if I kill nine (9) of hte running ''rubyw.exe'' instances... Anyone has a clue? Enviroment: ruby182-14.exe (one click install) RubyForApache-beta2.exe actionmailer (0.8.1) actionpack (1.7.0) actionwebservice (0.6.2) activerecord (1.9.1) activesupport (1.0.3) rails (0.11.1) rake (0.5.0) ----------------------------------------------------------- ...\etc\hosts --------------------------------------------- 127.0.0.1 localhost # "enderecos" virtual host 127.0.0.1 enderecos ----------------------------------------------------------- ...\httpd.cong -------------------------------------------- LoadModule rewrite_module modules/mod_rewrite.so LoadModule fastcgi_module RubyForApache/modules/mod_fastcgi.so <IfModule mod_fastcgi.c> AddHandler fastcgi-script .fcgi </IfModule> DocumentRoot "E:/www" <Directory "E:/www"> AddHandler cgi-script .cgi NameVirtualHost *:80 <VirtualHost *:80> ServerName localhost DocumentRoot "E:/www" </VirtualHost> <VirtualHost *:80> ServerName enderecos DocumentRoot E:/www/adbk/public/ ErrorLog E:/www/adbk/log/apache.log <Directory E:/www/adbk/public/> Options ExecCGI FollowSymLinks AllowOverride all Order allow,deny Allow from all </Directory> </VirtualHost> ----------------------------------------------------------- .htaccess (on rails app public dir) ----------------------- # General Apache options #AddHandler fastcgi-script .fcgi #AddHandler cgi-script .cgi #Options +FollowSymLinks +ExecCGI # Redirect all requests not available on the filesystem to Rails # By default the cgi dispatcher is used which is very slow # # For better performance replace the dispatcher with the fastcgi one # # Example: # RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] RewriteEngine On RewriteRule ^$ index.html [QSA] RewriteRule ^([^.]+)$ $1.html [QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] # In case Rails experiences terminal errors # Instead of displaying this message you can supply a file here which will be rendered instead # # Example: # ErrorDocument 500 /500.html ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly" ----------------------------------------------------------- dispatch.fcgi (on rails app public dir) ------------------- #!D:/runtimes/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 Greetings, Eduardo.
I''d like to know how you got FastCGI to work on winxp + apache in the first place. I couldn''t get it to work at all. But then again, maybe its not exactly working for you either. I ended up going with mod_ruby. Give that a try... its just as good (if you''re only running a single rails app.) On Apr 5, 2005 2:28 PM, Eduardo Manso <emneto-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Hi, > > something strange is going on with my WinXP/Apache2/Rails/FastCGI... > > When I first start my Rails app I get the following: > > 1. In the browser a page with: > > Application error > > Rails application failed to start properly > > 2. Two (2) ''Apache.exe'' and ten (10) ''rubyw.exe'' running instances > > 3. In the ''error.log'' (from apache''s ''logs'' dir) > > [Tue Apr 05 14:47:34 2005] [notice] Apache/2.0.53 (Win32) > mod_fastcgi/2.4.2 configured -- resuming normal operations > [Tue Apr 05 14:47:34 2005] [notice] Server built: Feb 10 2005 06:11:34 > [Tue Apr 05 14:47:34 2005] [notice] Parent: Created child process 1804 > [Tue Apr 05 14:47:34 2005] [notice] Child 1804: Child process is running > [Tue Apr 05 14:47:34 2005] [notice] FastCGI: process manager initialized > [Tue Apr 05 14:47:34 2005] [notice] Child 1804: Acquired the start mutex. > [Tue Apr 05 14:47:34 2005] [notice] Child 1804: Starting 250 worker > threads. > [Tue Apr 05 14:47:45 2005] [warn] FastCGI: (dynamic) server > "E:/www/adbk/public/dispatch.fcgi" started (pid 3920) > [Tue Apr 05 14:47:48 2005] [warn] FastCGI: (dynamic) server > "E:/www/adbk/public/dispatch.fcgi" started (pid 2884) > [Tue Apr 05 14:47:51 2005] [warn] FastCGI: (dynamic) server > "E:/www/adbk/public/dispatch.fcgi" started (pid 260) > [Tue Apr 05 14:47:54 2005] [warn] FastCGI: (dynamic) server > "E:/www/adbk/public/dispatch.fcgi" started (pid 3284) > [Tue Apr 05 14:47:57 2005] [warn] FastCGI: (dynamic) server > "E:/www/adbk/public/dispatch.fcgi" started (pid 3876) > [Tue Apr 05 14:48:00 2005] [warn] FastCGI: (dynamic) server > "E:/www/adbk/public/dispatch.fcgi" started (pid 3516) > [Tue Apr 05 14:48:03 2005] [warn] FastCGI: (dynamic) server > "E:/www/adbk/public/dispatch.fcgi" started (pid 3424) > [Tue Apr 05 14:48:06 2005] [warn] FastCGI: (dynamic) server > "E:/www/adbk/public/dispatch.fcgi" started (pid 1708) > [Tue Apr 05 14:48:09 2005] [warn] FastCGI: (dynamic) server > "E:/www/adbk/public/dispatch.fcgi" started (pid 444) > [Tue Apr 05 14:48:12 2005] [warn] FastCGI: scheduled the start of the > last (dynamic) server "E:/www/adbk/public/dispatch.fcgi" process: > reached dynamicMaxClassProcs (10) > [Tue Apr 05 14:48:12 2005] [warn] FastCGI: (dynamic) server > "E:/www/adbk/public/dispatch.fcgi" started (pid 880) > > 4. In the ''Apache.log'' (from my rails applications ''log'' dir) > > [Tue Apr 05 14:48:18 2005] [error] [client 127.0.0.1 <http://127.0.0.1>] > FastCGI: comm with > (dynamic) server "E:/www/adbk/public/dispatch.fcgi" aborted: (first > read) idle timeout (30 sec) > [Tue Apr 05 14:48:19 2005] [error] [client 127.0.0.1 <http://127.0.0.1>] > FastCGI: > incomplete headers (0 bytes) received from server > "E:/www/adbk/public/dispatch.fcgi" > > 5. In the ''development.log'' (from my rails applications ''log'' dir) > > Processing EmnController#index (for 127.0.0.1 <http://127.0.0.1> at Tue > Apr 05 14:49:14 > Hora oficial do Brasil 2005) > Parameters: {"action"=>"index", "controller"=>"emn"} > Rendering emn/index within layouts/default > Rendering layouts/default (200 OK) > Completed in 0.090000 (11 reqs/sec) | Rendering: 0.090000 (100%) > > 6. The CPU goes to 100% of utilization... > > But, the most strange (at least for me) is that after a while, when > the cpu goes down to normal utilization ( I noticed that at that time > all rubyw.exe instances are 0% cpu and +-15MB), and if I use > the application everything goes wright!!! > Even if I kill nine (9) of hte running ''rubyw.exe'' instances... > > Anyone has a clue? > > Enviroment: > > ruby182-14.exe (one click install) > RubyForApache-beta2.exe > actionmailer (0.8.1) > actionpack (1.7.0) > actionwebservice (0.6.2) > activerecord (1.9.1) > activesupport (1.0.3) > rails (0.11.1) > rake (0.5.0) > > ----------------------------------------------------------- > ...\etc\hosts --------------------------------------------- > > 127.0.0.1 <http://127.0.0.1> localhost > > # "enderecos" virtual host > 127.0.0.1 <http://127.0.0.1> enderecos > > ----------------------------------------------------------- > ...\httpd.cong -------------------------------------------- > > LoadModule rewrite_module modules/mod_rewrite.so > > LoadModule fastcgi_module RubyForApache/modules/mod_fastcgi.so > > <IfModule mod_fastcgi.c> > AddHandler fastcgi-script .fcgi > </IfModule> > > DocumentRoot "E:/www" > <Directory "E:/www"> > > AddHandler cgi-script .cgi > > NameVirtualHost *:80 > > <VirtualHost *:80> > ServerName localhost > DocumentRoot "E:/www" > </VirtualHost> > > <VirtualHost *:80> > ServerName enderecos > DocumentRoot E:/www/adbk/public/ > ErrorLog E:/www/adbk/log/apache.log > <Directory E:/www/adbk/public/> > Options ExecCGI FollowSymLinks > AllowOverride all > Order allow,deny > Allow from all > </Directory> > </VirtualHost> > > ----------------------------------------------------------- > .htaccess (on rails app public dir) ----------------------- > > # General Apache options > #AddHandler fastcgi-script .fcgi > #AddHandler cgi-script .cgi > #Options +FollowSymLinks +ExecCGI > > # Redirect all requests not available on the filesystem to Rails > # By default the cgi dispatcher is used which is very slow > # > # For better performance replace the dispatcher with the fastcgi one > # > # Example: > # RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] > RewriteEngine On > RewriteRule ^$ index.html [QSA] > RewriteRule ^([^.]+)$ $1.html [QSA] > RewriteCond %{REQUEST_FILENAME} !-f > RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] > > # In case Rails experiences terminal errors > # Instead of displaying this message you can supply a file here which > will be rendered instead > # > # Example: > # ErrorDocument 500 /500.html > > ErrorDocument 500 "<h2>Application error</h2>Rails application failed to > start properly" > > ----------------------------------------------------------- > dispatch.fcgi (on rails app public dir) ------------------- > > #!D:/runtimes/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 > > Greetings, > > Eduardo. > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- - Ramin http://www.getintothis.com/blog _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
rails-request-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org wrote:> > Message: 2 > Date: Tue, 5 Apr 2005 14:43:00 -0400 > From: Ramin <i8ramin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > Subject: Re: [Rails] WinXP/Apache2/FastCGI/Rails problems... > To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Message-ID: <6f75632505040511432287cef2-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> > Content-Type: text/plain; charset="iso-8859-1" > > I''d like to know how you got FastCGI to work on winxp + apache in the first > place. I couldn''t get it to work at all. But then again, maybe its not > exactly working for you either. I ended up going with mod_ruby. Give that a > try... its just as good (if you''re only running a single rails app.) > > On Apr 5, 2005 2:28 PM, Eduardo Manso <emneto-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >Hi Ramin, I''m working with the following environment: ruby182-14.exe (downloaded from http://rubyinstaller.rubyforge.org/wiki/wiki.pl) RubyForApache-beta2.exe (installs ''mod_fastcgi.so'') (downloaded from http://rubyforge.org/projects/rubyforapache/) apache_2.0.53-win32-x86-no_ssl.msi (downloaded from Apache''s site) rails (0.11.1) rake (0.5.0) actionmailer (0.8.1) actionpack (1.7.0) actionwebservice (0.6.2) activerecord (1.9.1) activesupport (1.0.3) (all installed with ''gems install rails'' ) I''ve changed just one thing in the defaults installations. I changed the Apache''s DocumentRoot to "e:\www". The content of each config file I touched is described in my previous mail. So, what I did? Almost nothing. I just created a Rails application in the "e:\www" directory, which I called ''adbk''. x:\> cd e:\www e:\www> rails adbk Then in ''.htaccess'' file (e:\www\adbk\public\.htaccess) I changed the line RewriteRule ^(.*)$ dispatch.cgi [QSA,L] to RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] and commented the lines #AddHandler fastcgi-script .fcgi #AddHandler cgi-script .cgi #Options +FollowSymLinks +ExecCGI In ''dispatch.fcgi'' file (e:\www\adbk\public\dispatch.fcgi) I changed the shebang from #!D:/runtimes/ruby/bin/ruby to #!D:/runtimes/ruby/bin/rubyw.exe Finally I started Apache, which in my case is running as a service. Based on the text of the log files I''ve listed in the previous mail, I believe I''m running with WinXP+Apache+FastCGI... Now, how about mod_ruby? Is it easy to install/configure? I hope I''have helped in some way... Greetings, Eduardo.
Thanks for the setup tips! I''ll definitely try it out. I wasn''t able to get FastCGI to work on my windows setup, so I gave up and resorted to mod_ruby. Its extremely easy to set. Just gotta add some lines to your apache config, modify your .htaccess to read dispatch.rb and that''s it. I think you gotta copy over mod_ruby.so (or dll) over to your apache modules folder as well. I dont have the details with me right now casue I''m at work, but you should be able to find a HOW-TO for mod_ruby.. its a lot simpler to setup than fastcgi. one thing to watch out for though.. with mod_ruby, you can only run one rails application at a time on your apache setup. With fastcgi, it supports multiple rails apps. Or so I''ve heard. I''m happy with my mod_ruby configuration right now because I''m just using windows for development purposes. Good luck with the errors. I''d recommend giving mod_ruby a try, it might solve your problems. By the way, have you had any luck getting the fcgi gem using gem install fcgi ? I couldn''t get that to work either. On Apr 5, 2005 4:28 PM, Eduardo Manso <emneto-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > rails-request-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org wrote: > > > > Message: 2 > > Date: Tue, 5 Apr 2005 14:43:00 -0400 > > From: Ramin <i8ramin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > Subject: Re: [Rails] WinXP/Apache2/FastCGI/Rails problems... > > To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > Message-ID: <6f75632505040511432287cef2-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> > > Content-Type: text/plain; charset="iso-8859-1" > > > > I''d like to know how you got FastCGI to work on winxp + apache in the > first > > place. I couldn''t get it to work at all. But then again, maybe its not > > exactly working for you either. I ended up going with mod_ruby. Give > that a > > try... its just as good (if you''re only running a single rails app.) > > > > On Apr 5, 2005 2:28 PM, Eduardo Manso <emneto-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hi Ramin, > > I''m working with the following environment: > > ruby182-14.exe > (downloaded from http://rubyinstaller.rubyforge.org/wiki/wiki.pl) > > RubyForApache-beta2.exe (installs ''mod_fastcgi.so'') > (downloaded from http://rubyforge.org/projects/rubyforapache/) > > apache_2.0.53-win32-x86-no_ssl.msi > (downloaded from Apache''s site) > > rails (0.11.1) > rake (0.5.0) > actionmailer (0.8.1) > actionpack (1.7.0) > actionwebservice (0.6.2) > activerecord (1.9.1) > activesupport (1.0.3) > (all installed with ''gems install rails'' ) > > I''ve changed just one thing in the defaults installations. > I changed the Apache''s DocumentRoot to "e:\www". > > The content of each config file I touched is described in my > previous mail. > > So, what I did? Almost nothing. I just created a Rails application > in the "e:\www" directory, which I called ''adbk''. > > x:\> cd e:\www > e:\www> rails adbk > > Then in ''.htaccess'' file (e:\www\adbk\public\.htaccess) I changed > the line > > RewriteRule ^(.*)$ dispatch.cgi [QSA,L] > to > RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] > > and commented the lines > > #AddHandler fastcgi-script .fcgi > #AddHandler cgi-script .cgi > #Options +FollowSymLinks +ExecCGI > > In ''dispatch.fcgi'' file (e:\www\adbk\public\dispatch.fcgi) I > changed the shebang from > > #!D:/runtimes/ruby/bin/ruby > > to > > #!D:/runtimes/ruby/bin/rubyw.exe > > Finally I started Apache, which in my case is running as > a service. > > Based on the text of the log files I''ve listed in the previous mail, > I believe I''m running with WinXP+Apache+FastCGI... > > Now, how about mod_ruby? Is it easy to install/configure? > > I hope I''have helped in some way... > > Greetings, > > Eduardo. > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- - Ramin http://www.getintothis.com/blog _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Hi, Ramin wrote:> Thanks for the setup tips! I''ll definitely try it out. I wasn''t able toYou''re wellcome..> get FastCGI to work on my windows setup, so I gave up and resorted to > mod_ruby. Its extremely easy to set. Just gotta add some lines to your > apache config, modify your .htaccess to read dispatch.rb and that''s it. > I think you gotta copy over mod_ruby.so (or dll) over to your apache > modules folder as well. I dont have the details with me right now casue > I''m at work, but you should be able to find a HOW-TO for mod_ruby.. itsI''ll give mod_ruby a try, as soon as I can...> a lot simpler to setup than fastcgi. > > one thing to watch out for though.. with mod_ruby, you can only run one > rails application at a time on your apache setup. With fastcgi, it > supports multiple rails apps. Or so I''ve heard. I''m happy with myIt''s true I''ve started two applications (with ''no'' problems) using virtual hosts> mod_ruby configuration right now because I''m just using windows for > development purposes. >so do I> Good luck with the errors. I''d recommend giving mod_ruby a try, it might > solve your problems. By the way, have you had any luck getting the fcgi > gem using gem install fcgi ? I couldn''t get that to work either. >I didn''t tryed it out, as I said I used RubyForApache.> On Apr 5, 2005 4:28 PM, *Eduardo Manso* <emneto-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > <mailto:emneto-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> wrote: > > . > . > . >Regards, Eduardo.
On Apr 5, 2005 4:21 PM, Ramin <i8ramin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> one thing to watch out for though.. with mod_ruby, you can only run one > rails application at a time on your apache setup. With fastcgi, it supports > multiple rails apps. Or so I''ve heard. I''m happy with my mod_ruby > configuration right now because I''m just using windows for development > purposes.Also, with mod_ruby, you''re limited to apache. If you want to try out something like lighttpd, you HAVE to use fastcgi (or CGI, but... yuck). -- Urban Artography http://artography.ath.cx
On Apr 5, 2005 2:28 PM, Eduardo Manso <emneto-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m working with the following environment: > ruby182-14.exe > RubyForApache-beta2.exe (installs ''mod_fastcgi.so'') > apache_2.0.53-win32-x86-no_ssl.msiEduardo, I''m running almost the identical environment you are. I saw a bunch of the ruby instances exiting as well, and found some info in the <appdir>\log\fastcgi.crash.log file. Tracked it down to a 0.11.1 fix for Safari: http://dev.rubyonrails.com/ticket/918 If you''re seeing the same stack traces pointing to that area of raw_post_data_fix.rb it may be the same problem as I saw doing form posts. Someone slap me if I''ve broken etiquette by submitting the Trac ticket directly, it wasn''t asking me for credentials :-) Ramin, I had some version problems trying to get FastCGI running manually on my 2.0.39 Apache, some DLL missing symbols, etc., but when I switched to all the recent versions it came up right away. Jim
Ramin: Check your dispatch.fcgi file. Is the log_file_path inside the begin block or is it before the dispatch_error definition? If it is before, try moving it inside the begin begin block. -- Tom. On Apr 5, 2005 1:43 PM, Ramin <i8ramin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''d like to know how you got FastCGI to work on winxp + apache in the first > place. I couldn''t get it to work at all. But then again, maybe its not > exactly working for you either. I ended up going with mod_ruby. Give that a > try... its just as good (if you''re only running a single rails app.) > > > On Apr 5, 2005 2:28 PM, Eduardo Manso <emneto-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hi, > > > > something strange is going on with my WinXP/Apache2/Rails/FastCGI... > > > > When I first start my Rails app I get the following: > > > > 1. In the browser a page with: > > > > Application error > > > > Rails application failed to start properly > > > > 2. Two (2) ''Apache.exe'' and ten (10) ''rubyw.exe'' running instances > > > > 3. In the ''error.log'' (from apache''s ''logs'' dir) > > > > [Tue Apr 05 14:47:34 2005] [notice] Apache/2.0.53 (Win32) > > mod_fastcgi/2.4.2 configured -- resuming normal operations > > [Tue Apr 05 14:47:34 2005] [notice] Server built: Feb 10 2005 06:11:34 > > [Tue Apr 05 14:47:34 2005] [notice] Parent: Created child process 1804 > > [Tue Apr 05 14:47:34 2005] [notice] Child 1804: Child process is running > > [Tue Apr 05 14:47:34 2005] [notice] FastCGI: process manager initialized > > [Tue Apr 05 14:47:34 2005] [notice] Child 1804: Acquired the start mutex. > > [Tue Apr 05 14:47:34 2005] [notice] Child 1804: Starting 250 worker > threads. > > [Tue Apr 05 14:47:45 2005] [warn] FastCGI: (dynamic) server > > "E:/www/adbk/public/dispatch.fcgi" started (pid 3920) > > [Tue Apr 05 14:47:48 2005] [warn] FastCGI: (dynamic) server > > "E:/www/adbk/public/dispatch.fcgi" started (pid 2884) > > [Tue Apr 05 14:47:51 2005] [warn] FastCGI: (dynamic) server > > "E:/www/adbk/public/dispatch.fcgi" started (pid 260) > > [Tue Apr 05 14:47:54 2005] [warn] FastCGI: (dynamic) server > > "E:/www/adbk/public/dispatch.fcgi" started (pid 3284) > > [Tue Apr 05 14:47:57 2005] [warn] FastCGI: (dynamic) server > > "E:/www/adbk/public/dispatch.fcgi" started (pid 3876) > > [Tue Apr 05 14:48:00 2005] [warn] FastCGI: (dynamic) server > > "E:/www/adbk/public/dispatch.fcgi" started (pid 3516) > > [Tue Apr 05 14:48:03 2005] [warn] FastCGI: (dynamic) server > > "E:/www/adbk/public/dispatch.fcgi" started (pid 3424) > > [Tue Apr 05 14:48:06 2005] [warn] FastCGI: (dynamic) server > > "E:/www/adbk/public/dispatch.fcgi" started (pid 1708) > > [Tue Apr 05 14:48:09 2005] [warn] FastCGI: (dynamic) server > > "E:/www/adbk/public/dispatch.fcgi" started (pid 444) > > [Tue Apr 05 14:48:12 2005] [warn] FastCGI: scheduled the start of the > > last (dynamic) server "E:/www/adbk/public/dispatch.fcgi" > process: > > reached dynamicMaxClassProcs (10) > > [Tue Apr 05 14:48:12 2005] [warn] FastCGI: (dynamic) server > > "E:/www/adbk/public/dispatch.fcgi" started (pid 880) > > > > 4. In the ''Apache.log'' (from my rails applications ''log'' dir) > > > > [Tue Apr 05 14:48:18 2005] [error] [client 127.0.0.1] FastCGI: comm with > > (dynamic) server "E:/www/adbk/public/dispatch.fcgi" > aborted: (first > > read) idle timeout (30 sec) > > [Tue Apr 05 14:48:19 2005] [error] [client 127.0.0.1] FastCGI: > > incomplete headers (0 bytes) received from server > > "E:/www/adbk/public/dispatch.fcgi" > > > > 5. In the ''development.log'' (from my rails applications ''log'' dir) > > > > Processing EmnController#index (for 127.0.0.1 at Tue Apr 05 14:49:14 > > Hora oficial do Brasil 2005) > > Parameters: {"action"=>"index", "controller"=>"emn"} > > Rendering emn/index within layouts/default > > Rendering layouts/default (200 OK) > > Completed in 0.090000 (11 reqs/sec) | Rendering: 0.090000 (100%) > > > > 6. The CPU goes to 100% of utilization... > > > > But, the most strange (at least for me) is that after a while, when > > the cpu goes down to normal utilization ( I noticed that at that time > > all rubyw.exe instances are 0% cpu and +-15MB), and if I use > > the application everything goes wright!!! > > Even if I kill nine (9) of hte running ''rubyw.exe'' instances... > > > > Anyone has a clue? > > > > Enviroment: > > > > ruby182-14.exe (one click install) > > RubyForApache-beta2.exe > > actionmailer (0.8.1) > > actionpack (1.7.0) > > actionwebservice (0.6.2) > > activerecord (1.9.1) > > activesupport (1.0.3) > > rails (0.11.1) > > rake (0.5.0) > > > > > ----------------------------------------------------------- > > ...\etc\hosts > --------------------------------------------- > > > > 127.0.0.1 localhost > > > > # "enderecos" virtual host > > 127.0.0.1 enderecos > > > > > ----------------------------------------------------------- > > ...\httpd.cong > -------------------------------------------- > > > > LoadModule rewrite_module modules/mod_rewrite.so > > > > LoadModule fastcgi_module > RubyForApache/modules/mod_fastcgi.so > > > > <IfModule mod_fastcgi.c> > > AddHandler fastcgi-script .fcgi > > </IfModule> > > > > DocumentRoot "E:/www" > > <Directory "E:/www"> > > > > AddHandler cgi-script .cgi > > > > NameVirtualHost *:80 > > > > <VirtualHost *:80> > > ServerName localhost > > DocumentRoot "E:/www" > > </VirtualHost> > > > > <VirtualHost *:80> > > ServerName enderecos > > DocumentRoot E:/www/adbk/public/ > > ErrorLog E:/www/adbk/log/apache.log > > <Directory E:/www/adbk/public/> > > Options ExecCGI FollowSymLinks > > AllowOverride all > > Order allow,deny > > Allow from all > > </Directory> > > </VirtualHost> > > > > > ----------------------------------------------------------- > > .htaccess (on rails app public dir) ----------------------- > > > > # General Apache options > > #AddHandler fastcgi-script .fcgi > > #AddHandler cgi-script .cgi > > #Options +FollowSymLinks +ExecCGI > > > > # Redirect all requests not available on the filesystem to Rails > > # By default the cgi dispatcher is used which is very slow > > # > > # For better performance replace the dispatcher with the fastcgi one > > # > > # Example: > > # RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] > > RewriteEngine On > > RewriteRule ^$ index.html [QSA] > > RewriteRule ^([^.]+)$ $1.html [QSA] > > RewriteCond %{REQUEST_FILENAME} !-f > > RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] > > > > # In case Rails experiences terminal errors > > # Instead of displaying this message you can supply a file here which > > will be rendered instead > > # > > # Example: > > # ErrorDocument 500 /500.html > > > > ErrorDocument 500 "<h2>Application error</h2>Rails application failed to > > start properly" > > > > > ----------------------------------------------------------- > > dispatch.fcgi (on rails app public dir) ------------------- > > > > #!D:/runtimes/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 > > > > Greetings, > > > > Eduardo. > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > -- > - Ramin > http://www.getintothis.com/blog > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-- "Nothing will ever be attempted, if all possible objections must first be overcome." - Samuel Johnson
Hi Jim, Jim Moy wrote:> On Apr 5, 2005 2:28 PM, Eduardo Manso <emneto-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >>I''m working with the following environment: >>ruby182-14.exe >>RubyForApache-beta2.exe (installs ''mod_fastcgi.so'') >>apache_2.0.53-win32-x86-no_ssl.msi > > > Eduardo, I''m running almost the identical environment you are. I saw > a bunch of the ruby instances exiting as well, and found some info in------- Here you mean ''exiting'' or ''existing''? In my case no instance of ruby exits if I don''t kill it by hand (Task Manager -> End Task).> the <appdir>\log\fastcgi.crash.log file. Tracked it down to a 0.11.1I don''t get any ''fastcgi.crash.log''!?> fix for Safari: > > http://dev.rubyonrails.com/ticket/918I''m using Mozilla Firefox 1.0.2 (portuguese translation)> > If you''re seeing the same stack traces pointing to that area of > raw_post_data_fix.rb it may be the same problem as I saw doing form > posts. Someone slap me if I''ve broken etiquette by submitting the > Trac ticket directly, it wasn''t asking me for credentials :-) > > Ramin, I had some version problems trying to get FastCGI running > manually on my 2.0.39 Apache, some DLL missing symbols, etc., but when > I switched to all the recent versions it came up right away. > > Jim > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >I''m new to Ruby and Rails, English isn''t my mother language, so, maybe I didn''t understand something you said. Regards and tanks, Eduardo.