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: , , , , , , , , , , , , , , , , , ,

Tuesday, February 26, 2008

Fedex Track Service v2 : Cannot Authenticate

I was trying to deploy the track service via api for one of my clients and I was using the fedex php examples they provided. Unfortunately, I kept on getting an authentication error. It seemed the credentials Fedex had provided me where invalid. I tested this across several servers and then moved on to other api calls... it seemed it was the track service that was causing the issue.

After much debugging, support tickets, and hair turned white - we were finally able to get to the bottom of it. If you look in the wsdl, the call to the gateway is being made to

https:///gateway.fedex.com:443/web.services

try changing this to

https://gatewaybeta.fedex.com:443/web.services

the simple difference is the beta in 'gatewaybeta'. This routes you to the testing servers vs the production servers.

Hope this helps you. I spent days going back and forth on this.

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