Tuesday, November 30, 2010

Pay attention to tiny annoying little files that don't exist.

I'm not sure if this will help anyone or not.  However, it's an interesting story so I thought I'd share. 
I've been working on project XYZ.com (named changed to protect the innocent) trying to stablize it for the owners because the morons who built it were ... well... morons.  (You can only work a project so long before you come to these type conclusions.  I am probably being a bit harsh.)  In any event, there is a couple parts of the application that makes heavy use of the session to manage dynamic search results. (remember that I'm coming back to it.)  This application current supports three out of the four major browsers (at least by my standards) IE, FF, and Safari and one browser (Chrome) had been turned off almost a year ago because it was "acting too flaky" and "not rendering images or pages properly" according to the owners.  As I've come to find out, actually all of the browsers behave a little flaky now and then but not as bad a Chrome which in some features of the app just refused to work.

So today I was trying to address another major flaw in the site.  The whole site is HTTPS (for no good reason except that Firefox "seemed to have issues with images in http") so I'm trying to at least make it somewhat intelligent on which protocol is used when.  Turns out this was no small feat with these monster size controllers that do everything.  (Did I mention this was a .Net MVC 1.0 application?)

So I decided that I should turn on Chrome to do some testing and I immediately got frustrated with the crapy results.  In fact, I was about to give up totally and disable it again when a bit of blind luck happened.  I was using the Visual Studio Debugger and  I had Fiddler open (as I often do now)  I actually noticed that Chrome was being freaky agressive about asking for the favicon.ico file.  I mean like freaky, every 3 or four requests it would ask again (like if that file is not there the first time it's going to somehow magically appear seconds later, and who really cares anyway?) and on top of it it was doing that (as it should) in a separate request.  The only problem was,  the file does not exist on this site. It never has. So the MVC framework (I think) or who the hell knows what because I haven't dug any deeper yet, was doing a redirect to "Index" which Chrome followed the redirect (on the file which is technically only suppose to be in one location) which caused app to serve up the home page.  This is where things started to get ugly.  This caused caused the  session data (did you remember?  it used heavily in a couple key places) to be wiped totally clean.  So when you try to create that user account or store your search results they vanish before your eyes!  Bingo!  Flaky results at random intervals!

Moral of the story... You must pay attention to tiny annoying little files that don't exist.

I love Fiddler... I love the debugger ...  the end.

No comments:

Post a Comment