Thursday, March 6, 2008

Flex Upload IO File Error

So we kept getting the infamous file io error when we were doing some very large uploads with our flex upload. We spent a lot of time debugging this and we kept thinking that it had to do with the HTTP Keep Alive on PHP level.

The symptoms are as follows:
User uploads file and it seems to go fine or get through most of the way.
Upon completion of upload (or not), the flex module hangs at 100% uploaded or returns a File IO Error (or similar).
The upload module will work through PHP in most cases, usually when the large files are uploaded, this is when you have issues.

This is what I did to debug the issue.
I went into the PHP tmp folder to actually watch the files as they uploaded. From here I was able to start discerning a pattern of what was happening. It seemed that the file was getting stuck at 5:00 minutes exactly. I was able to replicate the issue and I realized that the process which was handling the upload, must be getting stuck or timing out.

Since it is PHP that is handling the file upload, I went on see what was in phpinfo(). I noticed that the HTTP_Keep alive was exactly 300 seconds = 5 minutes.

This lead me (eventually to the right location), but it was not the http keep alive. I went through regedit in windows and actually searched all the registry kees for the term alive and also for a value of 300.

Nothing seemed to add up.
I eventually remembered that there were several settings in the IIS Metabase that are usually hidden (or rather deep). I went through and did a search for 300 (seconds). I found that the cgi timeout setting was set to exactly this.

I changed this setting to a much higher value, and what do you know... it solved the problem. The CGI timeout value will limit how long your upload will last, so be sure that it is adequate for the size of files that you will be expecting.

Labels: , , , , , , , , , , , , , , , , , ,

0 Comments:

Post a Comment

<< Home