Hi

While trying out a few new repositories, we were http uploading artifacts to 
the repository. This works fine as long as the artifact size is less than half 
the Xmx memory setting on the JVM that does the uploading. If the artifact is 
larger than that, the upload fails with a OutOfMemoryException. Given that we 
can allocate no more than about 1200MB for a JVM, this translates to a maximum 
artifact size of 600MB.

Our largest artifact at the moment is 1,8GB, which we normally deploy using a 
UNC path (file://\\server\path).

Researching the issue, it seems that the sun implementation 
(sun.net.www.protocol.http.HttpURLConnection) 
will<http://www.protocol.http.HttpURLConnection)%20will> store the artifact in 
memory before uploading it to the repository unless chunk encoding or content 
length is set. Theory is that the 1/2 factor comes from the way memory 
allocation is expanded in the PosterOutputStream.

To fix this we tried to set the length of the artifact into the 
LightweightHttpWagon fillOutputData() method but this breaks a lot of tests 
because of the way authentication is implemented;

1. Artifact is posted without Authentication header
2. Server replies with 401 denied
3. Artiact is posted again with Authentication header

However, when setting the content length causes the HTTPURLConnection to NOT 
try again with Authentication header (step 3), thereby breaking all cases where 
repository requires authentication.

Any idea of how this can be solved?

It seems a bit wasteful that artifact is posted twice in case of authentication 
is required. If authentication is set, should it not be set on the first 
request?

Any help on this would be greatly appreciated.

Thanks,

/Allan

Reply via email to