Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
add comment

3 Answers

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.

share|improve this answer
add comment

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.

share|improve this answer
    
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 Dec 17 '09 at 23:10
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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