The last few days we fixed some bugs in our frontend code. Our logs, however, shows that a surprisingly large amount of users still have these bugs. Why? Why do we keep getting logs about bugs we already fixed and deployed? It's not a caching issue so what have we missed?

Bloglovin makes heavy use of client-side Javascript. We are in some regards more a browser-based application than a website. This is not immediately obvious because we try hard to make the site adhere to common web behavior but most page loads are nevertheless some variant of Ajax calls. Not every page load is an Ajax call, but the most common ones are.

After careful examination of log data we realized that the users that have these bugs seem to be running old frontend code. This must mean that they have not done a full page reload, so they still run the old Javascript! They have Bloglovin open in a tab in their browser. They don't close this tab and they don't close their browser. They just click buttons in the interface that triggers Ajax requests, but the HTML document is never reloaded.

How widespread is this? We ran a query to find out, and got this table for the last 24 hours:

Version retired Users
2 days ago 2536
8 days ago 79
12 days or more 43

So a substantial amount of users didn't reload their page, but stayed active on the site, for at least two days. A few people run a two week old version!

Updating the code can mean we introduce changes to the Ajax protocol. Running old code may therefore result in that the page stops working in subtle ways for the user, which is unacceptable. With this new information at hand we can start thinking about ways to upgrade the Javascript code for users. The most obvious solution would be to include the version number in each Ajax request and do a full page reload when the versions don't match. A better solution would be to note the version discrepancy and do the page reload on requests that can do so without losing state. For example, the user might be in an infinite scroll session that could be lost on a full page reload.

The lesson learned is that releasing a new version to servers does not guarantee that the users get the new version. This is common knowledge for mobile applications but it applies to web applications as well.