How can I diagnose caching issues? - asp.net

I am using Asp.net-MVC and hosting on AppHarbour.
I have noticed two very strange behaviours that are indicating to me that I have some caching issues, and as much as I have tried to resolve them they are sticking around.
In the first case, when I hit certain pages, they are bringing back old content.
No big mystery, the problem is since I found this, I cleared my browser cache, even switched browsers to one I don't use, and added in a global filter to disable all caching.
It's still caching it!? What else can I try? How can I better diagnose the issue?
The second problem, is similar but it is a new controller that has been added, sometimes hitting it creates a 404 othertimes it works just fine?
There are no errors occuring in the logs aside from these symptoms.

Have a page that displays a list of all cache entries. This way you can check if the global cache filter is realy working.
This link shows how:
How to display the content of asp.net cache?

Related

Magento 1.9 styles (CSS and JS not found) break frecuently

So, I have a couple Magento sites (1.9.2+) and recently, styles started breaking frequently. By styles breaking I mean home is displayed as only text. All css, js and images are not found.
I know how to fix this. I just clear cache removing var/cache and everything is fine again.
My question is... why does this happen periodically and now, more often? I've even setup a cron to delete the cache folder hourly. However, I'm still getting this error.
It's really annoying, and hard to explain to our clients when it's happening daily. "oh, just another cache issue", isn't an acceptable answer for me.
All answers I found so far just fix it once, and never mention it happens periodically.
Any ideas as to prevent this from happening?
Thanks!
I would not set up a cron to clear the cache. So remove that asap. What 3rd party apps have you installed around the time your had these issues. My guess is there must be a process / action that is periodically occurring that causes this change. Check your error logs and exceptions also /magentoroot/var/logs
Last possible reason (although rather slim chance) is you have a sitewide ssl setup but its only valid for certain urls.

Cached CSS loading error

Hey I'm working on a site that loads CSS and images that are generated server-side. Some times the images and CSS that is loaded in shows up as the incorrect template but with the correct images.
Since this template is created on the server and not on the actual page I was thinking that the web server that hosts the actual page may have a cached version of that page and may sometimes ignore the CSS and images that are generated from the main server.
In short:
Do webservers sometimes keep cached versions of page Styling?
I there an easy way to make it get the live version always?
Also this happens very infrequently and at random. It seems very hard to replicate. But I have seen it happen a few times.
Any other Ideas?
For the first answer, yes they do but only if setup that way. There is the CDN or varnish. These system are used for website with huge loads where content must be cached locally or on other server, allowing the user to visualize the cached content and not the one generated by the webserver at the moment the user requested.
Exclude this for your case then ;)
I always use chrome or firebug on firefox to debug a website.
Press F12 while in the page you want to check and, on chrome, go to "Network" tab and pin "Disable Cache".
This is incredibly handy if you refresh your page quite often and want the content not cached.
For the question itself, I don't think I/we can help you without seeing the code. But try my suggestion with F12 before.
There are two kinds of caches to think about. One of them is server cache. If you use server cache, then whenever CSS was modified, you need to empty the CSS cache if you have such a cache. If not, then you need to empty the cache, which might be painful.
As about browser cache, if you add a new parameter to your css file, then it will be loaded even if it was cached in the browser of a given user, therefore it is recommendable to add a parameter to your css file where you include it. This parameter should be either a version or a timestamp, or something uniquelly distinguishable from earlier versions. That value should be stored and you need to refresh (preferably) automatically whenever the CSS changes. The exact steps are up to you, since they differ greatly in different environments.

ASP.NET 2.0 website white screen of death

