Data Center Crash from Faulty Loop
A simple indexing error in a loop led to a catastrophic crash of all computers in a data center.
When working on social network ads at Google (remember Myspace?), I wrote some C++ code that looked something like this:
for (int i = 0; i < user->interests->length(); i++) {
for (int j = 0; j < user->interests(i)->keywords.length(); j++) {
keywords->add(user->interests(i)->keywords(i))
}
}Readers who are programmers probably see the mistake: The last argument should be j not i. My unit tests didn’t catch the mistake, nor did my reviewer. After going through the launch process, my code was pushed late one night—and promptly crashed all the computers in a data center.
Names and the company have been scrubbed. Stories are lightly edited for length and clarity, never for content. If something here is yours and you want it taken down, email me and it's gone.
Sign in to join in. Reading needs nothing.