Firefox cache bug - firefox

This is a bug/issue which has cost my time for at least 3 years now.
I have complex, dynamic pages in ASP.NET which use a lot of javascript (which is more or less static).
Now I have a behaviour which happens only in Firefox and then only every few 10.000 requests.
Users are playing games on my site so they are hitting the same page again and again, every day. And then the game locks up with javascript errors on the page. I have never been able to find out what exactly happens. A file is corrupt perhaps?
Shift-F5 or simple reloading does not help. If the user clears his cache, the problem is gone.
This has been reported hundreds of times now. Every time the user has been a Firefox user, every time, clearing the cache fixed the issue.
I can't nail down the bug since I can't reproduce it.
There are lots of reports that Firefox is caching files which it shouldn't cache. But that doesn't seem to be the issue in my case. Something else is going on.
Anyone got an idea what's going on?

Related

How to figure out what's causing long DOM processing time?

I have a landing page to which I'm driving traffic through PPC. For a variety of reasons, I've come to believe that, even though the site is highly performant for me, it isn't for my actual visitors. So, I turned on AWS CloudWatch.
For me, with cleared caches, the page loads at around 0.9 seconds in Safari, 1.75 seconds in Firefox, and 2.25 seconds in Chrome. If I were in micro-optimization mode, I'd worry about that Chrome number, but right now, my issue is much bigger. According to CloudWatch, my real users are experiencing an average load time of 12.1 seconds! And of that 12.1 seconds, DOM processing is taking about 11 seconds:
Now, I'm not sure if I have to worry about the full 11 seconds, or just the part I've marked "A" — the processing that happens before it starts loading the DOM — but either way, how do I figure out what's causing this?
I know there's a way to simulate low network speed in devtools, but maybe there's also a way to throttle CPU? Or maybe there's a way to "look" at the waterfall in devtools and figure out which pieces are blocking the DOM Content loaded action? Then, even though they're fast for me, I can try to optimising those pieces. Or maybe a deeper level of diagnostics I can enable on CloudWatch? Or, maybe there's some other option I haven't considered.
FWIW, almost all of my visitors are on Android devices, and they're about 70% Chrome, 10% Android Browser.

Random slow content download, while TTFB remains low

I'm developing a Magento2 website, everything is running well for now, except a random issue I can't figure out how to solve.
The website is using Varnish, and all pages have a varnish cache HIT, with a very low TTFB about 30ms and low content download too (about 40ms)
But randomly, the download timing increases to more than 2 seconds, and on the next page visit it will go down to normal 40ms.
Same issue on all browsers, so not a browser issue.
Would someone have an idea ?
Many thanks
There are so many factors at play. The most important thing is whether or not you can simulate the issue and predict when the issue will appear again.
Once you're able to simulate, you need to determine what type of resource is slow:
Is it the graphical rendering of the page in the browser?
Is there a 3rd party JS resource that is slow?
Is it the actual TTFB of the main page that is slow for that resource?
Please use your browser's development tools and check the breakdown in the networking tab. With enough attempts, you'll be able to spot the issue. When you do, please add a screenshot of the breakdown in this question.
In parallel, you can keep the following command running to identify requests that took more than 2 seconds to process:
varnishlog -g request -q "Timestamp:Resp[2] > 2.0"
You can also add the output to your question.

Updating the complication gradually degrades the Apple Watch app performance in watchOS3

