Timer causing a crash

Version 1
    This document was generated from CDN thread

    Created by: Grant Bagdasarian on 13-03-2012 10:58:21 AM
    Hello,
     
    We have two Cisco machines:
    - 3825/IOS 12.4(15)T9
    - 3945E/IOS 15.2(2)T 
     
    I have a tcl script which contains a timer. This script works on the 3825, but as soon as I configure the tcl script as a service under application the machine crashes. Using the following commands:
    config t
    application
    service MyScriptWithATimer
     
    This is the error:  15:40:07 CET Tue Mar 13 2012: Unexpected exception to CPU: vector D, PC = 0x2BAAFB5.
     
    When I comment the timer command: timer start named_timer $poll_interval pollwait, it does not crash and the script is loaded. But the timer should start when the application is loaded and an instance is created. This is pretty much the main idea of the script. It does something when the timer expires. 
     
     
    proc start_poll_timer { } {
    global poll_interval
    timer start named_timer $poll_interval pollwait
    fsm setstate INITIAL
    }
     
     
    #State machine here
     
    fsm define FSM INITIAL
    start_poll_timer
     
    Is the hardware faulty or is there another reason?
     
    Thanks,
     
    Grant
     

    Subject: RE: Timer causing a crash
    Replied by: Yaw-Ming Chen on 13-03-2012 12:50:48 PM
    Hard to tell without complete script. Is it possible to post it ?
    Please indicate the IOS version too.

    Subject: RE: Timer causing a crash
    Replied by: Grant Bagdasarian on 14-03-2012 04:40:00 AM
    This is not the original script, since I'm not allowed to post our own source code. Instead I made a new script which uses a timer to do something.

    I've tested on both machines:

    - 3825/IOS 12.4(15)T9 --> This one executed the script without any problems.
    - 3945E/IOS 15.2(2)T  ---> This one crashed again.

    proc init { } {
    puts "Loading done..."
    }

    proc do_something { } {
    puts "I'm now doing something...."
    start_poll_timer
    }

    proc disconnect { } {
    call close
    }

    proc start_poll_timer { } {
    timer start named_timer 5 pollwait
    fsm setstate INITIAL
    }


    init

    #-----------------------------------------------------------#
    #      STATE MACHINE      #
    #-----------------------------------------------------------#
    set FSM(INITIAL,ev_named_timer) "do_something same_state"
    set FSM(any_state,ev_disconnected) "disconnect same_state"
    set FSM(any_state,ev_disconnect_done) "disconnect same_state"
    fsm define FSM INITIAL
    start_poll_timer

    Subject: RE: Timer causing a crash
    Replied by: Raghavendra Gutty Veeranagappa on 14-03-2012 05:44:33 AM
    Hi Grant,

    As per your code TCL script will keep on calling start_poll_timer procedure for every 5 sec, it is in loop.

    Thanks,
    Raghavendra

    Subject: RE: Timer causing a crash
    Replied by: Grant Bagdasarian on 14-03-2012 05:47:40 AM
    Hello,

    Yes, that's the purpose of the script. What the original script does is poll for a call from a web service each X seconds to place  a call. This works just fine on our 3825 machine.

    I now have another problem. The 3945E keeps crashing on boot, because each time it boots it tries to load the script.

    Does anyone know how I can fix this? Erase the startup config or something?

    Thanks,

    Grant

    Subject: RE: Timer causing a crash
    Replied by: Grant Bagdasarian on 14-03-2012 06:26:33 AM
    Never mind, I managed to fix it using the rommon mode and confreg 0x2142 to ignore the NVRAM. After it booted up with a clean config I deleted the tcl script from the flash and rebooted back with confreg 0x102. Now my initial config is back but the device doesnt crash anymore since it cant find the file on the flash

    Subject: RE: Timer causing a crash
    Replied by: Yaw-Ming Chen on 14-03-2012 11:11:44 AM
    Don't know what exactly you are trying to do but just like to mention that if the task is not call processing related you can utilize Cisco EEM Tcl script.
    Such as executing some CLI duing boot up, executing CLI every X seconds by using watch dog timer ....

    Subject: RE: Timer causing a crash
    Replied by: Grant Bagdasarian on 16-03-2012 03:46:45 AM
    It is call processing related. This tcl code was just an example of the timer.

    I've already opened a TAC case about this since  we obtained the 3945E through the Cisco Demo Loan Program.

    Thanks for the info Yaw-Ming. Cisco EEM is going to come in handy as I already have some application in mind which must utilize the CLI.

    Subject: RE: Timer causing a crash
    Replied by: Grant Bagdasarian on 10-04-2012 05:23:12 AM
    This is a bug in the IOS. The TAC team pointed it is the following bug: CSCts69887    %SYS-3-MGDTIMER: and %ALIGN-3-TRACE At Bootup Due To TCL Files