caroalvarezsilva / google-gdata

Automatically exported from code.google.com/p/google-gdata
0 stars 0 forks source link

ResumableUpload: Cannot close stream until all bytes are written #480

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,

I've been getting a _random_ crash 'Cannot close stream until all bytes are 
written' with resumable upload for a long time. It was expected this was fixed 
in Issue 431 but the same problem was reported recently again. Any help is 
appreciated.

What steps will reproduce the problem?
1. Try to upload a big video (>1 Gb)

What is the expected output? What do you see instead?
IOException

What version of the product are you using? On what operating system?
Google Data API : 1.7.0.1

Please provide any additional information below.

9:03:27 PM.354|09|INF|OnProgress: 26% done, [42991615]
9:04:14 PM.816|09|INF|OnProgress: 27% done, [44564479]
9:05:01 PM.809|03|INF|OnProgress: 28% done, [46137343]
9:05:26 PM.118|03|INF|<== OnDone
9:05:26 PM.118|03|DBG|System.Net.WebException has been caught (current pos is 0
9:05:26 PM.321|03|DBG|Error was: System.Net.WebException: The request was 
aborted: The request was canceled. ---> System.IO.IOException: Cannot close 
stream until all bytes are written.
   at System.Net.ConnectStream.CloseInternal(Boolean internalCall, Boolean aborting)
   --- End of inner exception stack trace ---
   at System.Net.ConnectStream.CloseInternal(Boolean internalCall, Boolean aborting)
   at System.Net.ConnectStream.System.Net.ICloseEx.CloseEx(CloseExState closeState)
   at System.Net.ConnectStream.Dispose(Boolean disposing)
   at System.IO.Stream.Close()
   at System.IO.Stream.Dispose()
   at Google.GData.Client.ResumableUpload.ResumableUploader.CopyData(Stream input, HttpWebRequest request, Int32 partIndex, AsyncData data)
   at Google.GData.Client.ResumableUpload.ResumableUploader.UploadStreamPart(Int32 partIndex, String httpMethod, Uri sessionUri, Authenticator authentication, Stream payload, String mediaType, AsyncData data)
   at Google.GData.Client.ResumableUpload.ResumableUploader.UploadStream(String httpMethod, Uri sessionUri, Authenticator authentication, Stream payload, String mediaType, AsyncData data)
   at Google.GData.Client.ResumableUpload.ResumableUploader.Insert(Authenticator authentication, AbstractEntry payload, AsyncData data)
   at Google.GData.Client.ResumableUpload.ResumableUploader.AsyncInsertWorker(AsyncResumableUploadData data, AsyncOperation asyncOp, SendOrPostCallback completionMethodDelegate) - The request was aborted: The request was canceled.
9:05:26 PM.321|03|DBG|Inner Exception messsage: Cannot close stream until all 
bytes are written.

Original issue reported on code.google.com by elijah...@gmail.com on 16 Feb 2011 at 12:37

GoogleCodeExporter commented 8 years ago
Can you show us the snippet of code used to upload big videos?

Original comment by ccherub...@google.com on 16 Feb 2011 at 1:06

GoogleCodeExporter commented 8 years ago
In fact I just adopted the Resumable uploader sample. As far as snippet is 
concerned, maybe this can suit:
            if (this.queue.Count >= this.maxQueue)
                return false;

            UserState u = row.Tag as UserState;
            if (u != null)
                return false;

            return InsertVideo(row, 1);

I will gladly provide other details if this can help. The code was tested and 
proved to be working on many machines, the problem seemed to encounter on poor 
connections.

Original comment by elijah...@gmail.com on 16 Feb 2011 at 1:19