The Day I (Almost) Crashed a Web Server

Mark your calendars friends with the date February 9, 2012. I’ve been writing computer programs since high school and I’ve been designing webpages since the early days of the Internet but on that date February 9, 2012 was the first time I ever came really close to bringing down an entire Web server.

I did it while trying to set up the outline for this system of blogs. Normally when a person wants to blog on a variety of topics, they create one big blog and they attach tags or keywords (sometimes called categories) to each of the entries. Then if you want to read only the blog entries that do with the particular category you can go to a page that gives you just those entries. But I decided I wanted to have six different and distinct blogs. Even though they all look exactly alike right now, my goal is to redesign each of them with different graphics and color schemes and overall themes to fit the topic. To try to bring all this together, the homepage of this website collects the five most recent posts from each blog in one place. That way you can go to one webpage and see which if any of the blogs have been updated. You can then click on the individual articles to read them.

The implementation uses a Internet feature called “RSS” which stands for “Really Simple Syndication”. RSS is a feature of many websites and nearly every blog you will find that allows you to collect together articles from a variety of sources. If you set up your browsers home page to a customized Yahoo page or a customized iGoogle page for example, you can tell that webpage to go out and collect headlines of news stories from a variety of other websites. All this is done with RSS. And if you know what you’re doing, you can set up these Yahoo or iGoogle pages with RSS feeds from websites of your own choosing. If you see this little orange symbol it means that the website has an RSS capability. You can usually click on that icon or some sort of link next to it to get the feed address. The image below shows my iGoogle page which includes not only news items they supply but recent articles from my video blog Good News on Tap in from my church website.

This entire cyborg5.com website is managed using blog software called WordPress. All WordPress blogs create RSS feeds so that they can be included in other websites. They also have facilities for showing you RSS feeds. The ability to show these little groups of headlines in a sidebar widget is built-in. I recently found a special WordPress plug-in that allows you to put RSS feeds into individual pages and posts of a WordPress blog. That’s how I do the bottom part of the main webpage here that aggregates together the most recent posts of all six blogs.

If you’ve ever done any programming or even wordprocessing you know that if you got to do six of something, the easy way to do is create one, make five more copies, and then edit it to those copies to reflect the difference. That’s what I did when I initially designed this homepage. I created an RSS link to the first blog and then copied it. But somewhere along the way I made a mistake in editing. Rather than have the homepage give me a summary of what was on each of those six blogs, the homepage tried to give me a summary of itself. In order to do that it had to go get a copy of my homepage. But to get a copy of my homepage it had to go get a copy of my homepage. And to get that copy of my homepage it had to go get a copy of my homepage. It’s like those little Russian dolls where when you look inside one there is another one and inside another one. Programmers call this process “recursion” and it can be a very useful tool for designing programs as long as you put some sort of mechanism to tell it when to stop.

When I was in college we had a programmer’s joke book that defined various programming terms. For example under the words “infinite loop” it said “see: loop, infinite”. And of course we when you looked up “loop, infinite” it said “see: infinite loop”. More to the point one of the programmers jokes in this book said “Recursion… see recursion”.

My webpage was basically stuck in an infinite recursion of trying to fetch itself. Fortunately whoever designed the Web server put in safeguards that if you try to use up too much of the server computer’s resources it would shut you down. It also sends a warning message to the server’s administrator and then they send you a nasty e-mail saying “what the hell do you think you’re doing?” Fortunately my guys from whom I buy my web hosting services are a lot nicer than that. But they were pretty adamant that I had a problem that needed to be fixed. By the time they warned me about it, I had already edited the page to be the way it was supposed to be. I really had no idea that anything had gone wrong for the few minutes I was experimenting with it. I explained to them what I was doing and perhaps something had glitched along the way. I promised them I would try to be more careful.

Still I had no idea what had gone wrong until 1:32 AM this morning while laying in bed all of a sudden I realized what I had really done wrong. When I display the information from the RSS feed, I’m only displaying the title of the message or the page. So when you look at the page, it didn’t look like an infinitely nested bunch of references to the same article. But inside it was busily trying to fetch the entire page even though I wasn’t displaying the whole thing. It was merrily eating up resources while I was goofing off. Once I got up and dressed this morning I sent an e-mail off to the tech support people that begin with the words “Mystery solved! I’m an idiot…”And then I explained what had gone wrong. They got a big kick out of it.

Of course this is not the first time I had never created an infinite recursion. But in the past it has always been some program I was writing on my own computer and when the computer locked up I realized what I’d done. But yesterday… February 9, 2012… The day that will live in infamy. The day I almost crashed someone else’s Web server with my coding mistake.

Leave a Reply

Your email address will not be published. Required fields are marked *