HttpURLConnection setChunkedStreamingMode() and SocketTimeoutException's

Hi All,

We have a WebSphere/Java application that uses a file management applet on client machines. We encountered a frustrating upload limit of about 40 MB and found that the applet was throwing an OutOfMemory error. We've come across the HTTPURLConnection setChunckedStreamingMode() method available in Jave 1.5 and are testing it out.

Our applet loops through a list of files and sends each one up to the server individually:

create and open a url connection

get output stream

send multipart post (multipart/form-data) (i.e. an individual file)

get inputstream and read success/failure result of attemtping to upload the file

In testing, the first file in the list always uploads successfully. We can now upload a file larger than 40 MB. However, the rest of the files in the list are sporadic - some succeed and others fail. For the files that fail, we see timeout exceptions:

org.apache.commons.fileupload.FileUploadException: Read timed out

caused by:

java.net.SocketTimeoutException: Read timed out

Interestingly, if we put the upload thread to sleep for 5 - 10 seconds in between uploading each file, the incidence of failures goes down, but is not eliminated. Has anyone come across this issue with setChunkedStreamingMode()? Any idea what's going on here or how to resolve it?

[1361 byte] By [kpmga] at [2007-11-27 8:53:59]
# 1

Does this happen under load or irrespective?

If under load, it is possible that your server is getting bogged down by too many connections being setup and torn down. Have you considered re-using a single HTTP request to send all your files rather than reconnecting for each individual file?

-Raj

rituraj_tiwaria at 2007-7-12 21:12:25 > top of Java-index,Core,Core APIs...