I recently had an issue with TFS TeamBuild where the builds would get stuck if you configured the build definition to publish symbols. The build would hang at the Publish Symbols activity for an hour and timeout causing the build to fail.
The symbol server share location requires exclusive access during publishing, its a file based database. Therefore a shared resource lock is placed within the Team Project Collection where the build definitions reside. To find out which locks are in place open a SQL Server Management Studio window and within the TPC database you can view all locked resources running the following query…select * from tbl_SharedResource where LockedBy is not null
Locks may remain in place, if for example the build controller crashed during a build and failed to release the lock. This will subsequently cause all builds to hang.
To remove the lock you can run the following stored procedure…(replace the requestedby parameter with the build controller in the above query that holds the lock)DECLARE@RCint DECLARE@partitionIdint DECLARE@resourceNamenvarchar(256) DECLARE@instanceIdnvarchar(64) DECLARE@requestedBynvarchar(256) SET@partitionId=1 SET@resourceName=NULL SET@instanceId=NULL SET@requestedBy=‘vstfs:///Build/Controller/34′ EXECUTE@RC=[dbo].[prc_ReleaseSharedResourceLock] @partitionId ,@resourceName ,@instanceId ,@requestedBy
I would just like to stress making changes to your database without support from Microsoft is not recommended and therefore I take no responsibility for loss or issues arisen from the use of the above scripts.
Just one final tip as each TPC manages its own resource locks – its a good idea not to share the same UNC path for multiple TPC’s as this could also result in access errors.