Megabytemb / google-gdata

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

DirectUpload in .NET Non-Responsive with Large Files #588

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Start a background upload process (YouTubeRequest.Upload) using 
Task.Factory.StartNew()
2. Use a larger file >50MB

What is the expected output? What do you see instead?
The upload starts, as indicated by the YouTube video manager.  About 2 min into 
the transfer, YouTube shows Failed: upload aborted.  A failed exception is not 
thrown to .NET, neither is it successful.  I have found no way in .NET to 
lengthen the time this thread is allowed to complete.  It has been suggested 
that .NET does not just drop tasks, and that it must be hanging while awaiting 
a response.  The code does work with smaller files, <10MB, but not larger ones.

What version of the product are you using? On what operating system?
VB.NET 4.0

Please provide any additional information below.
Here is the relevant logic.  

'executes
cmdupdate = New SqlCommand("Update transactions set name='upload started' where 
transactionid='18'", conHyperData)

        Try
            'executes as indicated by YouTube manager
            Dim createdVideo As Video = request.Upload(vidupload)
        Catch ex As Exception
            'never executed
            cmdupdate = New SqlCommand("Update transactions set name=@name where transactionid='18'", conHyperData)
            cmdupdate.Parameters.AddWithValue("@name", "failed - " & ex.ToString)
        End Try

        'never executed
        cmdupdate = New SqlCommand("Update transactions set name='upload finished' where transactionid='18'", conHyperData)

This routine is called like this:

Dim uploadtask As Task = Task.Factory.StartNew(Sub() begin_upload(), 
TaskCreationOptions.LongRunning)

Thank you for any light you might be able to shed on this issue.

Original issue reported on code.google.com by gbus...@gmail.com on 30 Apr 2012 at 5:24

GoogleCodeExporter commented 9 years ago
You shouldn't use direct upload with big files and instead rely on resumable 
upload:

https://developers.google.com/gdata/docs/resumable_upload

The YouTubeUploader sample shows how to implement it:

http://code.google.com/p/google-gdata/source/browse/#svn%2Ftrunk%2Fclients%2Fcs%
2Fsamples%2FYouTubeUploader

Original comment by ccherub...@google.com on 30 Apr 2012 at 5:52

GoogleCodeExporter commented 9 years ago
Thank you, this was driving me crazy all weekend!

Original comment by gbus...@gmail.com on 30 Apr 2012 at 7:41