AS3 Tweetr library suffers from the Twitpocalypse bug

Friday 26 June 2009  –  Filed under: Flash  –  5 Comments

UPDATE - Sandro has released an update for the Tweetr library that fixes the Twitpocalypse bug. You can find the update on Google Code.

It’s been a while that I’ve been programming ActionScript, but I recently started dusting off my rusty skills. I’ve been playing around with the Twitter API using swfjunkie’s Tweetr library. In the process I discovered that this library suffers from the Twitpocalypse bug.

The Twitpocalypse is nearPut simply, the Twitpocalypse bug has to do with numbers. Each tweet has a unique Status ID. The problem was that the number of tweets was about to exceed the maximum amount of possible id’s for a signed 32 bit integer, the mathematical property used to store these ID’s with.

Twitter itself fixed this problem before it could happen on the serverside, but any client application working with signed 32 bit integers to keep track of Status ID’s would suddenly start displaying negative ID’s once the maximum number (2,147,483,647) was reached.

It’s the Y2K bug all over again :-)

While working with the swfjunkie Tweetr library, I discovered that these classes also suffer from this bug. I witnessed tweets streaming in with negative ID’s and decided to investigate on how to fix this. It appears that a data parsing related class in the library uses the Actionscript int (32 bit) to store the ID’s with. Changing this property into a Number fixes the problem.

If you’re using the Tweetr library and are looking for a quick fix, you can download the updated version of the Tweetr library from my blog:
I’ve let Sandro know that I have updated his library, so he can integrate this fix in his official release. Note that I have also removed a conflicting import from the Tweetr class itself (line 18 in Tweetr.as, ‘import mx.events.IndexChangedEvent;’ to be exact).

5 Responses

  1. Sandro says:

    Heya Martin

    I’ve been so busy lately that i actually haven’t realized that this problem affects tweetr as well. Thank you for letting me know. I will apply the fix to the next release that i am working on. Once again, thank you for using tweetr and for spoting the problem ;)

    Cheers,
    Sandro

  2. Martijn says:

    Thanks for your reaction Sandro, looking forward to the update. Love the Tweetr lib!

  3. lembit's status on Saturday, 27-Jun-09 17:25:11 UTC - Identi.ca says:

    [...] AS3 Tweetr library suffers from the Twitpocalypse bug http://ow.ly/fVUb [...]

  4. Elliott Munoz says:

    The link to your Tweetr library is returning a page not found. Can you check your link? Thanks for your work.

  5. Martijn says:

    Hi Elliott – the link has been updated, thanks for letting me know.

Leave a Reply