Reporting Crashes in IMVU: Catching Python Exceptions

For years now, I have been meaning to write a series of articles on the automated crash reporting system in the IMVU client. This first article will give a bit of background on the structure of the client and show how we handle Python exceptions.

At IMVU, we generally subscribe to the Fail Fast philosophy of handling errors: when the client encounters an unexpected error, we immediately crash the program and ask the user to submit a crash report. As part of the crash report, we send log files, stack traces, system information, and anything else that might help us debug the failure.

You might wonder why we crash the program whenever anything goes wrong rather than trying to catch the error and continue running. Counterintuitively, crashing the program forces us to act on crashes and immediately exposes bugs that might trigger unwanted behavior or lost data down the road.

Now let’s talk a little bit about how the client is structured. The IMVU client is written primarily in Python, with time-critical components such as the 3D renderer written in C++. Since the client is a cross between a normal interactive Windows program and a real-time game, the main loop looks something like this:

def main():
    while running:
        pumpWindowsMessages() # for 1/30th of a second
        updateAnimations()
        redrawWindows()

This structure assumes that no exceptions bubble into or out of the main loop. Let’s imagine that updateAnimations() has a bug and occasionally raises an uncaught exception. If running the client with a standard command-line python invocation, the program would print the exception and stack trace to the console window and exit. That’s all great, but our users don’t launch our client by invoking python from the command line: we use py2exe to build a standalone executable that users ultimately run. With an unmodified py2exe application, uncaught exceptions are printed to sys.stderr (as above), except there is no console window to display the error. Thus, the py2exe bootstrap code registers a handler so that errors are logged to a file, and when the program shuts down, a dialog box shows something like “An error has been logged. Please see IMVUClient.exe.log.”

From a crash reporting standpoint, this is not good enough. We can’t be asking our users to manually hunt down some log files on their hard drives and mail them to us. It’s just too much work – they will simply stop using our product. (Unfortunately, most of the software out there asks users to do exactly this!) We need a way for the client to automatically handle errors and prompt the users to submit the reports back to us. So let’s rejigger main() a bit:

def mainLoop():
    while running:
        pumpWindowsMessages()
        updateAnimations()
        redrawWindows()

def main():
    try:
        mainLoop()
    except:
        error_information = sys.exc_info()
        if OK == askUserForPermission():
            submitError(error_information)

This time, if a bug in updateAnimations() raises an exception, the top-level try: except: clause catches the error and handles it intelligently. In our current implementation, we post the error report to a Bugzilla instance, where we have built custom tools to analyze and prioritize the failures in the field.

This is the main gist of how the IMVU client automatically reports failures. The next post in this series will cover automatic detection of errors in our C++ libraries.

12 thoughts on “Reporting Crashes in IMVU: Catching Python Exceptions”

  1. Thanks I feel a little with a little more understanding about crashes.I love Imvu and had been getting a lot of crashes then it wouldn’t let me in, said it was an error and I could go to applications thats where I got lost. I sent the error to support. Again thanks for eaasing my mind.
    Avatar Zokco

  2. plz help me this guy i know has some kinda crash code.. he crashes me every time i am in mile high and he crashes everyone else to piss us off idk what to do he just inters the room and tells us bye bye and then crashes us plz help me and how do i tell imvu…

  3. it keeps crashing and today when i clicked on it to get on it said that imvu was encountering problems and i want it fixed immeditly by the weekend or by tomorrow cause i loved it it was fun and not being able to get on it was bad caus eof you guys i want it fixed or im going to sue you guys im 26 and i want my imvu turned back on pronto

  4. I have been randomly crased out of public rooms very often now … How do I figure out what code the person has used to crash me from the error report … Any help ?

  5. everytime i press on imvu to log in its say imvu has crashed its been doing this since i downloaded the new imvu version plz help me i can’t even log in and it doesen’t even show the log in panel help me

  6. i have the same case like lela
    when i log in it crash ..
    i always try to download the latest version ..
    and when i was about to use it .. it crash ..
    please hlp me .. thanks ..

  7. Can you explain how someone that uses imvu can crash anyone they wanted just by being in a chat room with them? That shouldn’t be right if it’s not their room or do it with out a reason like this.

  8. i had to reinstall windows xp.ever since then i tried to download imvu……………it crashes on me.it won’t let me log on …what do i do to fix this problem? please help me…….i miss my imvu.

  9. hey imvu been using imvu for years and i would be happpy if someone actually helped me with the problem because this is new imvu has stopped working on my laptop i ca download it log in then nothing else happeneds someone please help

  10. I have been recently hoping to help try this to my Pc however I find it difficult to seem to do it. Have you any idea of a very good computer place that can do this for me?

  11. it wont let me log onto imvu…like when i download it it downloads then it says imvu crashed do i wont to restart it ..i will push yes then it will keep asking me do i want to restart imvu

Leave a Reply

Your email address will not be published. Required fields are marked *