Farm Solution Deployment Lock and Removal

Farm Solution Deployment Lock may occur when a solution (.wsp) deployment fails unexpectedly.
Solution Deployment in SharePoint happens through the timer jobs. When you deploy a solution along with the deployment job a timer job named “Solution Deployment Job Lock” is created which store the deployment job’s id and the lifetime of the job is till the deployment job is completed. With this SharePoint ensures that no two deployments conflict with each other.

From the above we can conclude that in SharePoint one deployment job happens at a given time courtesy the solution deployment lock. Hence using this feature SharePoint ensures that no more than one deployment or retraction can happen at a given time.

So, why are we discussing this here. Ideally the lock is released once a deployment or retraction has been released, but there might be some cases when this lock doesn’t get released i.e. for some reason the timer job responsible for the lock does not get deleted. For instance as mentioned earlier that the solution deployment/retraction is done by a timer job and for some reason the timer service gets terminated leaving the lock unreleased.

To recover from this lock you need to use the following PowerShell command which releases the solution deployment lock.