Debugging (in) my sleep

Monday 26 March 2007This is over 17 years old. Be careful.

I often wake up before I need to get up, and I’ll look at the clock to see what time it is. For some reason, this often happens at 4:00 am. I don’t mean between 3:30 and 4:30, I mean between 3:55 and 4:05. I’ve long wondered what could make me open my eyes at the same time so often.

When it happened this morning, I wondered again, and in my hazy dream-like state, I finally came up with an answer. I decided there is a cron job running somewhere, and it’s a Python script that makes the mistake of overwriting a built-in function or type with a variable (like file=”foo”, or list=[1,2]), so that the next time the script runs, it fails, and that failure is what wakes me up.

The problem with this theory of course, as I realized the next time I floated up to consciousness, is that there is nothing in my bedroom running cron jobs. I forget the details, but I found a rebuttal to that objection too, so that I was pretty satisfied that I had finally found the answer.

In the clear light of morning, of course, the details elude me, though I can’t shake the feeling that I should look through my code for overwritten built-ins...

» 8 reactions

Comments

[gravatar]

I woke up at 4:30 this morning with my brain trying to figure out a solution to one of the questions on a Google recruitment questionaire. This one was something about writing an app that would color each side of a dodecahedron using only 3 colors in such a way that no side ever touched another of the same color... but as that's not possible I must have misremembered the problem which made my brain try and figure out what piece of the problem i wasn't remembering.



I wonder if the 4 am(ish) mental buzzing is a normal geek thing?

[gravatar]
My most memorable experience with this type of event was back when I was an intern at Motorola. I was developing an expert system in Turbo Pascal on the Mac (*shudder*). I had just completed codding up a ~3,000 line module and had not tried compiling it yet. Back then I had a habit of witting massive amounts of code, completing entire projects, before trying to compile them for the first time. I decided to put off compiling/debugging for the next day as I figured it would take a few days. (Sometimes learning how not to program is a better experience than being told how to do it right.)

That night I drempt(sp?) I debugged the module. It took many many recompiles in my dream, and two sessions in the debugger. The detail was quite something in that dream. The next day I went into work and fixed the bugs I found in my dream. I did not hit compile. I told a co-worker about my dream and we laughed about long hours and impossible deadlines.

I hit compile, and had 0 errors, and 0 bugs.
8 Months later, no bug had been found in the code.
(no clue after that as the project and Canton offices were closed).

This was a singular experience and it has stuck with me these past ~15 years. It is a rare experience where a piece of software I have written (no matter how small or simple) has run on the first attempt, let alone been bug free; which to my knowledge has not happened sense. I have had many dreams of compiling sense then, but nothing like that one extremely memorable dream. I still keep a printout of the code with my notes from that day.
[gravatar]
Do you live anywhere near a train line, Ned? ;)
[gravatar]
I'm glad to hear that others have similar dreams. I wish mine could be as productive as Doug's.

No trains nearby. Occasionally I hear planes, but I doubt they're flying over at 4am.
[gravatar]
Not quite the same thing, but I had a bizarre code-dreaming event recently. Details on my blog.
[gravatar]
Not exactly the same thing either, but on a lot of nights I'll be in bed reading and turn to look at the bedside clock and it's 11:11. I can't see the clock unless I turn my head, so I don't think it's peripheral vision.

Or I'll be facing away from the clock talking to my wife, and she'll ask what the time is and it'll be 11:11. It's probably just a coincidence since we're usually going to sleep around the same time, and that's just the times that stick in my mind.

Still, it's always a bit "whoa" whenever it happens! Well, it's almost 10, time to go to bed and wait for 11:11! :)
[gravatar]
I used to have this problem. It went away after I cut back on the caffeine a bit.

Of course, I only considered it a problem when I didn't have a challenging problem at work that needed a solution.
[gravatar]
it's the garbage collector that wakes you up

Add a comment:

Ignore this:
Leave this empty:
Name is required. Either email or web are required. Email won't be displayed and I won't spam you. Your web site won't be indexed by search engines.
Don't put anything here:
Leave this empty:
Comment text is Markdown.