Hi all,
I've been gathering data on uploads failing under Windows with Error #2038 lately, and I've found a definite cause. It might not be what's causing them all, but it certainly is in my case.
WinXP + Kaspersky AntiVirus.
I've tested on about a dozen machines, with differing versions of XP service packs and patches, and I've got 100% correlation. With Kaspersky enabled, it fails every time under IE6/7/8, Firefox and Chrome, and I haven't seen a single failed upload with it disabled or not installed.
The symptoms are as follows - say you're uploading a 20MB file, the progress bar streaks ahead to about 5MB uploaded within the first second or two, then stalls. Sometime within the next couple of minutes, the upload fails, and the server sees the connection close prematurely.
With smaller files, the same streaking/stalling problem happens, but the upload sometimes completes successfully. I assume there's some timeout window that smaller files can slip through.
I tested it on apache2 with a rails app behind it, and nginx running with nginx_upload_module to catch the request, and both behaved identically.
Next: test whether other antivirus packages cause similar problems, and find a solution that doesn't involve just turning antivirus off!
Cheers
@ben_h
May 7, 2009 - 9:32am
We will add this information do the documentation.
I think it might also be a good idea to create a plugin that detects this kind of behavior. We do something like watch the upload time and see if a file is uploaded unusually fast and then see if there is a long delay. If that happens we'll trigger an event. This event wouldn't affect the upload but just notify the site that something fishy is going on. Then a message can be displayed asking the user to do something else, or disable their antivirus and try again (if it fails), etc.
What we need for something like that is good numbers on how long it takes for the upload to shoot to 100% and how long we should wait after shooting to 100% before firing the event.
May 7, 2009 - 10:49am
Yep, good idea. I'll record a screencast of a failed upload so you can take a look at it.
May 7, 2009 - 12:53pm
sorry I disabled the only antivrus I have, avast, and it didn't resolve this issue, I am still getting errors 2038 and 2044.
Would a crossdomain.xml be any help?
how can we debug to see many informative messages?
thanks
May 8, 2009 - 9:13am
It depends on the cause of the problem. You can get 2038 for any network connection failure so it's cause can be hard to determine.
2044 is a security error, I believe, so if you are attempting to upload to a different domain that swfupload.swf is hosted on a crossdomain.xml should solve that problem.
May 10, 2009 - 10:10pm
Hi again folks, a followup on my original post:
I tested with AVG, CA eTrust & Symantec, and none of then caused the stalling problem.
I fixed the problem by enabling https for uploads. With https on, Kaspersky can't intercept the transmission, because it would be a classic man-in-the-middle attack - one of the things that SSL was designed to prevent.
I assume Kaspersky is using some sort of transparent proxy for uploads, where the browser uploads directly to the transparent proxy, and the proxy forwards the request on after scanning it for malware. It seems the problem is that Kaspersky accepts data too quickly from the browser, fills its buffer, and then doesn't accept any more data while it streams what it has received out over the internet at a much slower rate. During this delay, the browser thinks the connection has been broken and closes the request.
That's my guess anyway. The important bit is that turning on SSL fixed everything for me.
Cheers
Ben
May 15, 2009 - 8:30am
I ran into the same problem with Kaspersky on a large project a couple of days ago with some very large (~ 200 MB) video files. Sometimes I got an 2038 I/O Error and sometimes the upload appeared to work but the PHP script reported an error of UPLOAD_ERR_PARTIAL, i.e. the file was not transferred completely.
Disabling Kaspersky AV solved the problem.
Judging from this post on the Kaspersky website (http://forum.kaspersky.com/index.php?showtopic=88376), this appears to be a general issue with Kaspersky's "transparent proxy" implementation and HTTP POST uploads.
July 7, 2009 - 12:49pm
For asp.net, a web.config setting specifies http runtime, including the maximum upload size (max file size). Although the upload is done via flash; the http runtime provides the underlying transport layer which restricts file size and execution timeout via user definable limitations.
For SWFUpload in asp.net applications this setting will need to be added to the web.config file so large files uploads can be done without getting an error message (Error #2038… flash I/O error).
Add this between the system.web tags in the web.config file…
For File Upload/Download Functionality. Sets Max File
Upload Size In K Bytes ~1gig Upload with timeout to 1hr.
httpRuntime enable="true" maxRequestLength="1048576"
executionTimeout="9600" maxWaitChangeNotification="1200"
requestLengthDiskThreshold="1024"
July 8, 2009 - 7:49am
thanks
April 26, 2010 - 4:50pm
If that didn't fix your problem, try upping your file size limits if you're using IIS..
How to increase file limit in IIS
May 10, 2010 - 6:17am
Hi, Yes Jvernon is right
Putting that httpRunTime ...tag solved the problem..
Thanks again.