-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bugfix for thumbnails TmpStore generation #14615
bugfix for thumbnails TmpStore generation #14615
Conversation
Review Checklist
|
Hey @bitbirddev, I tried to reproduce it but the entries in the table Is there another way of reproducing it? Maybe you can show me a video of the problem? |
@mattamon i hope this helps: Link to Video |
please also keep in mind that you have to clear temporary files before trying the steps in the video. after doing the steps in the video, the file "wiss Begleitung.avif" was still in the thumbnails-folder but the entry in assets_image_thumbnail_cache was gone. |
@bitbirddev thank you for the video and the hints! Unfortunately, I am still not able to reproduce it. |
@mattamon do you have frontend_prefix and thumbnail_cache enabled? |
@mattamon a little more detailed. hope that helps! to reproduce
what happens behind the curtains
now what does it mean?imagine you have a document displaying multiple images. for example a news listing with preview images. now you push 5 new entries. if 2 or more users load the page in parallel chances are high that one of the requests will delete the entry of a thumbnail in assets_image_thumbnail_cache while the processor is working. now for this thumbnail you'll never see your link with frontend_prefixes ever again. i was also able to reproduce this with just hitting the refresh button while the images are still being loaded. |
@bitbirddev Thank you so much for your effort! I was finally able reproduce the error. |
@mattamon you're welcome! glad to hear you could reproduce the bug. i'm using my fix for some month now and never had a problem with it since then. did you clear out everything (including tmp files) after applying the patch? you can see in the in assets_image_thumbnail_cache which thumbnail your browser tried to load, then you just inspect the image and open the corresponding entry from the srcset in a new tab. after that the entry in assets_image_thumbnail_cache is gone. i knew from the beginning that this would be a bug hard to describe/reproduce. now you can imagine how much time it took me to find out why some images aren't loaded from the cdn after some time in production :D |
@bitbirddev Yes I did the exact same steps as before. |
@mattamon just checked it and yeah it makes sense so far. with my fix
in easy words: on the first pageload all your image-links point to the PublicServicesController which creates Thumbnails and fills assets_image_thumbnail_cache. the second pageload already knows about your thumbnails and therefore adds frontend_prefixes keep in mind that not all thumbs of the img srcset are generated. only the versions your browser requests. without the fixentry in assets_image_thumbnail_cache could be deleted due to parallel requests and will not be created again afterwards. thumbnails where this happens will never be loaded via cdn |
@mattamon any updates on this? |
@bitbirddev, sorry not yet. We have to check this a little more. I'm going to get back to you once we finished reviewing it! |
@bitbirddev sorry we still need to have a deeper look into this. We are currently finalizing some other things, but we'll come back to you. |
Hi @bitbirddev please rebase your PR on 10.6 branch since 10.5 branch will be removed soon after tagging the last 10.5 release. Sorry for the inconvenience! |
@bitbirddev could you please check if this fixes the issue for you? thanks! |
Closed in favor of #15351 |
@dvesh3 @mattamon i'm sorry for my late response. i just reproduced this issue with pimcore v10.6.7 so i don't think this issue is not fixed with #15351 . The Fix has to be in PublicServicesController - this file wasn't even changed in #15351 . Can you reopen this issue? |
Hi @dvesh3 @mattamon This Issue is not fixed and still exists in v11.1.4. Even more frustrating is that with srcsets i can't really see which images are dead without testing the whole srcset of the image... Can you guys please reopen the issue? |
additionally: in combination with the full page cache, delivering assets via cdn wont work at all since the first pageload (without frontend_prefixes added to the urls) is the one to be cached... |
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
find a more detailed bug report here #16486 |
Obsolete due #16529 |
ok so this explanation is going to be a hard one.
to reproduce this issue:
create a twig template with a {{ pimcore_image("image") }}-tag. Open the template in the backend and add an image to the editable. right-click on the image and select a specific area of the image. save the document.
if you open the document in the frontend, the image is display and behind the scenes some entries are created in the TmpStore (database table tmp_store) and one entry is created in the ThumbnailCache (database table assets_image_thumbnail_cache)
everything is alright so far. now right click on the image and open it in a new tab. Refresh the table assets_image_thumbnail_cache in the database and you'll see that the entry of your image is now gone.
If you reload the document in the frontend you would assume that the entry is created again - but it isn't because the thumbnail-file still exists in the storage and therefore no TmpStore-Entry is created. if you host your thumbnails on for example s3 than the frontend_prefix for your assets is never attached because of the missing entry in assets_image_thumbnail_cache.
now this "open in new tab" thing is just a way to reproduce this issue. in a real world example this happens when 2 users visit one document with image-thumbnails that are still being processed (deferred). the second visit of the site wipes all those entries in assets_image_thumbnail_cache and now your frontend-prefixes are missing for those thumbnails.
to fix this issue we have to not only remove the thumbnail from the cache but also from the storage. thats exactly what this PR does.