5

What happens to executing Timer Jobs when the Timer Service is restarted?

Does it abruptly abort any executing jobs? Is there an exception to catch (for example ThreadAbortException) in your timer job code if and when this happens?

If it does abort executing jobs, how do SharePoint OOTB timer jobs avoid having data lying around in an invalid state?

3 Answers 3

1

Well, I just did a little test. I set a breakpoint on one of my custom timer jobs and waited for it to run. Once the breakpoint was hit, I restarted the sptimerv3 service. Well, after a few seconds the debugging mode ended. I didn't get an exception or anything really.

I don't know how the OOTB timer jobs handle that but I do know is when I developing my custom timer job, each time I needed to test my code, I had to restart the service. Well, even though I had my timer job set to run every minute, sometimes I would take up to an hour for it to run my timer job. I think this is because when the service restarts, it has to do some cleanup or catchup from it's previous state, which is why it took so long for it to get to my timer job.

0

Recently i had a timer job that took more time than the ½ hour that was the running interval between jobs first time it ran. It would then run a second time right after the first one, i guess to "make up for" that it had skipped a run while processing the first one.

1
  • I have a VM suffering perf issues at the moment and it's logging the message The previous instance of the timer job 'XYZ', id 'ABC' for service '321' is still running, so the current instance will be skipped. Consider increasing the interval between jobs. This indicates that some timer job runs are skipped.
    – Alex Angas
    Commented Dec 17, 2009 at 23:10
0

I guess it will restart.. I reckon it's the same as when a timerjob crashes due to programmatic errors. When you restart the timerservice then, the crashed timerjob will run again (and again and again) until the timerjob is removed from the timerjob definition list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.