I've been stressing over this issue for about a week now, trying to pin point the source of a slow but steady Apple Watch app performance degradation. Over the course of about two days, my app's UI would become progressively more sluggish. I've narrowed it down to a complication update code. Even if I strip down the complication update to an absolute bare minimum, this problem still happens, albeit slower than if I update the complication with some actual data. I update the complication every 10 minutes. Once the new data comes, I simply execute
for (CLKComplication *comp in [CLKComplicationServer sharedInstance].activeComplications) {
[[CLKComplicationServer sharedInstance] reloadTimelineForComplication:comp];
}
which in turn calls:
- (void)getCurrentTimelineEntryForComplication:(CLKComplication *)complication withHandler:(void(^)(CLKComplicationTimelineEntry * __nullable))handler {
...
}
This works fine, the new data displays, but when repeated a few dozen times, the UI responsiveness of the main app begins to noticeably degrade, and when it's repeated about a hundred times (which happens in less than a day with 10 minute updates) the UI really slows down significantly.
I have nothing fancy going on with the complication structure - no time travel, just display the current data, and everything is set up for that. To make sure I'm not looking at the wrong place, I've made a test that reloads the timeline every second, and in this test, my getCurrentTimelineEntryForComplication looks like this:
- (void)getCurrentTimelineEntryForComplication:(CLKComplication *)complication withHandler:(void(^)(CLKComplicationTimelineEntry * __nullable))handler {
handler(nil);
}
so there's literally nothing going there, just send back the empty handler. Yet, even in this scenario, after a hundred or so timeline reloads, the main app's UI slows down visibly.
Some other things to note:
If I'm not updating the complication, the app's UI performance never degrades, no matter how many times I open it, or how long I use it, or how many times the data fetching code runs in the background.
When testing this in the simulator, I can't get the performance degradation to happen, but I can consistently see that there's a small, but steady memory leak coming from the complication update (again, this happens no matter how simple update I do inside the getCurrentTimelineEntryForComplication method.
Has anyone else noticed this, and is there any hope to deal with it? Am I doing something wrong? For the time being I make sure only to update the complication if the data has changed, but that just postpones the problem, rather than solving it.
Oct 24 edit
I've done more careful testing on a real watch, and while before for some reason I didn't notice the memory leak associated with this on a real watch, I have now definitely seen it happen. The real device mirrors the issue seen on the simulator completely, just with a different initial amount of memory allocation.
Again, all I do is call reloadTimelineForComplication on a constant loop, and the complication is updated with a single line of text from a cached data object, and the complication controller is otherwise stripped to a bare minimum. When the complication is removed from the watch face, memory leak predictably stops.
My main project is written in ObjectiveC, but I have repeated the test with a test project made in Swift, and there are no differences. Also, the problem persists with the latest XCode 8.1 GM and the watchOS 3.1 beta that's supplied with the simulator that comes with it, as well as running it on a real watch with watchOS3.1 installed.
Jan 24, 2017 edit
Sadly, the issue persists in watchOS 3.1.3, completely unchanged. In the meantime I've contacted Apple's code-level support, sent them sample code, and they've confirmed that the problem exists, and told me to file a bug report. I did file a bug report about two months ago, but up until now it remains unclassified, which I guess means no one looked at it yet.
Jan 31, 2017 edit
Apple has fixed the problem in watchOS3.2 beta 1. I've been testing it both in the simulator and on real watch. Everything's working great, no memory leaks or performance degradation anymore. In the end there were no workarounds for this, until they decided to fix it.
Apple has fixed the problem in watchOS3.2 beta 1. I've been testing it both in the simulator and on real watch. Everything's working great, no memory leaks or performance degradation anymore. In the end there were no workarounds for this, until they decided to fix it.
I noticed that using the native calendar complication everything i do becomes very sluggish. So maybe it's a bug in the new watch OS.
After using the calendar complication for a couple of days it's impossible to use that watch face. Even if I change to another complication and switch back to the calendar one it doesn't "reset" the performance. The only thing that solves is to reboot the watch. (or forget about the calendar and use another complication instead)

Why does a cached file have a high Waiting (TTFB) or Content Loaded ms value?

I'm looking at a waterfall in Chromes Developer tools of several CSS and Javascript files.
When refreshing the page, several of the files load from the browser cache, as expected. These are taking 1ms to load most of the time. However some files, and it seems to be the same offenders each refresh, are taking quite a bit longer. Sometthing between 400ms and 800ms.
The waterfall timeline in Chromes network tab shows that this time is spent in the TTFB (time to first byte) in some cases. This doesn't make any sense to me, if it's getting it from the browser cache it should be getting it from the hard drive, not the server, why is there a TTFB?
For other files or sometimes on a different refresh I see the time is blamed on content dowloaded time. Again, coming from cache this should be pretty instantaneous, yet I'm seeing it take over half a second sometimes.
Can anyone shed some light on what's happening here?
This is a web app I'm working on so I don't have a link I can share I'm afraid.

Firefox page sometimes loads forever, how to determine cause?

Pages on my website sometimes load indefinitely (shows the circular blue loading animation in the tab, and "Waiting for example.com..." in the status at the bottom) in Firefox. Usually they finish loading very quickly.
Since I can't predict when it will have one of these episodes, and Firefox requires you to refresh the page in order to use the Network tool, how can I determine the cause of this on the rare occasions I see it?
I'm not sure if it is because JavaScript is running or a request for another file hasn't been answered.
This may happen in other browsers, but I generally only use Firefox unless the QA person I work with tells me there is a browser specific issue.
Generally, use the httpfox add-on, Firefox developer tools, and Firebug. Understand your server software and make sure errors are logged. Read the log.
If you can repro the error then you should be able to use a debugger with your server and find the section of code that is processing forever. Maybe there's an infinite loop. Maybe a lock has blocked execution. Maybe a ridiculous query was made to the database.
Otherwise, unless this unpredictable error is causing you to lose money or endanger people, ignore it.

Resources