rss
 
comment(s)

archives
J|F|M|A|M|J|J|A|S|O|N|D
(20##) 10 9 8 7 6 5 4 3 2 1 0 <
 
DesktopWeb FormText   eva : may not crashTue, 10 Feb 2009 15:55:53 GMT # 

Eva is my alarm clock, so she/it has to be bulletproof. the app cannot crash, nor can it get into a blocked state. so there is tons of exception handling and logging to let me know what is going on in the system. anything that might crash or hang is spawned on a separate thread, in case it needs to be aborted. e.g. i'm using a 3rd party lib for reading ID3 tags, and it hangs on some random mp3 files (like 1 out of 10,000), so that has to be handled. the heavy use of DirectShow is problematic too. first, its really easy to introduce memory leaks. that code has tons of redundancy for releasing references to COM objects. the trickiest part with DirectShow was event handling. started out handling the events myself, but it was possible to get into a state where DirectShow was blocking. it would take skipping through hundreds of mp3 files to recreate this, making it near impossible to recreate and debug. anyway, i tried adding tons of thread handling to avoid race conditions, etc... but the end fix was to just use the applications message pump and have it handle the events. not sexy ... but it cleaned up the code and it is reliable, so that won out. the last problem is that some video files, actually its the codecs they require, will flat out crash DirectShow and the hosting app with an unhandled exception. it doesnt matter if the app is handling 'unhandled exceptions' ... that gets ignored, and the app crashes. to handle this, all music videos have to be pre-scrubbed before being moved into the library. this involves having a separate app try to play each music video in a separate process, and it checks the exit code to see if the process crashed. again, ugly ... but effective. finally, eva will auto restart if an unexpected crash does occur. in this situation, eva speaks to all zones that she is shutting down and starting up ... to let me know there was a catastrophic failure. for hardware, eva is on a notebook (which has a battery) and on an UPS, and the speakers in my bedroom are also on an UPS. if the Windows Home Server were to crash and the music files for the alarm cannot be found, then it plays a default beep. about the only way i wouldnt hear the alarm is if i manually turned down the volume on the speakers. aside, for testing, eva has a built in test harness. this uses hundreds of example commands that randomly get sent to eva for processing from a random zone. its like having multiple users sending a command(s) every couple of seconds.