Open Skrypt opened 8 months ago
Do you have some kind of a repro? What we see on the OC homepage might be this?
Here, I can't repro that quick but it would look more like this:
Are you using Azure Blob Storage? Because then https://github.com/OrchardCMS/OrchardCore/issues/15016 might help.
Yeah, this website fetches the original image from an Azure Blob Storage account.
Then I suggest you make a try with the prototype code I added under the issue (or the cleaner one under the PR) and see if it helps.
Is that a bug in ImageSharp or Orchard? Have you managed to explain what triggers it?
To be honest, no, I couldn't find why it was happening. Either it was failing to download entirely the image from the blob storage because it was not entirely uploaded (which I would be surprised of). Or, a network issue happened in the middle of the resize of this image by ImageSharp which is totally arbitrary.
The issue is not really there. I think you can't prevent this from happening because of ... weather ... The thing I would like though is to be able to find and purge this image from the ImageSharp cache easily instead of purging it entirely.
Sometimes ImageSharp doesn't finish to process / resize an image and it produces an image in it's cache with a blank bottom part.
So far, to resolve this issue; we clean up the ImageSharp cache to reinitiate the process to create the cached image.
Having a background task to purge the is-cache periodically would automate that process. Of course, this is not the appropriate fix but at least a tool to use in the mean time.
Another way would be to add a data-attribute on these images that points to the actual image-cache folder to be able to remove them with an admin tool on frontend UI. Basically, each images that are resized by ImageSharp, we should be able to purge the cached item without needing to find it in the is-cache folder (almost impossible).