Rails: send_data() takes 120 seconds to send tiny file to browser
I encounter a strange Problem with Rails3 and send_data
. A simple controller action should just send a small file to the browser:
def download
send_data "test", :filename => "file.txt", :type => 'text/plain'
end
When I click the link to that controller action in the browser nothing happens for almost exactly 开发者_C百科120 seconds. After these 120 seconds the file will be downloaded instantly.
The strange thing is, that I can keep on browsing on the other sites of the web app and everything responds within milliseconds. The logfile shows
Rendered text template (0.0ms)
Sent data file.txt (0.8ms)
Completed 200 OK in 24ms (Views: 0.7ms | ActiveRecord: 1.3ms)
Just when i clicked the download link. Nothing is printed to the logfile after theses 120 seconds have passed and the file is actually send to the browser.
I am using Rails 3.0.7, POW and Mongrel on Mac OS X. Tested with Firefox and Chrome.
This was a POW-Problem. A workaround is to use Mongrel or Webrick.
See: github.com/37signals/pow/issues/102
精彩评论