Closed dankohn closed 4 years ago
I've added a time limit to 20s and a size limit 1.5MB. Maximum time in google cloud functions had been increased to 30s, but after 20s the request will be stopped with an error message.
Still need to update docs and add a test for a maximum size. The timeout was tested locally with a small (1s) value
Is the 20s time limit live yet? I'm still getting a 10s timeout error:
Curl examples had been added.
@cjyabraham any chance to reproduce this again? I was not able to get a timeout, is it possible that cURL itself has a timeout ? Can you reproduce this on a autocrop web site ?
I do not get the timeout on the https://autocrop.cncf.io/ website. It looks like the timeout is originating from curl. I increased it to 20s and now I hit this timeout when I try and upload the car, USA counties, and also for the openvdb logo. I then tried going to 30s. The car and usa counties now work, however, for the openvdb logo I just get this unhelpful message:
It also doesn't seem to work on the web ui either. It just keeps saying "Work in progress. Please wait ...". Any thoughts on that?
Thanks for a great example. So far the problem is that it takes some time for SVGO to handle this example, I think it takes 30-40s locally on my mac. The solution would be to increase the timeout up to 60 seconds, then this example will work. Somehow just the svg file is heaving too much elements to process.
We want it to time out after 20 seconds and produce a clear error.
Ok, I'll make the code a bit more complex and will run it in the background process, to guarantee that we return a clear error instead of cryptic 500 response from a google cloud.
Should we set the timeout to 30s? I'm concerned our editors will get too many timeouts for complex logos and will have no plan B except for pinging me in Slack :P
Slack? They can just call your cellphone to take advantage of your 24/7 SVG upload support.
I think everything works now. I made it running in the background process, so after 20 seconds, or may be a bit more, timeout occurs and an error message is returned.
@cjyabraham sadly, we can not easily increase a timeout to 60 seconds, because after 26 seconds netlify will cut off a request completely. If people demand this service to work on such complex SVG files, I'll have to add a CORS support for the google cloud functions and call it cross domain from our web page. Right now we use a Netlify proxy for a web site.
Ok, thanks for checking out our options. @dankohn anything more you want before we close this issue?
No. Note that all logos on all 11 landscapes process correctly with the given timeout. It's only the pathological ones you found that might cause a problem. We can obviously revisit if the Autocrop service proves unreliable.
Try running these pathological cases against autocrop.cncf.io. I think we should reject any SVG greater than 1.5 MB as it's unlikely to be a real company logo. We also may want to time out at greater than 20 seconds, but in that case, we should probably post the offending SVG to Slack to evaluate what's happening.
The timeout needs to be more than 10 seconds, as @cjyabraham got this error:![image](https://user-images.githubusercontent.com/3083270/73596025-886c7000-44ec-11ea-9a06-a35806d757b7.png)
The Autocrop site works for me with this 1.1MB SVG: https://upload.wikimedia.org/wikipedia/commons/5/59/Usa_counties_large.svg
But it sometimes hangs on this 3.81MB one: https://upload.wikimedia.org/wikipedia/commons/6/63/A_large_blank_world_map_with_oceans_marked_in_blue.svg
@cjyabraham got an error on this 18kB image: https://upload.wikimedia.org/wikipedia/commons/6/67/Firefox_Logo%2C_2017.svg
The largest real company logo I'm aware of is https://github.com/cncf/landscape/blob/master/hosted_logos/babylon.svg at 842kB and https://github.com/AcademySoftwareFoundation/aswf-landscape/blob/master/cached_logos/open-vdb.svg at 1.06MB.