AmazonServiceException: A WebException with status RequestCanceled was thrown.

0

Hello community, I have a question regarding an exception that we are getting often and it is causing some extra computation from our side due to the retries that we have to do in order to process a job. During the execution of the job when we try to download some data from S3 using the S3 client we might get the following error: Inner WebException: The request was aborted: The request was canceled. from System at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action1 endAction, Task1 promise, Boolean requiresSynchronization) at async Amazon.Runtime.Internal.HttpRequest.GetResponseAsync(?) at async Amazon.Runtime.Internal.HttpHandler`1.InvokeAsync at async Amazon.Runtime.Internal.RedirectHandler.InvokeAsync at async Amazon.Runtime.Internal.Unmarshaller.InvokeAsync at async Amazon.S3.Internal.AmazonS3ResponseHandler.InvokeAsync at async Amazon.Runtime.Internal.ErrorHandler.InvokeAsync This is forcing us to fail the job and retry. I would like to mention that before opening this question we have updated our package from : 3.7.202.3 to 3.7.300.1 and the error is still present.

All operations are async before calling the S3 client.

demandé il y a 3 mois210 vues
1 réponse
1

Hi,

Greetings for the day!

Please note that the error "WebException: The request was aborted: The request was canceled" might be because of below reasons:

    Timeout (100 sec by default)
    Executing async method and not awaiting it
    Executing async void method
    Running job in different task/thread and not waiting it to complete

Please refer the below third party articles: [+] https://stackoverflow.com/questions/52647818/a-task-was-canceled-exception-when-trying-to-upload-file-to-s3-bucket [+] https://stackoverflow.com/questions/55786738/task-was-cancelled-exception-when-uploading-file-to-s3-bucket-using-aws-net-sdk [+] https://stackoverflow.com/questions/13903150/transferring-large-files-to-amazon-s3-using-c-sharp-request-aborted-and-cancel [+] https://stackoverflow.com/questions/21548604/the-request-was-aborted-the-request-was-canceled-no-solution-works

NOTE : Kindly note that the documents shared here are third party documentation not endorsed by AWS.

If you have any further queries, please feel free to reach out to AWS Support along with your specific error and details, and we would be happy to assist you further.

[+] Creating support cases and case management - https://docs.aws.amazon.com/awssupport/latest/user/case-management.html

AWS
INGÉNIEUR EN ASSISTANCE TECHNIQUE
répondu il y a 3 mois
  • Hello, I have a question on your third suggestion "Executing async void method". We are uploading and downloading using async Task signature because ITransferUtility is also using async Task signature and not returning a status or any response back so the entire chain is using async task. Our tasks are awaited indeed, what we haven't done so far is to extend the timeout, but wouldn't the exception be different in case of timeout?

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions