Feedback Avatar Change Not Showing Right Away

Trying to figure out why I can't seem to add a different avatar? Is there a specific restriction on number of posts or some similar thing? Obviously I had an avatar when I was here before but I was hoping to change it. Since it is getting late here now I'll wait until tomorrow to deal with that and to spend more time looking around....
 
Yep, likely a browser cache issue. If you're on a PC, try hitting CTRL-F5 to do a 'hard' page refresh.

Tried refreshing the page and also logged out and back in again. Same issue. It might go away when I restart the computer, though, which I've noticed in the past helps when something is glitchy. If that doesn't work I'll set it all aside until tomorrow....

That didn't work, either. Time to call it quits for now and figure this out tomorrow.
 

Kevin

Code Monkey 🐒
Tried refreshing the page and also logged out and back in again. Same issue. It might go away when I restart the computer, though, which I've noticed in the past helps when something is glitchy. If that doesn't work I'll set it all aside until tomorrow....
If you let me know what browser you're using I'll add to my mental "Things to check out" list just to make sure. The cache settings for the site are pretty aggressive to help page load times so there is always the possibility that the setting needs to be tweaked a bit. :)
 

Sleepy Capybara

New Member
I have same issue. I load an image, it looks like the site tries to upload it and then vanishes. My avatar image from a big "S" on green square changes to "a" on a dull brown background and nothing. I then delete the invisible image and I am back to big S. Tried this : cache clearance, browser and machine restart. The image is JPG, 600x400 pixels.

avatar.png
 

JensM

Top Veteran
I have somewhat the same issue, I see the new one now in my posts (flat cap and beardless), but on login avatar in the upper right corner it is my old picture (big beard). Working on a machine with Win 10, running the Brave browser.
 

Kevin

Code Monkey 🐒
The short answer is that it's a cache issue that will clear itself up for most folks. The longer answer is slightly more complicated.

I'll try to see what we can do without sacrificing too much the benefits of how the avatars are being displayed. For that explanation keep reading..... :)

To help load up page load times we use a number of techniques that include aggressive image caching and, more importantly, Amazon's S3 for image storage and Amazon's CloudFront for CDN.

So what you say, what does that have to do with avatars? 🤔

OK, bear with me for a minute because to answer that question I need to explain how the S3 and ClounFront stuff works at a really high level.

If you envision an "average" web site the software is running on a server and all of the images, files, and misc. content is stored on the same server. That works but is not really ideal for sites that use a lot of resources, like images, or may have visitors from all over the world.

Amazon S3 eliminates the problem of a lot of resources like images. When an image is uploaded to site the image is transferred to Amazon's S3 'cloud' storage instead of being stored on the local server. By doing that the idea of worrying about hard drive space from a lot of images being uploaded goes away; instead of taking up hard drive space on the site server the S3 cloud offers a nearly endless amount of space. The site itself is still being served from the site's server and the data is still stored on the site's server but the images are not, they are all stored on Amazon's S3 servers.

S3 eliminates worrying about drive space but when it comes to an image intensive site like ours the problem comes into how fast it takes to load a page. The sites server itself is physically in the USA. Amazon's S3 servers that we use are in the USA. Our members though are all over the world. When a visitor from the USA loads a page with a lot of images then the load time might seem fine but a visitor from Australia [just an example country chosen at random] could possibly take a lot longer to load the same page. That is because they have more 'hops' between their local PC in Australia and to the sites servers in the USA. The more connections to reach the server means the longer it takes to retrieve the content and show the page. For the data that really isn't an issue because text is pretty small and even with a large number of hops it comes back pretty fast. Images, on the other hand, can really slow a page view down. When a typical gallery thread here has easily a dozen or so images per page and each image could be up to a few megabytes in size each, trying to retrieve that much data from a server in the USA while sitting in a cafe in Australia could result in a really long page load time. That is where Amazon's CloudFront CDN comes in.

CloudFront is a bunch of servers, like S3, but instead of sitting in a single giant datacenter somewhere in the US, like our S3 servers do, the CloudFront servers are distributed in data centers in major cities all over the world. In the case of Australia, CloudFront servers are in both Sydney and Melbourne. After an image is uploaded to the site it is transferred to the S3 servers. When the visitor in Australia wants to view the images Amazon CloudFront acts as a man-in-the-middle and decides that since the visitor is in Australia then it will copy the image from the S3 server to the local CloudFront server that is physically in Australia and load it from there instead of the US servers. Now the visitor displaying the page in Australia is still requesting the page data from the sites US server but all of the images are able to be loaded way faster because they are coming from a server that is local to them. If it is the first time somebody from Australia is requesting the page then the images will be copied from the US S3 server to the local CloudFront server. When the visitor loads the page a second time, or a different visitor from Australia requests the page, then they'll both see the images that are being cached on their local CloudFront server. The same thing then happens with visitors all of the world where Amazon has CloudFront servers; the data is coming from the sites US server but the images are actually coming from a server that is much closer to them.

So an image gets uploaded to the site (Cameraderie), it gets transferred to the cloud (S3), and a copy is stored locally in cities all over the world (CloudFront). Even with all that though the site sets an aggressive cache setting so that your browser will cache the image to your local device instead of requesting a fresh copy every time. That means that, as long as nothing funky is going on, the first time you request a page and it gets displayed in your browser then the images are temporarily stored in your devices browser cache. The second time you view that page then the images are displayed really fast because they are no longer being downloaded, they are coming from your device.

