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.

질문됨 3달 전210회 조회
1개 답변
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
지원 엔지니어
답변함 3달 전
  • 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?

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