Stop a timer
Is there any way to stop a timer?

I was running a timer in debug mode and I know its timeout is ignored in that mode. However, I stopped the debugger, closed browser page where the debug was running.

The timer was (apparently) still running.

The timer had a timeout of about 500min, but I couldn't wait that long. I tried stopping the Outsystems services and preformed an iisreset, with no results.

Eventually I ended up restarting the machine (fortunately I had that option). It was an extreme measure, but it got me wondering: is there any way to abort a timer once he gets "stuck"?

Well...not even the restart did it! The "Duration" field of the timer is still counting! :|
And I can't run the timer again... Is it really necessary to wait for the timeout?
Rank: #213
Hi Ricardo,

The information about the "duration" of the timer execution displayed in Service Center is computed based on the ossys_cyclic_job.is_running_since system table. The scheduler service is responsible for the maintenance of the coherence of this table (based on the timers that executes).

On the other hand, a timer request is simply a web service request executed by the Scheduler Servicer to your application (the web service is internaly generated by the outsystems platform).

From this information you can deduce two things:
1. If you restart IIS, the timer stops (as a timer is simply a web service request, this means a iisreset will definitely kill your timer execution).
2. If the information about the duration in the Service Center appears wrong even after an IISReset and a Scheduler Service restart, this means that somehow the information in the system table became inconsistent on the database (i.e. the scheduler service was not able to update the ossys_cyclic_job.is_running_since timer entry correctly). To correct it you can run the timer again (so that the scheduler service corrects it).

Best regards,

Daniel Lourenço
Rank: #1001
Hello Ricardo,

I once had a similar problem with an endless loop (the timer would wake itself indefinitely). I tried to disable the timer in service center but it kept running.

I think what worked for me was republishing the eSpace current version.

Maybe you'll also have to update the Next_Run on the database in order to avoid the timer to be scheduled to run again after the publishing process has endend.
Rank: #2522
Hello all and Daniel...

Your answers  may all be correct but somethimes in Outystems none of those methods work to reset the timer. You really have to go to the database to the tables OSSYS_CYCLIC_JOB or OSSYS_CYCLIC_JOB_SHARED (depending on if its multi tenant or not https://www.outsystems.com/forums/discussion/14792/difference-between-system-tables-for-scheduler/) and kill the job erasing the field in "IS_Running_BY" collumn and placing a zero at the field in "NUMBER_OF_TRIES" Collum".

Be careful anyway this is not supported or recommended by Outsystems (since it's changing the database), but it works!! For me it was the only way...

For other nicer way to avoid to do this we have to wait for Outsystems to implement something like is suggested in the page 

Rank: #2522
I Forgot to say...You Should erase the field "IS Running_Since" also (maybe even more important)...
Rank: #2522
I had this issue again. I saw the post again and it wasn't the complete procedure I have done. Doing the right thing is never wrong...

Thank you for answering after 7 years and 4 months
Rank: #13
Recently our practice is to have daily timers running small portions.

let's say you have 100 records to process.
then we do 10 and call the timer again.
but the first action in the start will be "UseKillSwitch"-boolean, so we always can kill a timer when needed.
that boolean can be a database or a site-property ofcourse.

Rank: #865

For the case when the timer is waking up itself - what I did I removed all logic from the timer and published the espace. On next wake up it picked up the new code and exited. Simple and no messing with DB. But really there should be a way to stop it from service center, which I was looking for.

Rank: #9713

You can also add logic to look at a site-property e.g. TimerStop to decide whether to continue processing or to wake itself again. This way you can control the timer from service center by changing the value. 

To stop  a itself waking timer, give the siteProperty a default value True, insert an if statement before waking up the timer again and skip the waking of the timer when the value is True. 

This doesn't help of course in the case the timer-process crashed somehow and didn't have the change to register itself as not-running. In that case only manipulation of the "IS Running_Since" field or waiting for the time-out will be the option to run the timer again.