Strange bugs

Sometimes, as a software developer, you have to debug very odd problems. One strange one that I worked on recently was that, after deploying a new version of a website, logins spiked to crazy volumes. It was as if every user was logging into the site again and again. Clearly they weren't doing that, but there didn't seem to be anything wrong with the site.

We tracked down the issue by logging all URLs visited and found that, when Internet Explorer visited certain pages, a request for "/" was made. For you non-technical people, this is the home, or landing, page of the site, the page you get when you visit as opposed to a specific page at Google, such as On the website in question, requesting the main landing page will log the user in if they selected "remember me" the first time they logged in.

But why was IE requesting the landing page? The real page we wanted was showing up fine, but you could see that IE was, in the background, requesting the landing page. It turned out to be an empty image tag:

<img src="">

This tag, which on Firefox does nothing, causes IE to request / as the source of the image. Seems pretty odd since I've never come across a website that uses images as a landing page, but what can you do? We changed the page and removed this empty tag and the problem went away.

For those of you wondering what we wanted an empty tag for, rest assured, we had a reason: JavaScript on the page was dynamically setting the src for that image under certain conditions. The full solution to the problem was to remove the img tag entirely and dynamically create it using JavaScript.

No comments: