Udostępnij za pośrednictwem


The Timer Recycle Job (job-timer-recycle)

Name

job-timer-recycle

Title

Timer Service Recycle

Default Schedule

Daily at 6:00 AM

Service

TimerService

LockType

None (Server)

Type

Microsoft.SharePoint.Administration.SPTimerRecycleJobDefinition

BaseType

SPAdministrationServiceJobDefinition

 

In SharePoint 2010 a daily job to recycle the Timer Service was introduced. Because many jobs written by many parties run in the same Timer Service process, one misbehaving job could cause problems for all other jobs on the same server, which could ultimately cause problems across the farm. To mitigate this risk, a job runs by default once daily at 6:00 AM to recycle the timer service. You can of course change the schedule or entirely disable the job-timer-recycle job by calling Disable-SPTimerJob or Set-SPTimerJob appropriately. You can also create and set the registry value indicated in the following PowerShell command to 1 to automatically disable the Timer Service Recycle job immediately upon creation in a farm (it would need to be set prior to creating the farm):

PS:> New-ItemProerty -LiteralPath "HKLM:\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0\WSS" -Name "DisableTimerRecycleUponCreation" -Value 1 -PropertyType DWORD

The primary work of the Timer Recycle job is to ultimately restart the Timer Service by calling on the Administration Service to do so. The restart operation itself is a typical stopping and starting of a service, utilizing the same methods as Restart-Service or NET STOP. There is, however, a prologue to the restart with a number of steps to help ensure a clean and efficient recycle. We'll discuss these steps now.

After the timer job begins it passes through first a Warning and then a Countdown phase. You can follow these phase transitions via messages in the SharePoint ULS logs. By default, the Warning phase is set to last 10 minutes. You can check and change this period using the following commands:

PS:> $Timer = (Get-SPFarm).TimerService
PS:> $Timer.RecycleWarningMinutes
PS:> $Timer.RecycleWarningMinutes = 3
PS:> $Timer.Update()

At the start of the warning phase, all pausable jobs (jobs derived from SPPausableJobDefinition) are sent a message to pause themselves. During the warning phase no new non-critical jobs are allowed to start. The two internal jobs, the Timer Locks Refresh job, the Config Refresh job, and all one-time jobs are the only jobs allowed to begin execution during the warning period.

After the period for the Warning phase has expired, the Timer Recycle job enters a 30-second final Countdown phase. During this period even critical jobs such as the Config Refresh job are not allowed to start. After the Countdown period ends one final check for running jobs is undertaken. If no jobs are running the Administration Service is now given the instruction to go ahead and restart the Timer Service. After waiting a final 30 seconds, the Administration Service finally restarts the Timer Service.

The care which is taken by the Timer Recycle Job to allow jobs to cleanly complete is something you may prefer to replicate any time you find it necessary to manually recycle the Timer Service. To call the job manually, simply execute this command:

PS:> Get-SPTimerJob job-timer-recycle | Start-SPTimerJob

Keep in mind that unless you change the RecycleWarningMinutes property as described above the recycling process will take over 11 minutes to complete.

Comments

  • Anonymous
    January 10, 2012
    Useful post, thanks for this information.
  • Anonymous
    January 13, 2012
    very useful, thank you. My issue is saying that SpadminV4 could not be contacted, and the timerreycle job is failed I checked it and it is started, I even restarted it. Am I doing something wrong? It is a critical error 6398
  • Anonymous
    October 23, 2013
    When the SPTimerJob Recycle at 6:00am my custom timer job which is set to run every minute does not restart. Would you have any idea of why this happens. We need to restart the custom timer job manually everyday.
  • Anonymous
    November 01, 2013
    Very helpful!
  • Anonymous
    May 12, 2014
    Thanks!  I manually ran the timer job and was wondering why the job was taking so long.  I feel better now!
  • Anonymous
    October 12, 2015
    Can we schedule job in such a way that it will run thrice a day or every 8 hours? I am not able to find the way to do this Thanks Neeraj