151
Views
4
Comments
Solved
Timer bug
Question

1. Why timeout is 20 min, but timer is still running?

2. Why timer body is not dubugable (no breakpoint hits inside)?

3. How to terminate timer? I know there is no such functionality for years, no matter how many years developers is asking about it. And I know the workaround - to set a parameter in SiteProperty. But why?..


Thanks.

Dmitry.

2020-05-07 18-53-00
Rui Barradas
 
MVP
Solution

Hello Dmitry,

Hope you're doing well.

Responding to your questions:

1) The timer has indeed a defined 20m timeout, but it doesn't exactly stop right after 20 minutes. This happens because the platform has a threshold after the defined timeout. In your case, if you watch carefully, there's a warning in your image (next to the current duration). If you put your mouse on top of the warning, you will have a message referring to this. The platform knows that the timeout exceeded, but is trying to finish the process during the threshold.

2) Timers are debuggable, I never had issues debugging timers. You just need to make sure that the module and the environment have the correct configurations. Try to put a breakpoint in the beginning of the logic (when the timer is not running), turn on the debugger mode in Service Studio and run the timer afterwards. It should stop in the breakpoint a couple seconds later.

3) It's indeed hard to terminate a timer because every time a timer is going to be executed, a request is sent to the server to execute the job. The timer is executed by the Scheduler Service via Web Service, which is automatically generated by the platform. This means that you can kill a timer with an IIS Reset, but I strongly advice you to be careful with this procedure. Specially because doing an IIS Reset may lead to inconsistent information on the database (for example, showing in Service Center that the timer is still running while it's not). In this case, you may run the timer again or update the system table OSSYS_CYCLIC_JOB_SHARED (also be careful when changing system entities). That's why it's a good practice to have a control Site Property, as it will work as a on/off switch for the timer. 


Hope that this helps you!


Kind regards,

Rui Barradas

2024-12-18 16-06-42
Junaid Syed

Hello Dmitry,

By default Timer has Timeout of 20 minutes. you can change the Timeout from Service Center or from code. Note that logic which you have implemented inside the Timer if not completed within Timeout duration, Timer will retry his operation for 2 times and after 2 retries Timer is killed. 

Regarding debugging timer logic you can refer below two posts

https://www.outsystems.com/forums/discussion/51123/how-can-i-debug-a-timer/

https://www.outsystems.com/forums/discussion/64757/debug-timer/

About being able to terminate the timer, you know the answers already :-)

Hope this helps!

Junaid

2020-05-07 18-53-00
Rui Barradas
 
MVP
Solution

Hello Dmitry,

Hope you're doing well.

Responding to your questions:

1) The timer has indeed a defined 20m timeout, but it doesn't exactly stop right after 20 minutes. This happens because the platform has a threshold after the defined timeout. In your case, if you watch carefully, there's a warning in your image (next to the current duration). If you put your mouse on top of the warning, you will have a message referring to this. The platform knows that the timeout exceeded, but is trying to finish the process during the threshold.

2) Timers are debuggable, I never had issues debugging timers. You just need to make sure that the module and the environment have the correct configurations. Try to put a breakpoint in the beginning of the logic (when the timer is not running), turn on the debugger mode in Service Studio and run the timer afterwards. It should stop in the breakpoint a couple seconds later.

3) It's indeed hard to terminate a timer because every time a timer is going to be executed, a request is sent to the server to execute the job. The timer is executed by the Scheduler Service via Web Service, which is automatically generated by the platform. This means that you can kill a timer with an IIS Reset, but I strongly advice you to be careful with this procedure. Specially because doing an IIS Reset may lead to inconsistent information on the database (for example, showing in Service Center that the timer is still running while it's not). In this case, you may run the timer again or update the system table OSSYS_CYCLIC_JOB_SHARED (also be careful when changing system entities). That's why it's a good practice to have a control Site Property, as it will work as a on/off switch for the timer. 


Hope that this helps you!


Kind regards,

Rui Barradas

2023-07-23 14-37-01
Bad Code Guru

@Rui Barradas Thank you for your complete answer.

I managed to debug the timer. It appears that my code hangs on build-in Distinct action where I pass around 20k records at once. I will refactor my code to feed the timer with smaller chunk of data, but I bet there is something wrong besides the bad code -- Distinct action should not hang more then 20 min to distinct 20k records... 


Update: The fun part of it, is that I cannot stop the timer and don't wanna wait 20+ mins when it dies to run again and check if it is fixed, and then again... :) So, I do CTRL+C -> CTRL+V the timer and run its clone. Finally I have several dangling timers, but development process a bit faster. :) 

2020-05-07 18-53-00
Rui Barradas
 
MVP

Hello again Dmitry,

It's hard for me to help that much without knowing the logic and the purpose of the code. But just by looking... Are you sure the timer is not "stuck" in the cycle after the ListDistinct? Because you are iterating that list right after. If the list returns several records, it may take a while to execute the cycle.


Kind regards,

Rui Barradas

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.