On Mon, 03 Oct 2005 22:21:13 +0900, Gianni Jacklone <gianni / one6ix.com> wrote: > I've had some big headaches when uploading files in a Rails app of > mine. I'm not sure if my issue is related to what you're seeing, but I > figured I would describe my issue just in case. A quick answer is that I don't think it is the same problem, although having lots of temp files could be causing your problem. > My issue occurs on a form that has many form elements and possibly > many file uploads (max is about 20). I run my Rails app under > FastCGI, and every now and again a FCGI::Stream::ProtocolError will be > thrown when processing a file upload that will leave my app > unresponsive after this. I have to manually kill the fcgi process that > the Exception was thrown from, since it seems to go zombie > afterward. Here's what the exception trace looks like, it seems to > originate in the read_multipart method in cgi.rb which is why I > figured this may be related: > [Wed Jul 06 15:35:46 EDT 2005] Dispatcher failed to catch: protocol > error(FCGI::Stream::ProtocolError) > /opt/local/lib/ruby/1.8/cgi.rb:1015:in `read' [Snip more of backtrace ...] My suspicion with this is that FCGI may be timing out, thus breaking the connection. I would increase the -idle-timeout for your FCGI programs. Although, I doubt this is the same problem it is quite possible that your request is so busy making temp files that during this time your FCGI is timing out. It can also be that your clients are simply canceling the request during the post. > On a side note, my /tmp dir usually has a bunch of TempFiles laying > around in it, that I manually clean up from time to time. Are > TempFiles supposed to stick around after an upload is completed? Maybe > they never get cleaned up when this Exception is thrown. This is part of the problem that I am discussing as you might be creating more temp files than needed due to the read_multipart implementation. TempFiles should be deleted when they are cleaned up by the GC, but if the system crashes then there is a chance that you keep these files. As I said I am not positive that your problem is 100% related to what I have found, but please try the modification I posted it might fix it. If it doesn't then maybe you want to discuss this on the Ruby-Talk or Rails mailing list. Best, Zev Blut