Forum: Ruby on Rails Large(er) File Uploads

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
lists (Guest)
on 2005-12-09 02:06
(Received via mailing list)
Howdy Folks,

My Rails app allows file uploads in several places. Most of the time the
files are pretty small (under 1MB) and we never have any trouble.

There is one section where the files are a bit larger, about (10-15MB).
section uses the same code as other places and works with small files.

It breaks with larger files... This is what happens on both server
(FCGI/Apache) and local (WebBrick):

Upload the file and click 'Submit'. The gears turn, looks fine... Then
just chugs along, forever. Nothing happens, it just sits there. Apache
go forever, WebBrick eventually dies with an error that it can't find
action (strange error).

So, does anyone have any suggestions (other than 'don't use HTTP for
of this size'). I realize that FTP and other solutions are better for
files but in my opinion this file isn't all that large and I'm pretty
that other folks have accomplished this... Strongspace is a Rails app
and I
believe handles this situation.

Any advice is very much appreciated.

vanek (Guest)
on 2005-12-09 13:31
(Received via mailing list)
If you're using MySQL the default max_allowed_packet size is set to 1M,
meaning that
you cannot transfer/receive records larger than 1 megabyte. Resetting
in the my.ini file to something like 8M and restarting the db may fix
your problem.

lists (Guest)
on 2005-12-09 20:22
(Received via mailing list)

I'm actually not on MySQL, we're on Postgres... But these files are
stored in the filesystem, not the database so I don't think that's
into play.
vanek (Guest)
on 2005-12-09 20:44
(Received via mailing list)
if you're running apache you may want to check directives:

  RLimitCPU max
  RLimitMEM max
lists (Guest)
on 2005-12-09 21:09
(Received via mailing list)
Thanks, I will.

I do notice the following errors in my FCGI crash log:

[09/Dec/2005:10:40:51 :: 20136] Dispatcher failed to catch: protocol
  /usr/local/lib/ruby/1.8/cgi.rb:1015:in `read'
  /usr/local/lib/ruby/1.8/cgi.rb:1015:in `read_multipart'
  /usr/local/lib/ruby/1.8/cgi.rb:983:in `loop'
  /usr/local/lib/ruby/1.8/cgi.rb:983:in `read_multipart'

i_ext/raw_post_data_fix.rb:20:in `initialize_query'
  /usr/local/lib/ruby/1.8/cgi.rb:2269:in `initialize'
  (eval):16:in `initialize'
  /usr/local/lib/ruby/gems/1.8/gems/fcgi- `new'
  /usr/local/lib/ruby/gems/1.8/gems/fcgi- `each'
almost killed by this error

This occurs when the upload is in process.
This topic is locked and can not be replied to.