Tuesday, March 31, 2009

Connection Reset error resolved

I just resolved the weirdest bug with a web site.  I had already built this web site for a customer which includes a way to upload Excel spreadsheets, parse them and store them in a MySQL database.  The code was working fine on my development server, and on the test server, and the customer could use it.

When I pushed the code to the production server, the upload just would not work.  It kept giving the error, "Connection Reset", in the Firefox browser, along with the message: "The connection to the server was reset while the page was loading."

I went back and tested it on my development server - and the same issue was happening!  I could not upload any spreadsheet files, the error would instantly occur; no time-out period or anything.

I tried adding debug statements early on in the PHP code which received the file, but the browser would not render any HTML at all; the error came up before that point!

Solution

It turns out it was a firewall issue on my end.  I had set up port blocking a few days prior to keep my kids' computers from hogging all my bandwidth - I blocked ports 6881 thru 6899, the Bittorrent ports, so that I could actually get some work done.

For some reason, those ports were being used by file uploads of any sort, at my end!

So if you have problems with file uploads giving this kind of error, check your firewall settings.  It could be close to you (within your control), our at your Internet service provider's end (they're blocking ports for you).  My Qwest DSL business-Internet line has no ports blocked by the provider, thank God.