Periodic "Task was Canceled" exception downloading file from Google Cloud Storage Bucket to HD .NET

626 views
Skip to first unread message

ryand...@gmail.com

unread,
Jun 19, 2015, 11:57:06 PM6/19/15
to gce-dis...@googlegroups.com
I'm developing a .NET application which at this stage is trying simply to download a text file from a Google Cloud Storage Bucket to my local hard drive using the .NET Cloud Storage API.  My code "Google_DownloadFilefromCloudPlatform" has worked reliably for the past few weeks, but recently I've been receiving an excpetion of "A task was canceled" during the file download step with no additional info.  

What is odd is recently the same code works one day but not the next.  If the code works, it works reliably.  When the code doesn't work it doesn't work consistently for several hours, but usually works the next day.  This is the thrid day in a week I haven't been able to download the same 6MB file from the same bucket using the same code on the same PC from two different networks. Is there a problem with the storage platform, the API or a weakness in my code?

The .NET exception info is below, the function creating the error is at the bottom.

This community has helped me tremendously in the past.  I appreciate your time in advance.  


The message and task info in the exception is below.
Message "One or more errors occurred.
- Task Id = 1, Status = Canceled {6}, Method = "{null}", Result = "{Not yet computed}" System.Threading.Tasks.Task
     AsyncState Nothing
     CancellationPending False
     CreationOptions None {0}
     Exception Nothing
     Id  1
       Result Nothing
     Status Canceled {6}


Function Google_DownloadFilefromCloudPlatform(ByVal service As StorageService, ByVal Bucket As String, ByVal FilePath As String, ByVal FileName As String) As Boolean
            Dim bSuccess As Boolean = False

            Dim lcldataObject As Google.Apis.Storage.v1.Data.Object = New Google.Apis.Storage.v1.Data.Object
            lcldataObject.Name = FileName
            lcldataObject.Bucket = Bucket 

            Dim lclGetRequest As Google.Apis.Storage.v1.ObjectsResource.GetRequest = New Google.Apis.Storage.v1.ObjectsResource.GetRequest(service, lcldataObject.Bucket, lcldataObject.Name)
            lcldataObject = lclGetRequest.Execute()


            lclGetRequest.MediaDownloader.ChunkSize = (256 * 1024)
            Try

                'THE DATA OBJECT ALWAYS RETRIEVES THE CORRECT FILE INFO (SUCH AS CORRECT FILE SIZE) FROM THE CORRECT BUCKET, SO THE SERVICE IS WORKING
                If lcldataObject.Size.HasValue Then

                    ' CREATES AN EMPTY DESTINATION FILE ON THE LOCAL HARD DRIVE AS EXPECTED
                    Dim destinationPath As String = FilePath & FileName
                    Dim downloadStream As FileStream = New FileStream(destinationPath, FileMode.Create, FileAccess.Write)
                   
                    'THIS FUNCTION CALL CREATES THE EXCEPTION OR CORRECTLY DOWNLOADS DATA TO THE FILE DEPENDING ON THE DAY
                    lclGetRequest.MediaDownloader.Download(lcldataObject.MediaLink, downloadStream)
                   
                    bSuccess = True
                End If
            Catch ex As Exception                
                ' FUNCTION PERIODICALLY ENDS UP HERE DURING THE DOWNLOAD FUNCTION
                MsgBox("DownloadFilefromCloudPlatform: " & ex.Message)
            End Try

            Return bSuccess
End Function



Kamran (Google Cloud Support)

unread,
Jun 24, 2015, 2:28:14 PM6/24/15
to gce-dis...@googlegroups.com, ryand...@gmail.com
Hi Ryan,

This seems like a question that would be better posted to stackoverflow, rather than a discussion post. This isn't the right place to look for 1-on-1 support, though, being a forum meant for general discussion of the platform, and you should take a question like this to stackoverflow, being sure to include all relevant details that would help somebody debug.

I wish you luck in finding a solution on stackoverflow, and have a nice day!

Sincerely, 

Josue Martinez

unread,
Oct 31, 2018, 5:22:33 PM10/31/18
to gce-discussion
The same is happening to me and have no idea why

Digil (Google Cloud Platform Support)

unread,
Nov 1, 2018, 2:22:54 PM11/1/18
to gce-discussion
Please post your concern in stackoverflow.com (as suggested by the other support member) as this would be more helpful for you. While posting the concern there, try to include as much as details(including the error logs(if any)) of the issue. I hope this helps you.

Justin Reiners

unread,
Nov 1, 2018, 3:12:22 PM11/1/18
to josue.ma...@gmail.com, gce-dis...@googlegroups.com
I have 40 million photos in google cloud, sometimes while processing them I got a 503 from the service and my program would fail. I had to add a try except (python) with a retry in case of fails, around the download function or my program would never finish.

normally when I get the 503 it's salt and peppered throughout, the retry makes it work 100%, might help for you as well.

--
© 2018 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043
 
Email preferences: You received this email because you signed up for the Google Compute Engine Discussion Google Group (gce-dis...@googlegroups.com) to participate in discussions with other members of the Google Compute Engine community and the Google Compute Engine Team.
---
You received this message because you are subscribed to the Google Groups "gce-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gce-discussio...@googlegroups.com.
To post to this group, send email to gce-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gce-discussion/c9181946-cabb-4050-a5a5-c43c2f88f13a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages