Bug #22313
closedS3 IMage issues on private to public site
0%
Description
Hi All,
I am in a meeting right now trying to present these sites for colleague feedback:
https://tlcdevsite.commons.gc.cuny.edu
https://testworkshop1.commons.gc.cuny.edu/
When we switched the sites from private to public so others could see it broke all the images across the sites. Is there any quick fix so that we can get the images on these sites working?
In the future, is there a fix to make images stable when changing site visibility?
Files
Updated by Laurie Hurson 15 days ago
- Subject changed from S3 issues on private to public site to S3 IMage issues on private to public site
Updated by Boone Gorges 15 days ago
When you change privacy level on a site, a batch process is queued that makes the necessary changes to each image on the site. This process takes a few minutes to finish. Unfortunately, there's no way around this at the moment.
It looks to me like images on those two URLs are working properly. Can you confirm? If there are URLs where images are not appearing, can you please share them?
Updated by Laurie Hurson 15 days ago
It did not complete for about 15 mins so I changed it back to private so I could share my screen. I will change to public again and report back on any images that are not working after a period of time.
Updated by Laurie Hurson 15 days ago
I changed the site visibility on https://tlcdevsite.commons.gc.cuny.edu/ back to public around 2:45pm and most images are still not loading for me.
Images are not appearing on the home page (above) or other pages including:
https://tlcdevsite.commons.gc.cuny.edu/programs-services-2/
Updated by Boone Gorges 15 days ago
- Category name set to S3 Uploads
- Assignee set to Boone Gorges
Thanks, Laurie. The crux of the issue is that, for some reason, the cron job that's responsible for switch the access-control on your images was not scheduled. It's not clear to me why this is the case. I tested a few times with your site and I was able to trigger the cron job without a problem. While testing, I did identify a couple areas for improvement of efficiency, and I put them in place https://github.com/cuny-academic-commons/cac/commit/b7323b59164c95cb37b2752222e8d66b73b77410
It's still not perfect. Our scheduled-task runner is running about 10 minutes behind. This is not terrible, but it means that tasks that ought to be done in a few seconds may take 10 or more minutes. When you chain these together, you could end up with a delay of 20 or 30 or more minutes. I'm going to reach out to Reclaim about increasing the workers devoted to Cavalcade so we can mitigate this problem somewhat.
Beyond this, there's the problem that users don't really have any indication what's going on when they change their blog_public value and the S3 ACL tool hasn't finished running (or, as in your case, isn't even scheduled). In a perfect world, we'd have systems that informed the admin what was happening, gave real-time info about it (processed 550/1200 items, or whatever), and perhaps even had a button that would allow you to run an update batch immediately. Unfortunately, building this kind of tool is quite time-intensive, and changing of blog privacy settings is not a super common event, so I don't know that it's worth the effort.
I'm going to spend some time thinking about this. I think that perhaps we ought to move the ACL batch system out of Cavalcade. Instead, we could hook it into 'init' or something, with some sort of 'update in progress' flag to ensure that only a single batch can run at a time. This feels clunkier, but it also avoids some of the problems described here (Cavalcade running behind, tasks not being properly scheduled). Ray, if you have thoughts about this, I'd welcome them.
Updated by Boone Gorges 11 days ago
- File Screenshot_2025-03-17_11-15-27.png Screenshot_2025-03-17_11-15-27.png added
- Target version set to 2.5.5
I've rewritten the system to move away from Cavalcade-dependent scheduled tasks: https://github.com/cuny-academic-commons/cac/commit/9074ea45e662d773f9437918ab87714b86b26c36 After this change, when you change the Reading > Visibility setting from public to private or vice versa, all uploaded items will be queued for ACL change. Then, a batch will be processed each time the administrator loads the Dashboard, until the process is finished. This will be pretty seamless in most cases, since admins will generally go clicking around after they've changed their privacy settings. I also added a small admin notice so that admins are aware of what's happening. See attached screenshot. As you refresh the page and/or click around, this number will go down.
In my tests, this is working nicely. It slows down pageload a little bit while the batches are in progress, but this is a fairly minor thing, as admins change this setting only very rarely.
There's still some funniness in the way that the three icons on https://tlcdevsite.commons.gc.cuny.edu/ under 'What We Do' work. This seems to have something to do with the way that some plugin caches image paths. It's connected to S3 privacy, but is specific to that block (perhaps part of Otter Blocks, I'm not sure) and is not affected by the toggle behavior being discussed in this ticket. Laurie, if you're experiencing problems in that area, please open a separate ticket that describes them in detail. In the meantime, please feel free to check the process of toggling site privacy in order to see how the new batch routine works.
Updated by Laurie Hurson 10 days ago
Thanks for this Boone.
I was able to get the icons on the home page to appear by re-adding them in the editor.
However, this is a time consuming if I have to do this for all images across the site. Most images are now working in the backend but still appears broken in the editor view. See screenshot
Even if click "replace" and readd the images, and I add alt text, the images do not reappear in the editor. Is this an s3 issue as well?
Updated by Laurie Hurson 10 days ago
Updated by Boone Gorges 10 days ago
Laurie, I've opened #22343 to discuss this issue, which is separate from the batch-processing issue in the current ticket. Could you please provide some more details on that new ticket?
Updated by Boone Gorges 3 days ago
- Status changed from New to Resolved
Seems like this one is resolved.