Fresh out of college and out of money, Johan K. started work at Midgard Manufacturing as a junior developer. His supervisor Ragna made it clear: he would only be responsible for coding error handlers.
“Our plant equipment is several decades old,” she said, “and we have to rely on the manufacturer-provided documentation for adequate coverage. To be honest, none of the senior developers want to bother. So instead of bothering one of them, you’ll be doing it.”
Johan didn’t have a problem with this. He knew he’d have to earn his chops at Midgard. But after he was given the stack of manuals that towered over his monitor, he wondered just how long it would take.
Pride Goeth Before a Fall
One month later, he had made it through a hundred pages of the first manual. Ragna checked in periodically, more interested in how complete his code was than how quickly he was getting through his list of error conditions.
The manual he was working on was for a steel press. Vintage 1985, the steel press’s firmware – using Microsoft Xenix – relied on the flakiest of communication protocols: passing information via temp file. Every night around 2AM, the press would go down for maintenance. A shell script, written by Johan, would read data from the temp file the steel press had created, enter it into a SQL database, then delete the file from disk.
Half the lines of code in Johan’s script were
if/then blocks, one for each condition listed in the manual.
# if the temp file was created successfully ... # if the local file was written successfully ... # if the temp file was successfully removed from the firmware ...
That last one got Johan thinking. When has a
rm command ever failed silently? Would he really need to check that the file was removed? The conditions for that to happen seemed as impossible as, well, the end of the world. However, as it was listed as an error condition in the manual, he had to put something in.
echo "Ragnarok has come, the Midgard serpent awakes" > /dev/lpr
In this unlikely event, an error would be spit out to the old dot matrix printer in the office, so someone would see it. For good measure, he also had an email sent to
firstname.lastname@example.org, as well as sending an SMS text. Johan thought that should take care of it.
Hour of the Wolf
Several months later, Johan had finished coding the conditions in the first manual. His script had been tested and deployed, and it now monitored the steel press. Things had gone well for a few weeks.
Then, at 3 AM, his phone started buzzing.
The screen filled text messages. Each read the same: Ragnarok has come, the Midgard serpent awakes. His inbox overflowed with a thousand emails, each with the same text as the alert. At first he thought it was a prank by one of the senior developers.
Then he remembered.
He rushed to the office, half-awake. As he entered the unlit office, he heard something tearing and squealing from the other side of the room. After stumbling over some office chairs, he found the source: the dot matrix printer. It had chewed through an entire box of feed paper.
Ragnarok has come, the Midgard serpent awakes Ragnarok has come, the Midgard serpent awakes Ragnarok has come, the Midgard serpent awakes ...
Not Worthy of Valhalla
Ragna was surprisingly forgiving of Johan. Johan wrote out a proper error message, which would be emailed to only himself and a few other staff, so that his script could fail gracefully.
The senior developers, though, weren’t so kind. His cubicle walls were papered with sheets of line feed, glued so they couldn’t be pulled off, the apocalyptic words smeared in ribbon ink. Someone impersonating Loki from the Marvel movies would randomly message him from an unlisted number. He even found a plush snake wrapped around his computer monitor one morning.
Johan thought it was a good lesson in hubris. He knew it could have been worse: at least it hadn’t gone out to all of Midgard’s customers…