Hi, all.
In a controller, if I open an url to read, and if this url is mapped to another
controller in same application, Rails will be deadlocked and timeout. For
example:
# File: /app/controllers/test_controller
require ''open-uri''
class TestController < ApplicationController
def test1
render :text => "Hello, World!"
end
def test2
url = url_for :controller => ''test'', :action =>
''test1''
result = ''''
open(url) do |http|
result = http.read
end
render :text => result
end
end
# file end
When access http://localhost:3000/test/test2 , there will be an exception:
Timeout::Error in Test#test2
execution expired
Environment as following:
ruby 1.8.2 (2004-12-25) [i386-mswin32]
rails-0.11.1
development
How can I solve this problem? Thanks in advance.
Gigix
François Beausoleil
2005-Sep-22 03:36 UTC
Re: Deadlock When Use open-uri in Web Controller
Hi ! 熊节 said the following on 2005-09-21 23:31:> When access http://localhost:3000/test/test2 , there will be an exception: > Timeout::Error in Test#test2 > execution expired > > Environment as following: > ruby 1.8.2 (2004-12-25) [i386-mswin32] > rails-0.11.1 > developmentYour problem is most probably related to using WEBrick. If you were to use Apache or Lighttpd, you''d probably be better off. Also, did you know Rails is up to 0.13.1 ? You should probably upgrade. Bye ! François
Thx! I tried to configure my rails app on Apache (without FastCGI). It seems that my ".htaccess" file works, but when invoking dispatch.cgi, there appear a 500 error. And in server.log: [Thu Sep 22 13:52:50 2005] [error] [client 127.0.0.1] couldn't spawn child process: d:/eclipse31/workspace/forumonrails/public/dispatch.cgi Did anybody meet this problem? How to solve it? Gigix>Hi ! > >熊节 said the following on 2005-09-21 23:31: >> When access http://localhost:3000/test/test2 , there will be an exception: >> Timeout::Error in Test#test2 >> execution expired >> >> Environment as following: >> ruby 1.8.2 (2004-12-25) [i386-mswin32] >> rails-0.11.1 >> development > >Your problem is most probably related to using WEBrick. If you were to >use Apache or Lighttpd, you'd probably be better off. > >Also, did you know Rails is up to 0.13.1 ? You should probably upgrade. > >Bye ! >Fran?ois > >_______________________________________________ >Rails mailing list >Rails@lists.rubyonrails.org >http://lists.rubyonrails.org/mailman/listinfo/rails= = = = = = = = = = = = = = = = = = = _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails