An absolutely interesting bug was discovered on Christmas Eve on the project that I’m currently working on in collaboration with Duration Inc.
Basically, what we have is a landing page that launches a buncha games that the user chooses. The user will login to his/her account and gets directed to the appropriate starting screen of the game.
What’s happening however, is that after logging in, the user ends up in the developers’ page instead. It’s one of those things that just happen out of the blue and appears infrequently enough to brush off as some random screw-up by the browser or OS. However, when I managed to replicate it a number of times, it was safe to say that something was not quite right.
Naturally, I immediately jumped to my usual suspect when I’m debugging and testing on my machine, which was Windows Vista, since the other machines were on XP and 7 were fine.
And then it started popping up in XP, and we blamed Firefox. The blame game continued until the senior developer asked to take a look at the cookies generated for the session. He immediately noticed that there were 2 cookies with the same ID generated under the same domain, and I pointed out that the only difference was in the host attribute. One was www.project.com, while the other was just project.com
That’s where it gets a bit weird. It seems that although both URLs lead to the same page, different cookies will be generated. I’m not too sure about how all this works, but I think that apparently, if the cookie’s host did not match the full domain name of the login page, i.e. “www.project.com” as opposed to “project.com”, it will not be recognized, and it redirects to the default page which is the developer’s page.
So in the end, the culprit was that when testing on Firefox, I used project.com minus the www prefix. The problem was then swiftly resolved with redirection.
So the moral of the story is: Shit just happens to fuck you up outta nowhere, and you gotta need a bit of luck and quite a lot of tenacity if you wanna survive in this field.
I wish schools just taught that. Maybe they should have a project that has obscure bugs implanted on purpose and have students try to debug it. At least they don’t have to wait till they start encountering these kinda bugs on time critical projects and then get kicked in the nuts by the deadline.
