Deadlock When Use open-uri in Web Controller

熊节
2005-09-22T03:31:55Z

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