RSS
 

How I broke Grooveshark Lite

07 Dec

I am a PHP and MySQL developer, primarily, and my main responsibility is the server-side Grooveshark Lite components. A couple of days ago I got to write my first ever Actionscript for the Grooveshark Lite front end; an ad rotator to handle ads more statefully and therefore more intelligently.

First I ran into a horrible language bug that causes a nasty runtime crash wherein Flash complains that it can’t resolve a class with itself. I wasn’t doing any weird voodoo with class definitions and Katy, our primary Flex developer, couldn’t find anything wrong with my code, but rewrote some of it anyway. Poof, problem fixed.

Everything looked fine so we thought we were ready to launch. So we did last night. Skyler complained that album art wasn’t loading for him, but he had just reinstalled 64 bit flash on 64 bit Linux, and he’s had weird problems with that before. We were unable to reproduce, attributed it to Flash+Linux weirdness and ignored the issue. Today, more people complained about it. We were not able to reproduce. Eventually I figured out that the bug was only affecting non-debug versions of Flash, but I couldn’t imagine what would be causing album art to not display: my code has nothing to do with displaying images, and I could see in Firebug that the art was being fetched properly, nothing was wrong with the headers, etc.. But it definitely worked fine in the debug version of Flash. Katy looked at it, and through process of elimination was able to determine that the problem was somewhere in my code, but couldn’t tell where exactly. Everything looked valid, and from the perspective of the debug version of Flash, it was, but my code wasn’t very “actionscripty” – because I’m used to writing PHP and haven’t had any sort of training on actionscript beyond looking at existing code and occasionally looking at a language reference book. Katy couldn’t figure out what was wrong with my code, so she rewrote it, and now everything is back to normal again.

I don’t yet know what part of my code was causing the problem, so on Monday I plan to reinstate my code, downgrade to the non-debug version of flash, and figure out what the heck is causing the bug. My instinct tells me that it’s probably a combination of an optimization setting in non-debug Flash combined with my use of Actionscript in a way that is technically valid but that no Actionscript coder would ever normally use it. For example, Katy says I was using a generic Object as a Dictionary, because I was actually trying to replicate associative arrays in PHP, I didn’t know about the Dictionary object, and when I had asked previously how to do that, I was told to use an Object. :P

The good news is that I don’t think many people outside the company paid much attention to this bug. They were too busy being excited about the new features that Katy introduced: broadcast to twitter, broadcast to facebook, and deep linking support: When you “byte” a song (open the info panel), your URL bar changes. You can simply copy the URL to share with a friend, *and* clicking back and forward work, so if you want to go from the song you opened back to the playlist you found it on, just click back in your browser. Freaky, but it works.

 
 
  1. Things That Work » Blog Archive » Obscure AS3 for-switch-if-false bug (VerifyError)

    December 9, 2008 at 6:02 pm

    […] we finally tracked down just how Jay broke Grooveshark Lite the other […]

     
  2. GL

    December 19, 2008 at 10:23 pm

    Windows 2000 SP4 all updates IE6 I have the latest flash player and the latest jre and grooveshark lite will not load. Please test the software thanks.

     
  3. Jay

    December 19, 2008 at 10:54 pm

    Hi, unfortunately I don’t have access to a Win2k PC to test with, so figuring out what is the problem may be a bit tricky. It’s working for me in IE6 in Windows XP, and that’s about the best I can do right now.

    Katy, our main Flex developer, suggested that the following information might be helpful in tracking down the cause:
    1. When Grooveshark Lite fails to load, what happens? Do you just get a white screen, or some text, if text what does it say?
    2. Are you going to listen.grooveshark.com or http://www.grooveshark.com or a tinysong.com link to get there?
    3. Do you have javascript enabled?
    4. Do you get any sort of javascript errors?
    5. Do other flash-based sites work fine for you (i.e. can you play youtube videos?)

    Hopefully we can narrow down the cause of your problems based on these answers.