June 13, 2009 at 10:50 AM by Dr. Drang
So the Twitpocalypse claimed two prominent Twitter clients, Twitterrific (the iPhone version) and Tweetie (not sure which version—maybe both). Hard to believe that professional programmers were caught by something that was both obvious and well-publicized.
A little background: Twitter assigns each tweet a unique ID number. The ID is just a counter that increments by one with each tweet that gets posted. Yesterday, the total count of tweets posted since Twitter began passed 2,147,483,647, which is the largest number that can be represented by a signed 32-bit integer. A signed 32-bit integer can handle values from (–231) through (231 – 1)—that’s 232 values in all. So if a Twitter client uses signed 32-bit integer variables to store IDs, all hell will break loose when an ID greater than 2,147,483,647 appears. That’s the Twitpocalypse.
Twitter began warning developers about the coming Twitpocalypse months ago. One simple fix would be to switch from signed 32-bit integers to unsigned 32-bit integers. That would stave off the Twitpocalypse until IDs reach 4,294,967,295 (232 – 1), and is the solution implicit in this patch.
You might well ask why a programmer would use a signed variable to hold a value that would never be negative. Laziness and habit would be my guess. Still, with months of warning, you’d think that any decent programmer would be able to search his or her code for variables declared as signed instead of unsigned.
I’m sure both Craig Hockenberry (Twitterrific) and Loren Brichter (Tweetie) did that search, but obviously they didn’t do it well enough. Last night, Twitterrific for the iPhone began issuing an error message every time it tried to retrieve new messages from the server.
Twitterrific thus became unusable, and I switched to Tweetie. This morning, Brichter apologized for searches being hosed by the Twitpocalypse. Since I almost never search Twitter, my use of Tweetie was unaffected.