Yes. I admit it. I created a zombie. Very recently in fact. It was ugly (embarrassingly so) and, like all zombies, very hard to kill once it had been created.
No, this is not an excerpt from a Bela Lugosi movie â€“ I refer to something far more horrifying. A zombie session in CCXML.
The route to avoiding zombie sessions is pretty straightforward â€“ just follow the rules, set up your handlers properly and all will be well. Occasionally, however, mistakes are made and applications are not tested as thoroughly as they should be.
So as some self imposed penance, I’ve decided to list some tried and true methods for avoiding zombie sessions. Nothing new here, but it helps to go over this stuff every once in a while.
Always <exit> properly
When catching errors, be very careful not to get fancy, especially with a handler that is meant to catch multiple types of errors.
Some people try and get cute here, and execute logic inside this transition â€“ be very careful. If the logic has an error in it, you will enter a loop and have a really bad day. I don’t even like to put log statements in this kind of transition. Log files are generally verbose enough to tell you what the problem is.
Order <transition>s carefully
When a CCXML file is executed, <transition> elements are executed in document order â€“ even though a more appropriate <transition> for an event exists in a document, the CCXML platform will execute the first <transition> that matches the event/condition in document order. So, even though you place your catch all error handler (like the one above) at the end of your file, if you have another problem in a different <transition>, it may never get executed. For example, consider the following:
<log expr=â€’This log statement has an error’â€>
<!– A semantic error in another part of my CCXML app will get me stuck here –>
Set up your zombie killer in advance
Make it standard practice to send an event to the currently running session when the page loads to close things down after a certain period of time if the session doesn’t end normally.
<transition state=”‘initial'” event=”ccxml.loaded”>
<send event=”‘sessionEnd'” target=”session.id” delay=”‘600s'”/>
Test. Test again. Test some more…
The best way to ensure that your not going to create some zombie sessions (or do anything else really stupid) is to test thoroughly.
The best way to do this â€“ in my humble opinion â€“ is to download a copy of Voxeo Prophecy and use it to develop your application. You can use Prophecy to test your application in your own environment before moving it to Voxeo hosting, or upgrading to a production version of Prophecy to run your app.
Be careful. Follow these steps. Avoid all zombies. Good luck!