Friday, February 01, 2008

Debugging is fun!

It's occurred to me in the past that one of reasons I watch House is that it's more about problem-solving (and making good guesses) than it's really about medicine, and that it has a lot in common with problem-solving in other domains, like, say, debugging software. In that spirit, here's an hour from my Tuesday afternoon, if it were an episode of House.

(It also occurs to me that this may be the first "creative writing" I've done since my freshman advising seminar. There was probably a reason for that.)


Scene 1

We see a man, mid-40s, at his computer. He's working happily with children playing in the background. One runs up to him and bumps his elbow, causing him to spill coffee all over his desk. It narrowly misses the keyboard. He wipes it up with a few paper towels and gets back to work, but a few moments later an error message pops up on the screen. He swears.

[Credits]

[Commercial]


Scene 2

House: So we've got a user with an error page.

Taub: Do we have any idea what caused it?

House: (Sliding folders across the table) Here's the stack trace.

Foreman: It's probably just left over from that bug we fixed last month.

House: Nope. This one was working up until yesterday.

Foreman: Then it's probably something related. The entries were probably written out of order.

House: Probably. Go see if the entries are out of order.


Scene 3 - In House's office

Thirteen: The entries were out of order. It looks exactly like that bug we fixed last month.

[Commercial]


Scene 4

Thirteen: It must be the same bug recurring somehow.

House: Am I the only one who's looked at the changelists? We fixed that bug. We haven't seen it in a month. This is something else. Ideas?

Kumar: Maybe they were written fine, and the server just read them in the wrong order.

House: But we read them again, and they're still in that order. You think we read them wrong twice? Either the data store has completely lost its mind and is out to get this one particular user, or we wrote them wrong. (Idiot.)

Thirteen: Maybe something weird happened at the same time as we were writing them.

House: Okay, go look at the debugging logs.


Scene 5 - In the lab

Kumar: Man, these sanitized debugging logs suck.

Thirteen: Yeah, but too many people have access to these logs. You know Cuddy won't let us keep anything juicy here.

Kumar: And there's all these interleaved sessions... I can barely even tell what I'm looking for.

Thirteen: No, look, if we just grep for the session we want... here! The timestamp!

Kumar: That's just saying that it wrote out of order. We already knew that.

Thirteen: ... you're right. It's normal.

Kumar: Told you.

[Commercial]


Scene 6

House: Well, if it doesn't look like anything weird happened... Maybe that just means nothing weird happened.

Foreman: Sure, the entries just wrote themselves out of order. Perfectly normal.

House: I mean, maybe these entries always do that. In which case, if we can write the same entries again--

Kumar: But the logs are sanitized! We don't know what data the user entered.

House: Which we would care about if the user had actually entered any data. But according to these logs, they just pressed four buttons.

Taub: You're saying you think it breaks any time a user pushes these four buttons. And nobody's ever noticed before?

House: Look at them! They're pretty weird buttons. Have you ever pushed them in this order?

[Silence.]

House: Me neither. Go try it.


Scene 7 - In the lab.

Taub: This is stupid. We're just making this sequence of four edits, there's no way we could reproduce anything this way.

Thirteen: Wait! What was that?

[Dramatically zoom on their faces.]

Taub: It's a NullPointerException!

[Commercial]


Scene 8

House: So there was a NullPointerException, and you guys didn't even notice it in the logs because didn't include any context in the grep. (Idiots.)

Taub: But we still weren't able to reproduce the issue the user saw. The entries were all written in order.

House: Who cares? We found a bug. Go fix it.


Scene 9 - The cafeteria

House: How's that refactoring going? Still think that making your code into thirty small files instead of one big one will make it somehow better?

Wilson: Actually, yes. When I moved the code around, I found three subtle bugs that had probably been annoying users for months.

House: Moving the code... (stares into space with a satisfied look)


Scene 10

House: You weren't able to reproduce it because you were running the wrong code.

Thirteen: But we checked! The bug fix from last month was already in production.

House: Not that bug fix, the other one that I made because I was annoyed that NullPointerExceptions could cause entries to be written out of order.

[Team stares blankly at him.]

House: Here, move these four lines back down to the bottom of the method, then push the shiny buttons again.

Taub: He's right, it reproduces.

House: And that bug fix is already lined up to go to production, and the NullPointerException's fixed now too.

Kumar: So you're saying we're done?

House: Yeah.

Kumar: Well, that was anticlimactic.

7 Comments:

At 11:08 PM, February 01, 2008, Anonymous Oliver said...

Awesome.

 
At 9:49 AM, February 05, 2008, Blogger RedCat said...

That totally made my morning.

 
At 6:05 PM, April 09, 2009, Anonymous Lisa Simone said...

Excellent meanderings! I love House too, and your turning the medical stuff into software bugs was a great read.

I found your blog because I was searching for similar stuff - I wrote a book about technical mysteries for engineers - very much like the House episode you wrote. Cast of characters, broken product, and then real techniques to help debug the problem.

You might like some of the same stuff I write on my blog under the "Let's Debug It" category.

I plan on writing a short blog article pointing to your House post - because it can be fun too.

Thanks for adding humor to problem solving.

Lisa Simone

"If I Only Changed the Software, Why is the Phone on Fire?"
http://www.amazon.com/Only-Changed-Software-Phone-Fire/dp/0750682183/ref=sr_1_1?ie=UTF8&s=books&qid=1239314621&sr=1-1

Real Life Debugged Blog
http://www.lisaksimone.com/phoneonfire/let%e2%80%99s-debug-it/

 
At 8:15 PM, April 09, 2009, Anonymous Lisa Simone said...

Hi John

I just wanted to let you know I put up a post about your House Episode here. I really enjoyed it. Hope you enjoy mine.

Best Regards
Lisa

http://www.lisaksimone.com/phoneonfire/2009/04/09/new-episode-of-house-md-weve-got-a-user-error-message/

 
At 8:32 AM, January 22, 2010, Anonymous Anonymous said...

I just found the website who writes about
Several
home business reviews

If you want to know more here it is
home business reviews
www.home-businessreviews.com

 
At 5:46 PM, August 19, 2010, Anonymous Anonymous said...

These online sports betting become widely patronized especially among the global masses. Since the globe contains a huge number of masses compared to the other two social statuses, the online sports betting is pouring a lot of money compared to Las Vegas - the betting capital of the world. [url=http://www.pulsebet.com/bg/]bet online[/url] [url=http://www.pulsebet.com/da/]bet online[/url] [url=http://www.pulsebet.com/de/]bet online[/url] [url=http://www.pulsebet.com/es]apuestas[/url] [url=http://www.pulsebet.com/fr/]jouer en ligne[/url] [url=http://www.pulsebet.com/gr]bet online[/url] [url=http://www.pulsebet.com/jp]bet online[/url] [url=http://www.pulsebet.com/nl]bet online[/url] [url=http://www.pulsebet.com/pl]bet online[/url] [url=http://www.pulsebet.com/pt]bet online[/url] [url=http://www.pulsebet.com/ro]bet online[/url] [url=http://www.pulsebet.com/ru]bet online[/url] [url=http://www.pulsebet.com/se]bet online[/url] [url=http://www.pulsebet.com/it]bet online[/url] [url=http://www.pulsebet.com/cn]bet online[/url] To get started, decide on a sport to bet on and an online sportsbook to place your wager. Selecting a wager venue used to be a very secretive mission and your betting options were limited to what an individual bookie, or book maker, was capable of covering. These limited choices resulted in odds stacked against the bettor and an apprehension when it came time for payouts. http://www.pulsebet.com/bg/ http://www.pulsebet.com/da/ http://www.pulsebet.com/de/ http://www.pulsebet.com/es/ http://www.pulsebet.com/fr/ http://www.pulsebet.com/gr/ http://www.pulsebet.com/jp/ http://www.pulsebet.com/nl/ http://www.pulsebet.com/pl/ http://www.pulsebet.com/pt/ http://www.pulsebet.com/ro/ http://www.pulsebet.com/ru/ http://www.pulsebet.com/se/ http://www.pulsebet.com/it/ http://www.pulsebet.com/cn/

 
At 12:19 PM, May 11, 2013, Anonymous James said...

I was wondering how to improve my business. Then I finally visit this blog, i found something interesting and helps me to understand my way to improve my business. Great blog!

 

Post a Comment

<< Home