Increasing web request timeout
Hi,
I am receiving timeout (or a task was canceled) error when calling "Cloudinary.Upload" function for some of my images recently.
Is there any way to increase the timeout for web request.
I am using .Net wrapper for Cloudinary. The stack trace is below.
Best regards,
Mojtaba
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at CloudinaryDotNet.ApiShared.Call(HttpMethod method, String url, SortedDictionary`2 parameters, FileDescription file, Dictionary`2 extraHeaders)
at CloudinaryDotNet.ApiShared.CallAndParse[T](HttpMethod method, String url, SortedDictionary`2 parameters, FileDescription file, Dictionary`2 extraHeaders)
at CloudinaryDotNet.ApiShared.CallApi[T](HttpMethod method, String url, BaseParams parameters, FileDescription file, Dictionary`2 extraHeaders)
at CloudinaryDotNet.Cloudinary.Upload[T,TP](TP parameters)
at CloudinaryDotNet.Cloudinary.Upload(ImageUploadParams parameters)
-
Hi Mojtaba,
How long is the API call taking before it times out? You may be reaching the client-side timeout for the call made by our SDK rather than a timeout on our server-side.
if so, you can adjust the client-side timeout by setting a higher value in teh SDK configuration: https://support.cloudinary.com/hc/en-us/articles/206078351-How-can-I-increase-the-timeout-when-uploading-to-Cloudinary-If you're uploading large files and those are timing out, you may also want to send the upload as a chunked upload instead of a single API call, via the UploadLarge method: https://cloudinary.com/documentation/upload_images#chunked_asset_upload
Regards,
Stephen0 -
Hi Stephen,
Thanks for your reply.
I increased the client-side timeout to 10 minutes, but after about 90 seconds I receive the following error:
A task was canceled.
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at CloudinaryDotNet.ApiShared.Call(HttpMethod method, String url, SortedDictionary`2 parameters, FileDescription file, Dictionary`2 extraHeaders)
at CloudinaryDotNet.ApiShared.CallAndParse[T](HttpMethod method, String url, SortedDictionary`2 parameters, FileDescription file, Dictionary`2 extraHeaders)
at CloudinaryDotNet.ApiShared.CallApi[T](HttpMethod method, String url, BaseParams parameters, FileDescription file, Dictionary`2 extraHeaders)
at CloudinaryDotNet.Cloudinary.Upload[T,TP](TP parameters)
at CloudinaryDotNet.Cloudinary.Upload(ImageUploadParams parameters)The file size is about 4MB. I am processing two breakpoints for this image;
{{
"create_derived": false,
"bytes_step": 15000,
"max_images": 20,
"min_width": 320,
"max_width": 5000
}}AND
{{
"create_derived": false,
"bytes_step": 15000,
"max_images": 22,
"min_width": 128,
"max_width": 2304,
"transformation": "ar_3:2,c_fill,g_auto:subject"
}}.When I process the breakpoints in two separate requests it works with no problem. Any idea where the issue might be?
Regards,
Mojtaba
0 -
That still looks like a timeout somewhere in your code -
Certainly, it shouldn't take 90 seconds to upload an image and request the breakpoint generation unless the internet connection is very slow, and uploading the file itself is taking a long time. If you make the upload "async" does it work?
Note that if the upload is async, the response you get won't include the breakpoints or any other information about the uploaded file but it means that the processing takes place in the background which may help you to see where the delay is.0 -
My internet is quite fast, and I am processing some other images even with a bigger size with no problem. Please note that this issue only occurs for certain images.
As I said if I process responsive breakpoints in two separate requests it works. So, I guess the problem is not in uploading the file but rather in processing those two responsive breakpoints together (probably in your end).
I did try UploadAsync and got the same error i.e., "a task was canceled".
0 -
Can you please open a ticket here (https://support.cloudinary.com/hc/en-us/requests/new) so we can get more customer-specific details about your request? Please include your cloud name in the ticket.
0
Post is closed for comments.
Comments
5 comments