SharePoint: Profile Synchronization Status stuck at Stopping

 

Symptoms:

Consider the following scenario:

You are using SharePoint 2010 or 2013 and using the “Use SharePoint Profile Synchronization” (FIM Sync) option to import user profiles.

In Central Administration | Manage Service Applications | User Profile Service Application, the “Profile Synchronization Status” shows as “Stopping” although the “<UPAName>-User Profile Incremental Synchronization” timer job is not running.

 

Cause:

Somehow the IsSynchronizationRunning property of the Incremental Sync timer job gets stuck at “True” even though the timer job is not running, and nothing is happening in the FIM client (miisclient.exe).

I believe this can happen if the “Forefront Identity Manager Service” Windows service (in services.msc) is stopped when SharePoint starts a Synchronization. In that case, SharePoint thinks it’s running a Sync, but FIM never got the memo. Later, the “Timer Service Recycle” timer job restarts the SharePoint Timer Service and the Synchronization gets stuck in the “Stopping” state.

 

 

Verify:

Run the following PowerShell to output the status of the timer job:

get-sptimerjob | ?{$_.name -match “ProfileImportJob”} | Select name, title, RunAsFullImport, RunAsFullSYnc, IsRunning, IsSynchronizationRunning | fl

 

The output will look something like this:

Name                     : UPA_ProfileImportJob

Title                    : UPA – User Profile Incremental Synchronization

RunAsFullImport          : {MOSS}

RunAsFullSync            : {MOSS}

IsRunning                : False

IsSynchronizationRunning : True 

 

Notice that IsSynchronizationRunning is True, yet IsRunning is False.  Also, RunAsFullImport and RunAsFullSync are populated even though the timer job is not running, and nothing is happening in the FIM client.

 

Open the FIM Client (typically at “C:\Program Files\Microsoft Office Servers\15.0\Synchronization Service\UIShell\miisclient.exe”), on the Sync server and review the Operations tab. It will likely show that none of the steps are running, and maybe haven’t run in days. Also, the Management Agents tab will show all MAs as “Idle”.

 

Potential Solutions: 

It would make sense to try to use PowerShell to set the IsSynchronizationRunning property of the ProfileImportJob timer job back to “false”. The problem is, this property is read-only, so that won’t work.

Instead, I would try the following solutions. They are listed in order from least to most intrusive. Start with #1 and keep checking the Sync status as you move your way down the list.

1. Check and restart the Windows services.

On the Sync server, open Services.msc, and check on the “Forefront Identity Manager Service” and “Forefront Identity Manager Synchronization Service”. They should both be “Running”. If they are, restart them. Also, restart the SharePoint Timer Service while you’re at it.

If the “Forefront Identity Manager Service” is stopped, you can start it directly from Services.msc.

However, if the “Forefront Identity Manager Synchronization Service” is not running, that may indicate that the User Profile Synchronization Service (within SharePoint) is not running. In that case, the User Profile Synchronization Service should be restarted from within Central Administration.

 

2. In Central Administration, stop the User Profile Synchronization Service and re-start it.

This will re-provision the service and may get the import timer job unstuck.

 

3. Delete the import timer job and recreate it.

Note: These steps assume that there is only one User Profile Service Application (UPA) in the farm.  Each UPA will have its own Incremental Sync timer job (ProfileImportJob), so if your farm has more than one UPA, the PowerShell will need to be adjusted.

 

$tj = get-sptimerjob | ?{$_.name -match “ProfileImportJob”}

$tj.delete()

 

If you run get-sptimerjob | ?{$_.name -match “ProfileImportJob”} again, you should not get any output now, which verifies the timer job has been deleted.

 

Recreate the ProfileImportJob timer job by leveraging the built-in Health Analyzer rule.

a.      Go to Central Admin | Monitoring | Health Analyzer | Review rule definitions.

b.      In the Configuration section, find the rule called “Verify that the critical User Profile Application and User Profile Proxy Application timer jobs are available and have not been mistakenly deleted” and click on it. 

c.      Click Edit Item.

d.      Select the check box to “Repair Automatically” and Save.

e.      Click on that same health rule again.  You should see that “Repair Automatically” is now set to “Yes”.

f.       Click “Run Now” in the ribbon.

g.      If you run get-sptimerjob | ?{$_.name -match “UPA_ProfileImportJob”} | fl again, you should see that the timer job has been recreated and IsSynchronizationRunning should now be “false”.

h.      If you go back to the UPA management page in Central Admin, you should see that the “Profile Synchronization Status” is now “Idle”.

 

 

Keywords and Definitions:

FIM = Forefront Identity Manager

FIM Client = miisclient.exe

UPA / UPSA = User Profile Service Application

AD = Active Directory

User Profile Sync, Synch, Synchronization