I am encountering a strange issue which is only affecting several users from an over 7000 user-base. Having searched the web for several hours to no avail, I'm hoping someone here can help!
I have an ASP.NET 2.0 website and when certain users try to access the home page (Default.aspx) they receive a white screen with no content loaded. This issue is occurring both in production environment and if I run the solution against a copy of production data. So I am able to replicate the exact same issue when I pseudo the problematic users.
When debugging the application in VS2005 and set a breakpoint in the code behind in the Default.aspx, the breakpoints are fired/hit so I know the request is working. The problem seems to be once the server has finished serving the request, the response back to the client/browser is empty.
Here's another strange thing I've noticed. If I alter the HTML in Default.aspx by adding a new white line or whitespace, the page will load fine for the same set of users. I thought I had resolved the issue with this fix but unfortunately the white screen issue just manifests itself once again.
Within Default.aspx, there's some AJAX requests using jQuery .load function but this can't be the issue because this functionality exists for every user of the site. The only variable is the amount of content returned within this request can vary depending on the user. But why would it resolve itself when I put a whitespace or whiteline in the page and then manifest itself hours later?
Another thing to note is it's only Default.aspx that is encountering this issue. If I browse to another page by typing in a page in the address bar, the page is served OK.
Hope someone can point me in the right direction on how I can debug or even resolve the issue.
It sounds like your ajax is the cause but without seeing some code, it's difficult to know why.
It could be a timeout, or an error that is preventing the ajax from completing it's function.
You need to use a tool like Charles or Fiddler to debug what is happening whilst the page loads whilst logged in as these users. In a nutshell, a tool like Charles will display all the detail surrounding requests made and responses served to the browser, including any failed responses.
I think it has to do with http headers, caching or encoding. But I cannot tell more without code.
Is output caching enabled for this page?
Can you give us the raw http headers for both the request and response?
If a white screen appears, will it be fixed by pressing ctrl+f5?

ASP_0147 | 500_Server_Error

This issue has been happening for a while, and it's suspected to be session related since it pertains to the users browser. Opening a new browser (session) rids the issue. The application uses Global.asa (Only Application_OnStart and Sub Session_OnEnd, the rest are empty), Classic ASP (VbScript), IIS 7.0.
This error keeps popping up on url's which happen to be loading fine, until the page is refreshed for the second time, then it bogs out and even times out. In the same browser, if i even try to open that entire website, it times out at this point. For about 350000ms and then everything starts working again. Very weird!
If anyone can help with this, I haven't had any luck anywhere finding what may be causing this, besides something that has to do with the sessions, maybe in the application pool.. I'm not sure.. Any help on this would be appreciated.
Sometimes Google AdSense might cause such problems, disabling it should solve your issues.
To cure the real "root" of the problem and keep using AdSense, guess you'll have to contact Google.

Plone yields 404 on new content save

The issue: a content editor saves a new content item and gets a 404 on the proper-looking url for the new object. If they then refresh, the item is there, perfectly normal.
This happens for multiple Archetypes-based content types, and we've seen it on at least two different sites. We've seen it on Plone 3.x and 4.0.3. Here's what these sites have in common:
HAProxy load balancing (with and without session affinity)
Multiple ZEO clients
Using either ZODB 3.9.7 or 3.8.4
The issue happens only some of the time, maybe for 1 out of 4 content items
Has anyone seen anything like this?
I do not have an answer for you; this should not really happen. I certainly have not seen this.
You'll need to gather more information to troubleshoot this, and that perhaps requires interactive access to experts, and SO is not the place for such troubleshooting.
All I can do is advice that you gather as much information as possible, including a full trail of the user interaction from the various logs, including HAProxy and the ZEO server.
It may require additional instrumentation at the server level (when the NotFound error occurs, dump additional information about what is present, etc).
Some recomendations/questions:
Verfy that the content object was, indeed, created.
Check that the content views are correct (the ones that are declared in profiles/default/types/yourtype.xml).
Does it happen when adding content directly to plone instance (Without caching and load balancing?
Does it happen when adding content to direct plone instance with load balancing, but without caching? ---> And so on ...?
Maybe not an elegant one, but you might try inserting print statements or pdb breakpoints in the code so you can track whenever a content object was, indeed, created. Do this only as a desperate method of "instrumentation".
Yes. we have recently started seeing the same issue. We have almost the same setup. Haproxy (no session affinity).
I'm wondering since the pattern seems to be haproxy... perhaps its an issue with a request being redistributed after a timeout?
Updated:
We had this issue. It happens when you have a redirect back to the changed object after a save. This is because the 2nd request hits another zeo client which doesn't realise it's out of date.
The only solution we found was a to add temporary session affinity in haproxy (20s) during any POST. Not ideal but does work. I was just searching for a better solution which is why I found this old post.

Resources