This works great for the attachments because attachment images don't change. There is no way to replace an existing attachment image with a different image. You can delete the existing attachment image and upload a new attachment image but you are not replacing the first one, you are adding one. Even if you give it the same name they are physically two entirely different attachments. They could have the exact same name, same file size, same everything, doesn't matter, they are two different files physically.

And now we come to how the site software handles avatars. Same way as attachments, right? No, no, that'd be too easy. Avatar images do replace the current one. That means when you upload a new avatar it replaces the existing one.

Now at this point some of you may see where I'm going with this. ;)

Avatars, when updated, go the S3 servers. When the pages requests them they are cached to the CloudFront servers. When they are displayed in your browser they are cached in your device browser. Eventually your browser cache will expire to request a new version of the avatar which will come from the CloudFront server which itself may or may not be caching the old version of the avatar so when that cache expires it'll request a new copy from the S3 server. In the interim your browser is still showing you the old avatar.

So why doesn't this happen to all sites? It could be a number of answers. Some sites don't store their avatars in S3 and/or CloudFront and instead still store the avatar images directly on the sites server. There are different vendors out there besides Amazon, like CloudFlare, and based on how the site is setup and how the vendor configuration is setup then it might be smart enough to know the image has changed faster. Some sites don't cache their avatars.

So why does this site cache avatars? To squeeze every possible millisecond out of the time it takes to load a page and display. For the most part members don't change their avatars very often so it usually goes unnoticed or is just dismissed as an annoying quirk.

So what can be done about it? Honestly, with us using S3 and CloudFront I don't have a quick answer at the moment. I'm not sure if the 'annoyance' factor at the moment outweighs the potential time savings during the page loads. It's something I'll revisit but I don't have an answer other than to change your avatar in your account settings like normal and if you don't see the new avatar right away then to just wait a bit.
 

Kevin

Code Monkey 🐒
I have same issue. I load an image, it looks like the site tries to upload it and then vanishes. My avatar image from a big "S" on green square changes to "a" on a dull brown background and nothing. I then delete the invisible image and I am back to big S. Tried this : cache clearance, browser and machine restart. The image is JPG, 600x400 pixels.
OK, this one has me stumped thinking about it. It's late and after I think about it the answer may come to me but right now I'm puzzled.

Here's why I'm puzzled: If no avatar image is selected then the default avatar shown for everybody is the first letter of their user name and displayed in uppercase. The background color varies (I'd have to dig through the code to see what determines the background color, but it various based on the user name) but the letter shown should always be the first letter of the name. With your current username I can't see where a lowercase "a" would be coming from. 🤔

Let me think about this with a clearer head in the morning and I'll follow-up with you. :)
 

John King

Member of SOFA
Location
Beaumaris, Melbourne, Australia
Name
John ...
I have same issue. I load an image, it looks like the site tries to upload it and then vanishes. My avatar image from a big "S" on green square changes to "a" on a dull brown background and nothing. I then delete the invisible image and I am back to big S. Tried this : cache clearance, browser and machine restart. The image is JPG, 600x400 pixels.

View attachment 281230
SC, try changing the file name of your avatar to something a lot shorter, and get rid of the second full stop.

Somewhere along the line, something might not like either the length, or that second full stop, causing the filename to be parsed incorrectly.

Just some thoughts, FWIW.
 

Sleepy Capybara

New Member
Oh yes! In sync with mu-43. NOW it feels like home :D And I did nothing - just reuploaded the avatar for nth time. I guess there is some delay indeed, just didn't think it would be so long (tried yesterday too). Thanks for detailed response Kevin and of course John, let the good old times continue!
 
Thanks so much, Kevin, for working on this and for your explanation about how the whole system is supposed to function! As you see, I'm happily now sporting my lemon slice after having tried another image last night and then shutting down the machine in frustration as I headed off to bed. Today when I came into the site, there was the green globe! So I then tried the lemon slice again and this time had success. I wonder, too, if part of the issue isn't that all of a sudden this site is getting an influx of new members and it is inevitable that some of us are going to want to tinker with our avatars or set up a new one if someone is brand-new to the site....
 

Kevin

Code Monkey 🐒
I tweaked a setting* that should help out going forward with folks not seeing avatar changes faster.





* = For anybody that read the long explanation above, I changed the S3 rule to forward the query string to CloudFront since when an avatar is changed it appends a query parameter at the end of the URL to act as a cache buster. The default 'optimization' rule for CloudFront is to ignore query parameters in file names but that defeats the cache buster parameter of the avatar URL. The (hopeful) solution is to use a custom rule that forwards the query strings. I then also cleared the CloudFront cache for the avatars folder so they are reseeded.
 

jbruce

Regular
Location
Northern MN
Name
John
I had a similar problem yesterday when accidentally loaded the wrong image into the avatar, so tried to delete again and again, no go.. I tried to load the correct image many times on top, but the first one was locked into the system and wouldn't go away, I gave up. When I logged in today, there was the avatar that I wanted. Go figure? Kevin, maybe your fix cured my issue as well.
 
Top