Helicon Zoo を使用して、Windows Server 2008 マシンに Rails アプリケーションをセットアップしました。
私の問題は、400MB を超えるファイルをダウンロードすることです。
私の Rails アプリでは、以下を使用してクライアントにファイルを送信します。
アプリ/コントローラー/hosted_files_controller.rb
class HostedFilesController < ApplicationController
before_filter :authenticate_user!
around_filter :catch_not_foun
def download
@footprint = UserAbility.new(current_user).footprints.find(params[:id])
send_file path
end
private
def path
if @footprint.subpath?
@path = "#{HOSTED_FILES_PATH}\\#{@footprint.subpath}\\#{@footprint.filename}"
else
@path = "#{HOSTED_FILES_PATH}\\#{@footprint.filename}"
end
end
def catch_not_found
yield
rescue ActiveRecord::RecordNotFound
recover_and_log "We couldn't find that record.", "No record found using the id (#{params[:id]})"
rescue ActionController::MissingFile
recover_and_log "We couldn't find the file on our server.", "The file was not found at the following path: #{@path}"
end
def recover_and_log (displayed, logged)
logger.info "!!! Error: #{logged}"
redirect_to root_url, alert: displayed
end
end
Apache または Nginx を使用していないため、 production.rb ファイルで config.action_dispatch.x_sendfile_header をコメントアウトしました。
これは、サーバー上の 400MB 未満のすべてのファイルに最適です。それを超えると、Helicon Zoo から次のような 500 内部サーバー エラーが発生します。
Helicon Zoo module has caught up an error. Please see the details below.
Worker Status
The process was created
Windows error
The pipe has been ended. (ERROR CODE: 109)
Internal module error
message: ZooApplication backend read Error.
type: ZooException
file: Jobs\JobBase.cpp
line: 566
version: 3.1.98.508
STDERR
Empty stderr
何が起こっているのか誰にも分かりませんか?私は途方に暮れています。
私はもう試した:
- send_file の buffer_size を増やす (機能しませんでした)
- IIS でアプリケーション プールのメモリ設定をいじる (うまくいかなかった)
- x_sendfile_header を X-Sendfile および X-Accel-Redirect に変更 (機能しませんでした)
Windows Server に Apache をインストールし、x_sendfile_header を使用してファイルを Apache に送信する負荷を軽減することを検討していますが、既に (ほぼ) 動作しているアプリケーションを台無しにすることを恐れています。
誰にもこれを修正する方法のアイデアはありますか?