AnsweredAssumed Answered

UploadContentServlet called from .NET fails for big files

Question asked by malfresco on Jun 15, 2009
Latest reply on Jun 25, 2009 by malfresco
Hi,

Short scenario description:
Client machine: not relevant (anyway: CPU intel dual core 2200, RAM 2GB, SO 2008 server 32b)
Server machine: CPU intel 2x2 1800, RAM 4GB, SO open suse 11.0

Alfresco 3 labs(with derby)
- non default java_option Xmx increased to 1.5GB
   

I'll describe shortly my problem, anybody can help I'd appreciate.


I try to upload big files content to alfresco repository using a C# small application;

C#-pseudo snippets:________________________

string url = "http://NOT_LOCALHOST_MACHINE:PORT/alfresco/upload/workspace/SpacesStore/NODE_UUID/FILENAME";
url = url + ticketInfo;

HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
request.Timeout = 1000 * 60 * 10;//it doesn't affect too much. if I set a very small value I'll get a time out
request.Method = "PUT";

Stream requestStream = request.GetRequestStream();

MYCOPYSTREAM_METHOD(requestStream, souceFileStream);
//CRITICAL POINT 1

requestStream.Flush();
requestStream.Close();

HttpWebResponse response = request.GetResponse() as HttpWebResponse;
//CRITICAL POINT 2

Console.WriteLine(response.StatusCode);

___________________________________


Explanations/PROBLEMS:

//CRITICAL POINT 1
Out of memory exception if the source file is => 1GB (the biggest file successfully uploaded was around 980MB big). I have tested MYCOPYSTREAM_METHOD using 2, 4 and 6 GB files copied from local to a remotely mapped drive and it works.

//CRITICAL POINT 2
Supposing I try to upload big file, but smaller than 1GB (e.g. 400MB), I get time out regardless how big is set the "request.Timeout" value and even the file content was successfully uploaded (I can see it, and it has the appropriate content, into /opt/alfresco/alf_data/contentstore/… folder)

NOTES:
MYCOPYSTREAM_METHOD uses byte array buffer (usually 1024 lenght, but customizable via property file) to iterativelly read from source and write to destination, and nor source nor destination are closed/disposed inside it.


Thank you in advance,

malfresco

Outcomes